News for hackers. Stuff that matters.
Re:Crystal: the programming language by vortico on Tuesday November 25, 2014 @02:35PM (#8659278)
I am excited to see new programming languages like this. I can name 100 duck typed, interpreted, GC'd languages, but only half a dozen native compilers for modern languages. Native binaries are much easier to deploy on consumer's desktops than bytecode or source code requiring >50MB VMs, and the code tends to be much more rigid and rigorous with a statically typed language like this.

I haven't downloaded the compiler yet, but here are a few things I like after reading the documentation.

- The C bindings are nice and simple in Crystal, with full support for structures and data types,

- "Globally named" symbols are a really great idea, especially in native binary when compiled to Int32's,

- OOP support seems polished with full support for encapsulation,

- Basic control structures and scope are also polished and familiar, while leaving beind the nasty parts from Ruby (i.e. `for do` vs `for`, Matz's regret for `do ... while`, etc)

- --hierarchy. Why haven't I seen a compiler support this by now?

A final point: "Everything is an object" and C-like efficiency seems paradoxical, but I'll look more into this. Objects may be abstracted by the compiler, but once compiled behave like any ole' statically typed system.

Re:Crystal: the programming language by cremno on Tuesday November 25, 2014 @02:50PM (#8659348)
>Matz's regret for `do ... while`

Huh? Do you mean http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/...? It's still there: http://crystal-lang.org/docs/syntax_and_semantics/while.html

Edit: Ah, the behavior of the while modifier is different in Crystal.

Re:Crystal: the programming language by vortico on Tuesday November 25, 2014 @03:03PM (#8659398)
I was referring to the veil of deprecation over `do end while` by Matz's comment that you've linked, but as long as Crystal endorses it, is it fine with me.
Re:Crystal: the programming language by asterite on Tuesday November 25, 2014 @03:10PM (#8659424)
We actually started by copying ruby's syntax and semantic, including the `do end while`. But a long time ago we started to diverge from it. We are also not sure about this "feature" and we still have time to remove it from the language :-) . It's true that a simple `while ... break if ... end` is enough.

Edit: I also misunderstood the comment. In Crystal `exp while cond` and `begin exp end while cond` are the same.