2 ms·
I like it because it encourages the newcomer to understand that the `=` "operator" in `foo.bar = 123` is actually just a part of a method named `bar=`. Though,
by JohnBooty 4y ago
I like it because it encourages the newcomer to understand that the `=` "operator" in `foo.bar = 123` is actually just a part of a method named `bar=`.
Though, to be honest, rather than an "instructive" error message... I sort of wish the language syntax itself forbade that space and simply forced you to write `foo.bar= 123` instead of `foo.bar = 123`.
I wonder if Matz himself has ever second guessed that choice he made in the 90s? =)
- quesera 4y ago> I sort of wish the language syntax itself forbade that space This syntactic sugar is definitely a bit weird, but it seems necessary in the "everything is an object" design, and to simultaneously meet Ruby's prime directive of maximizing developer happiness. Can you imagine the howling from the haters if `x = 1` was a syntax error?