On Sunday, 17 February 2013 at 06:28:09 UTC, Ary Borenszweig
wrote:
Hello everyone :-)
I follow this newsgroup from time to time. I like D templates.
I like the auto keyword. I like auto in templates. I love
efficiency and expressiveness.
I believe in smart compilers.
(you might remember me: I'm the author of Descent)
I *really* like D, because it cares about one thing I care
about: *performance*. Let's save this world's energy. Let's
make a better world. Let's make users' life more enjoyable.
Let's be happy :-)
But... do we really have to specify const pure safe nothrow and
whatnot? Can't the compiler be smarter? I'm sure there must be
a better way. Most new programming languages look like older
ones. Newness comes slowly...
One time I asked in this newsgroup if it was possible to have
an "auto" keyword for function/method arguments. And... why not
make all functions/methods be templates on the type of its
arguments?
I think nobody liked this idea. I said "Ruby is like this: you
never specify types in method definitions".
"But Ruby is not efficient". "Ruby is a dynamic language". "D
is compiled, so it's faster". "Don't make the mistake of
comparing a dynamic language with a static/systems programming
language". This were some of the answers I got.
I started thinking about this idea: a compiled language that
looked like a dynamic language. Is it possible?
Today, I'd like you to take a look at what me and my friend
Juan have been working on for the last half month or so. It's a
new programming language which aims to be efficient, have
similar syntax to Ruby, and where you never have to specify
types of variables and arguments.
https://github.com/manastech/crystal/wiki/Introduction
I'd also like to ask you:
1. Do you know whether a similar language exists?
2. Do you think it's feasible? Right now we are getting rather
high compilation times (say, a minute) if we use lots of
generic classes on medium-large programs. We are still trying
to think of the best way to improve compilation times while at
the same time taking off programmer's burden.
(The compiler is written in Ruby, which is a bit slow, so that
might be one reason it is a bit slow on medium-large
programs... imagine Ruby might be 10 to 100 times slower than
C, so that minute might be reduced to less than a second... we
are currently working on bootstrapping the compiler... but if
compilation is on an exponential order, well, you know... ...
and the compiler is written in Ruby because it'll later (now?)
be easier to port to Crystal, which has a very similar syntax)
I ask about feasibility, but right now you can use this
language for small to medium programs (except the standard
library is still incomplete).
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?
We are also thinking about incorporating concurrency features,
like the ones present in Erlang and Go.
In short: utopy =o)
I hope at least someone likes this project...
(I hope at least you, Jacob Carlborg, Ruby lover, find it
interesting... or maybe you, bearophile?)
Thanks for your comments,
Ary
P.S.: bin/crystal -e 'a = 0; 10.times { |i| a += i }; puts a'
-O3 -ll
I think this project is really interesting. I really like Ruby,
but I don't use it much because it is very slow. Another problem
I have with Ruby is that if you, say, rename a method but miss a
place it is called, you won't get an error until you try
executing that code at runtime (although I suppose tests should
catch that). Crystal fixes both of these. Also, I like how you
can call C functions. And it has macros.
It does make me wish that LLVM supported exceptions on Windows...