Earlier quoted context omitted.
How do you model a "zero or one" relationship without null? Maybe your answer is "with Optional" (or Option, or Maybe). We just choose to use union types and have "Nil | T" (Nil or T) be the same as "Option(T)" in other languages.
> How do you model a "zero or one" relationship without null? With something that leaves "Nullpointer analysis" obsolete/useless.
The Crystal Programming Language
101–110 of 180 posts
Re: The Crystal Programming Language
#102I'm looking for something beautiful like Ruby but fast like Go. Do you think Crystal fits this bill? Also, are there packages/libs/gems for Crystal? What are they called? What do I google for? One of the major reasons why I dumped Go is that it's just too verbose and makes me write too much boilerplate code. I want to sort a collection and I have to write the same algorithm every single time for every single type. It…
You definitely should at least look into Julia. I would say it is more elegant than any other language I've seen while being faster than pretty much anything except for straight C / C++ / D / Rust (native systems languages). It should be easy to beat Go in performance and match or exceed Ruby in elegance and simplicity. It's Achilles heel(s) right now though are multi-threading and JIT compilation times (which should…
Re: The Crystal Programming Language
#103Earlier quoted context omitted.
Elixer and Erlang are not faster than go. The ability to respond in microseconds is a latency issue, not a raw speed issue. Erlang and Elixer can do that because of the way the core systems are architected but the underlying VM and language constructs are quite a bit slower than anything that Go has to offer. For maximum throughput out of a given chunk of hardware you'd want Go. Erlang / Elixer and the associated VM…
If we are talking about maximum throughput, then you want C++ and in my tests Java has been better than Go, .NET probably is better than Go as well - because when speaking of maximum throughput RAM becomes the biggest bottleneck. And as soon as you're talking about platforms with a non-optional GC, then we start speaking about the performance and predictability of that GC. Go doesn't bring improvements for managing m…
Re: The Crystal Programming Language
#104Earlier quoted context omitted.
> How do you model a "zero or one" relationship without null? With something that leaves "Nullpointer analysis" obsolete/useless.
To be replaced with an analysis that finds unmatched cases (like None when you assumed Maybe)?
Re: The Crystal Programming Language
#105Earlier quoted context omitted.
How do you model a "zero or one" relationship without null? Maybe your answer is "with Optional" (or Option, or Maybe). We just choose to use union types and have "Nil | T" (Nil or T) be the same as "Option(T)" in other languages.
> How do you model a "zero or one" relationship without null? With something that leaves "Nullpointer analysis" obsolete/useless.
Re: The Crystal Programming Language
#106Earlier quoted context omitted.
An ambiguous syntax is not elegant to program with. Is this a variable reference? Is it a method call? I dunno!
> Is this a variable reference? Is it a method call? I dunno! Neither. It's a message sent to an object. The object decides how to respond to that message. Caring about the implementation of the message receiver breaks information hiding. If you have to distinguish between .message and .message(), you already know more than you need to know to interact with that object. Every language is confusing until you understan…
Variables and methods are treated differently. I can't pass arguments to a variable, I can't even write foo(), but if it were a method I could. I can't treat variables like any other object because they have different rules applied.
Re: The Crystal Programming Language
#107See Wiki 1. to 9. If you enjoy your first try for Crystal Language, it's nice.
Re: The Crystal Programming Language
#108Re: The Crystal Programming Language
#109I don't understand why Ruby's syntax is seen as so elegant. It's ambiguous and a nightmare to parse. http://programmingisterrible.com/post/42432568185/how-to-par...
I know syntax shouldn't matter, but personally I think consistency is very important.
Re: The Crystal Programming Language
#110Earlier quoted context omitted.
> How do you model a "zero or one" relationship without null? With something that leaves "Nullpointer analysis" obsolete/useless.
A tiny observation here: we don't do "null pointer analysis". We do this kind of analysis for every type: if you invoke a method on a type and that method doesn't exist, you get a compile error. In the case of a type union, all types must respond to that method. "Nil | T" is just one particular type union, but you can also have "Int32 | String", etc.