It’s really interesting how this one simple (I thought) proposal has produced
so much fear and anxiety. So let me try to lower peoples blood pressure.
1: You ARE NOT REQUIRED to ever use this.
If you don’t want to use this in your code then don’t! But understand it so you can read|understand code that uses it.
2: This is merely more syntactical sugar to write more concise|shorter code.
Crystal already provides shortcuts to simplify writing certain highly used patterns.
(x > 0) ? y : z
a if b
record Ray, start : Vector, dir : Vector
https://crystal-lang.org/api/1.0.0/toplevel.html#record(name,*properties)-macro
3: This DOES NOT create any whitespace dependencies.
Crystal doesn’t use whitespace|indentation dependencies now, and wouldn’t after.
4: The parser already does what this proposal wants.
No new fundamental process is required to implemented this. The parser already must identify and resolve endpoints. This probably adds a few more rules to accommodate it.
5: It can be implemented to fail for (non-trivial) ambiguities.
It can be implemented to produce error messages when it encounters ambiguities.
This will force coders to write proper legal code to do what they want|mean.
6: This won’t stop people from writing illegal code.
If you’re hellbent on writing illegal code, nothing will stop you now either, or afterwards.
(x > 0) ? y : z end
end a if b
record Ray, start : Vector, dir : Vector end
7: This does not change language internals.
This proposal has no affect on the internal implementation of Crystal, just source code formatting.
Ultimately, the only sure way to know the impact of this proposal is to implement it.
This shouldn’t be that hard, since Python|Nim do exactly this with whitespace and indentation. At minimum, those parsers provide a starting basis as a guide to implement this.
Finally, the Crystal devs are very bright people. I’m sure if they want it they can do it. The only question to me is if they feel like it’s worth doing. Of course I think it is, while some others expressed not.
But it’s really not an insurmountable technical issue.