An error I don't understand

Run this is playground and all seems well:

s = “”
(s = “123”).size

Omit (or comment out) the first line (s = “”) and a strange error occurs:

(s = “123”).size


You’ve reached a bug in the playground. Please let us know about it.


(s = “123”).size s.size


error in line 4 Error: instantiating ‘Crystal::Playground::Agent#i(Int32)’ error in line 4 Error: instantiating ‘Crystal::Playground::Agent#i(Int32)’ error in line 5 Error: undefined local variable or method ‘s’ for top-level Did you mean ‘p’?

The “let us know” takes me to “GitHub” where I’m expected to have an account. I don’t use Github, because it is owned by Microsoft.

Anyway, this seems like some kind of error in Crystal or something.

Yes, this is an issue with the playground specifically and has been reported as Playground crashes when accessing variable assigned in the previous line in an assignment expression. · Issue #7091 · crystal-lang/crystal · GitHub.

Good to know others have found/reported this issue as well.
Thank you for responding. My excitement for Crystal 1.0 could not be greater.