Crystal

Ary Borenszweig ary at esperanto.org.ar
Wed Feb 20 07:33:45 PST 2013


On 2/20/13 6:28 AM, Knud Soerensen wrote:
> On 2013-02-17 07:28, Ary Borenszweig wrote:
>> The goal of this programming language it so be as efficient as possible,
>> but probably it won't be as efficient as C in the general case. But...
>> who knows?
>>
>
> Do you know abou julia ?
> http://julialang.org/

Yes :-)

Before we started developing Crystal we searched for similar languages, 
found Julia and it really amazed us.

It's similar in some aspects, like the use of LLVM, multiple-dispatch 
and the idea that implementing everything in the same language leads for 
more optimizable and inlineable code (compared to Matlab, R, Python or 
Ruby, where when you want to have optimized code you write it in C).

On the other hand, you must specify the structure (and optionally the 
types) of a type:

type Foo
   bar
   baz::Int
   qux::Float64
end

In Crystal a class's fields and types are inferred by its usage. And 
anywhere in the code you can reopen a class to add more fields/methods 
to it, which is something we like when you want to change/extend a 
library's code without modifying its code (aka monkey patching :-P)

The following is an error in Julia:

julia> a = [1, "hello"]
no promotion exists for Int64 and ASCIIString

But in Crystal it works just fine (I think you can still have arrays of 
mixed types in Julia, but you either must specify it as Array{Any} or 
use another constructor, not sure). We want that to work transparently 
(with a minimal impact on performance, of course).

And Julia is oriented to technical computing, but we want Crystal to be 
a general purpose programming language (not sure it can be a systems 
programming language... probably yes since we already have pointers and 
pointer arithmetic, but we'll probably need to add a lot more to the 
language).

Finally, Julia has a macro system similar to Crystal... and in fact we 
took the idea from there (though the original idea seems to come from Lisp).


More information about the Digitalmars-d-announce mailing list