Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crystal/src/string.cr:139: can't declare variable with Self #6547

Closed
paulcsmith opened this issue Aug 16, 2018 · 15 comments · Fixed by #6557
Closed

crystal/src/string.cr:139: can't declare variable with Self #6547

paulcsmith opened this issue Aug 16, 2018 · 15 comments · Fixed by #6557

Comments

@paulcsmith
Copy link
Contributor

paulcsmith commented Aug 16, 2018

This is a high severity bug that luckily seems not to impact most projects. Unfortunately, it is making it so Lucky will not work on 0.26 though. I'm giving a workshop on Crystal and Lucky tomorrow so I would love to fix this before then so everyone can build something 😜 but I know we're all volunteers so if the core team doesn't have time that is ok! I'll figure something out.

The problem

On Crystal 0.26, compiling lucky_record fails with this error:

Error in /Users/paulcsmith/projects/crystal-lang/crystal/src/string.cr:139: can't declare variable with Self

  include Comparable(self)

Note: This is the whole trace, even with --verbose. I'm not sure what in LuckyRecord/Crystal is causing this.

Steps to reproduce

Oddities

It seems that the error is in Crystal, but that particular line of code it is referencing (src/string.cr:139) hasn't changed in years.

I'm having a hard time even figuring out what is wrong since it fails so fast and there is no trace. I tried using --verbose and still didn't see anything. I'm not sure how to debug this

@paulcsmith
Copy link
Contributor Author

paulcsmith commented Aug 16, 2018

BTW @bcardiff and other manas people, I know you have client obligations and have a lot on your plate. I’m happy to make an additional donation to prioritize this. I think that’s the fair thing to do for something that I’d love some help with ;)

LMK if that’ll help give someone time to look at this soon and I’ll make a quick donation on BountySource!

@bcardiff
Copy link
Member

I will work on this asap today.
Thanks for your perspective regarding efforts in Crystal.

@asterite
Copy link
Member

What happens if you change that include to include Comparable(String)? (you'll have to change the src directory from the crystal installation, or simply use a different CRYSTAL_PATH to try it out). If that works, that can be a workaround until someone figures out what broke.

As a side note, I think having self as a type restriction, or as a type at all (here in include) was a mistake. I'll explain later why.

@paulcsmith
Copy link
Contributor Author

paulcsmith commented Aug 16, 2018 via email

@bararchy
Copy link
Contributor

I know anything here was done with good intentions, we just might want to avoid sending a message that tasks are prioritized by amount of donations to the project.

@j8r
Copy link
Contributor

j8r commented Aug 16, 2018

@paulcsmith You could just have posted a bounty in https://www.bountysource.com/issues/62220002-crystal-src-string-cr-139-can-t-declare-variable-with-self , and reference the link on the issue.

@paulcsmith
Copy link
Contributor Author

paulcsmith commented Aug 16, 2018 via email

@bcardiff
Copy link
Member

@paulcsmith I didn't expect extra donation. You are already supporting us.

This issue is important because is blocking lucky, probably due to a inconsistency in the stdlib or bug.

@Sija
Copy link
Contributor

Sija commented Aug 16, 2018

IMHO it would be better to frame it as a bounty (with money reward).

@paulcsmith
Copy link
Contributor Author

Yes that would have been better wording. And I like supporting crystal so even if the extra bounty was not necessary, I’m happy to support Crystal development :)

@bararchy
Copy link
Contributor

@paulcsmith As I said, I know you didn't mean it :) and I think lucky is very high in the priority tree.
This is also in part why I knew @bcardiff was so eager to help, I was just pointing that this could be a risky message.

Paying manas is 100% fine, not only fine but important :) so again, was just worried about the situation, not the "details"

@fernandes
Copy link
Contributor

@asterite changing to include Comparable(String) make the test suite pass...

@patrickkh7788
Copy link

how to use the fix ? first time try cr then get this bug. i check again and think some of my step get wrong.

@RX14
Copy link
Contributor

RX14 commented Aug 17, 2018

@patrickkh7788 the easiest thing to do is wait for crystal 0.26.1 to come out in a new days

@paulcsmith
Copy link
Contributor Author

Woo hoo! Thanks Crystal team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants