3 ms·
I generally like Crystal. However I think there’s a some unfortunate choices that make it hard to use. I’d really love to see them addressed (or planned for) be
by abhorrence 7y ago
I generally like Crystal. However I think there’s a some unfortunate choices that make it hard to use. I’d really love to see them addressed (or planned for) before 1.0:
- global inference is more trouble than its worth. some way to opt sections of code out of global inference in exchange for faster compile times and better type error messages would be wonderful
- conflicting/duplicate C bindings in libraries aren’t easy (or even possible sometimes) to reconcile
- a lot of standard library interfaces to system stuff (e.g. sockets) are hard to extend for additional uses. there’s a number of reasons for this, but among them: enums wrapping simple integer based enums, but not actually covering all the values.
- parser is hard to reuse outside of the compiler itself, which is an impediment to making neat tools.
- some strange choices around co/contra-variance when dealing with arrays
- chrisseaton 7y ago> global inference I think this is long-gone isn't it? It's local now. > parser is hard to reuse outside of the compiler itself A problem we repeat again and again!
- abhorrence 7y agoI think it's maybe less global than it was previously (and in a way that helps pave the way for improving compile times), but there's still a lot of ways to cause spooky type errors at a distance due to the assignment type inference rule. module Example def self.some_method "string" end class Foo getter :var1 def initialize @var1 = SomeUtilities.something end end module SomeUtilities def self.something Example.some_method end def self.do_something_with_string(input : String) puts input end end end Example::SomeUtilities.do_something_with_string(Example::Foo.new) If you change Example.some_method to return :symbol, you now get a type error on the final line.
- yxhuvud 7y agoI like that behaviour. Normally you don't get to pay the overhead of having to spell it out but it is a nice tool to have, being able to gradually add type information to fence in errors.