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

Created on 16 Aug 2018  Ā·  15Comments  Ā·  Source: crystal-lang/crystal

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

Most helpful comment

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.

All 15 comments

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!

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

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.

Thanks @bcardiff! I made a donation on BountySource

On Aug 16, 2018, at 8:15 AM, Brian J. Cardiff notifications@github.com wrote:

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

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

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.

@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.

I understand what you mean. I think this is tricky partly because of my wording.

I think this issue should be prioritized anyway because:

  • Lucky is a fairly popular project
  • Lucky completely fails to compile right now

I’ve donated over a thousand dollars to Crystal and not asked for any special priotization because I don’t think that is fair.

In this case I asked for it because I’m doing a workshop tomorrow and right now that can’t happen :(

I offered money not so much as a donation, but as a client of Manas to ask them to do this work in place of normal client work. I think this is 100% ok. I phrased it as a ā€œdonationā€ but that was my mistake. It was just the easiest way I knew to get it done quickly.

I could have posted on BountySource for this specific issues but since this is so time sensitive I wanted to make sure it could be done quickly.

I hope this clarifies things and I’m sorry for any trouble it has caused.

On Aug 16, 2018, at 9:18 AM, Julien Reichardt notifications@github.com wrote:

@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.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@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.

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

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 :)

@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"

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

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

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

Woo hoo! Thanks Crystal team

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Papierkorb picture Papierkorb  Ā·  3Comments

relonger picture relonger  Ā·  3Comments

lgphp picture lgphp  Ā·  3Comments

asterite picture asterite  Ā·  3Comments

costajob picture costajob  Ā·  3Comments