News for hackers. Stuff that matters.
Re:Moving from Ruby to Rust by james_s_tayler on Thursday February 14, 2019 @06:39PM (#19167148)
Crystal isn't exactly something I'd run in production.

Besides it's crippled as a language due to never allowing anything to be null, so there isn't any powerful metaprogramming you can do with it. That is a big turn off for me. Otherwise Crystal would be such a nice sweet spot IMO .

Re:Moving from Ruby to Rust by realusername on Friday February 15, 2019 @12:09AM (#19168585)
Not allowing NULL & having weak metaprogramming options sounds like advantages to me. you still have metaprogramming using language templates & scope shadowing, that's not at runtime but it's clearly good enough.

The problem with Crystal is more with the small community than the concept itself which is pretty good IMO.

Re:Moving from Ruby to Rust by james_s_tayler on Friday February 15, 2019 @01:10AM (#19168823)
I'm not feeling it. Compile time only metaprogramming just doesn't feel powerful enough. Just a personal thing.

I'm definitely a fan of Crystal of though as a project and would really like to see a bigger community and more libraries etc.

Re:Moving from Ruby to Rust by realusername on Friday February 15, 2019 @02:30AM (#19169140)
They don't do it because runtime metaprogramming has a lot of disadvantages, it's difficult to optimize so it runs poorly, it throws away the static typing out of the window and it's difficult to debug. I spent hours debugging Rails code in the past because of the layers of monkey patching.
Re:Moving from Ruby to Rust by james_s_tayler on Friday February 15, 2019 @03:24AM (#19169357)
It also has a lot of advantages. It's as powerful as it is dangerous.

The real reason they don't do it is because they can't. It's inherently unsafe. In order to always be sure something is never null you have to be aware of what all it's inputs are so you can reason about it. That's not possible with runtime metaprogramming techniques.

I dunno I guess I just think it's an odd choice. Don't get me wrong, it's a neat experiment and I value it. I'm just slightly miffed that that particular experiment had to mixed in with what amounts to a statically typed language with the beauty and simplicity of Ruby but the friendliness and discoverability of static typing.

Re:Moving from Ruby to Rust by galfarragem on Friday February 15, 2019 @04:20AM (#19169559)
> would like to see a bigger community and more libraries

Better Windows support could make wonders.

Re:Moving from Ruby to Rust by yxhuvud on Friday February 15, 2019 @11:32AM (#19172190)
Uh, it allows stuff to be nil if you declare the type of something to include nil. But then you also have to handle it. In practice, it make my code better.
Re:Moving from Ruby to Rust by icebraining on Thursday February 14, 2019 @09:40PM (#19168045)
Why would you need nulls to do metaprogramming?
Re:Moving from Ruby to Rust by james_s_tayler on Friday February 15, 2019 @12:51AM (#19168755)
Because it usually involves doing a lot of things that are unsafe. Take reflection for instance. There is no way to guarantee at compile time that a string whose value is only known at run-time is actually a real method in the code that can be invoked.

To get the level of safety they have gone for they have to disallow anything that could potentially blow up.

Re:Moving from Ruby to Rust by icebraining on Friday February 15, 2019 @06:24AM (#19170009)
Why would that require nulls? They could use an Option type or just throw an exception.