www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Crystal

reply Ary Borenszweig <ary esperanto.org.ar> writes:
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
Feb 16 2013
next sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 17.02.2013 07:28, schrieb Ary Borenszweig:
 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
Nice work. Have you looked into Ruby Motion or Mirah as well? -- Paulo
Feb 16 2013
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-02-17 08:46, Paulo Pinto wrote:

 Have you looked into Ruby Motion or Mirah as well?
Or MacRuby. It's free (as in free beer) and open source, not something that Ruby Motion is. -- /Jacob Carlborg
Feb 17 2013
parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 17.02.2013 12:57, schrieb Jacob Carlborg:
 On 2013-02-17 08:46, Paulo Pinto wrote:

 Have you looked into Ruby Motion or Mirah as well?
Or MacRuby. It's free (as in free beer) and open source, not something that Ruby Motion is.
My problem with MacRuby and Ruby Motion is they are tied to Mac OS X. Crystal's usage of LLVM is actually quite positive in that regard. -- Paulo
Feb 17 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-02-17 14:21, Paulo Pinto wrote:

 My problem with MacRuby and Ruby Motion is they are tied to Mac OS X.
Yeah, I agree. But developing for iOS is pretty tied to Mac OS X anyway. -- /Jacob Carlborg
Feb 17 2013
prev sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
 Have you looked into Ruby Motion or Mirah as well?
Ruby Motion is not open source, so we couldn't (or didn't want) to take a look at that. Mirah compiles for the JVM, and we want to compile to native code. We try to escape from virtual machines...
Feb 17 2013
parent Paulo Pinto <pjmlp progtools.org> writes:
Am 17.02.2013 17:41, schrieb Ary Borenszweig:
 Have you looked into Ruby Motion or Mirah as well?
Ruby Motion is not open source, so we couldn't (or didn't want) to take a look at that.
I know, the question was more in the value proposal kind of way.
 Mirah compiles for the JVM, and we want to compile to native code. We
 try to escape from virtual machines...
Currently yes, but there have been discussions to get it to compile to native code via LLVM.
Feb 17 2013
prev sibling next sibling parent reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
17.02.2013 10:28, Ary Borenszweig пишет:
 Hello everyone :-)

 ...

 (you might remember me: I'm the author of Descent)
A Hero is here! Let me kowtow to you, a Descent Creator!
 ... Let's save this world's energy.
It's pleasantly to see this point of view at efficiency.
 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?
Looks like it is, by what is the reason? I'd like to specify function attributes explicitly because I do want to get a compilation error when I e.g. use non-safe stuff in safe function instead of a just compiler silently changing the function (and all functions which use it) to unsafe. I also don't use type inference everywhere because sometimes I do want to see exact types (yes, IDE problem) and sometimes I just don't want a type to be accidentally changed because of some function signature change as in the worst case the code will still compile but will work incorrect. Now about argument types. I do not understand the purpose of dynamic typing at all and consider such languages too dangerous to use in real projects. You proposal is a bit better as it will give CT errors (instead of RT in dynamic typing case) but still bad as the code can accidentally compile and work incorrect. Also this looks as a step back as your proposal is like making from a function something like C's preprocessor macro. And I remember how somebody defended C's macros and told "you can do it with macro", then he gave his code where he made a fatal mistake by passing two parameters to a macro in a wrong order. And that code accidentally compiled. Same thing can happen with every high templated code where it is hard to predict every possible argument combination. I also have seen a lot of mistakes of any types in D templated code so I consider such code almost as dangerous as pointer arithmetic and you proposal to make everything a template looks as insane.
 ...

 Thanks for your comments,
 Ary

 P.S.: bin/crystal -e 'a = 0; 10.times { |i| a += i }; puts a' -O3 -ll
Sorry for such cruel comment, I it is just my opinion. -- Денис В. Шеломовский Denis V. Shelomovskij
Feb 17 2013
parent Ary Borenszweig <ary esperanto.org.ar> writes:
On 2/17/13 6:29 AM, Denis Shelomovskij wrote:
 I'd like to specify function attributes explicitly because I do want to
 get a compilation error when I e.g. use non-safe stuff in safe function
 instead of a just compiler silently changing the function (and all
 functions which use it) to unsafe.=
It's something I didn't have time to write in that wiki page, but you can restrict the types of a function. def foo(x : Int) 1 end This is similar to what you can do with D templates. You can also restrict an overload an use another one unrestricted and it will choose the correct one: def foo(x : Int) 1 end def foo(x) 2 end So theoretically you can type everything you want. We might also support typing a variable in order to disallow it to change to another type (I think this is what is done in the Julia language).
 Now about argument types. I do not understand the purpose of dynamic
 typing at all and consider such languages too dangerous to use in real
 projects.
In the place I work we've written several web applications and programs in Ruby and they work just fine. We writes lots of test units to make sure everything works (you don't have another option, really, with dynamic languages).
 Sorry for such cruel comment, I it is just my opinion.
It's not cruel at all. I really appreciate your comments.
Feb 17 2013
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Ary Borenszweig:

 I started thinking about this idea: a compiled language that 
 looked like a dynamic language. Is it possible?
Of course it's possible, I given my help in the development of ShedSkin: http://code.google.com/p/shedskin/ Its compilation times are significant and they keep growing quickly as the amount of compiled code grows. Bye, bearophile
Feb 17 2013
prev sibling next sibling parent reply Russel Winder <russel winder.org.uk> writes:
Why is this thread on the announce mailing list instead of the
discussion list?

--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Feb 17 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-02-17 10:52, Russel Winder wrote:
 Why is this thread on the announce mailing list instead of the
 discussion list?
Because he announces a new language ? -- /Jacob Carlborg
Feb 17 2013
prev sibling next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-02-17 07:28, 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
In general I like it.
 I'd also like to ask you:

 1. Do you know whether a similar language exists?
Except from what others already have mentioned someone created a language with a Python like syntax written in D. But I think that had explicit types.
 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)
You can try and precompiled it with MacRuby and see if you get different timings.
 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?)
I find it very interesting. But actually I'm going to agree with Denis, mostly. If I was going to use Crystal I would probably use a lot more static typing than it's probably made for. I quite often miss static typing in Ruby. Often there are functions that are supposed to only work with a given type, I don't see why I shouldn't explicitly write that type out then. A couple of questions: * Executable code at class level, is that supported? If that's the case, when is it run? Example: class Foo puts "asd" end * With a statically typed languages you quite soon get the need for interfaces, abstract classes and similar. How is this handled? * Is Ruby code supposed to be able to run of out the box in Crystal? That is can I take arbitrary Ruby code and compile it with Crystal and expect it to work. If that's the case, what's currently supported and what's not supported? -- /Jacob Carlborg
Feb 17 2013
next sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
On 2/17/13 9:14 AM, Jacob Carlborg wrote:
 I find it very interesting. But actually I'm going to agree with Denis,
 mostly. If I was going to use Crystal I would probably use a lot more
 static typing than it's probably made for.

 I quite often miss static typing in Ruby. Often there are functions that
 are supposed to only work with a given type, I don't see why I shouldn't
 explicitly write that type out then.
As I replied to Denis, you can specify type restrictions in functions and methods. def foo(x : Int) 1 end It works similar to overloaded templates: you don't specify the type of the function, but which types you can give to it. In the case of Int, of course it will always just accept an Int. But you can specify for example def foo(x : Enumerable) end And there's a special restriction, self, that will only match for the owner of the method. This is used for example in the Comparable module: https://github.com/manastech/crystal/blob/master/std/comparable.cr
 A couple of questions:

 * Executable code at class level, is that supported? If that's the case,
 when is it run? Example:

 class Foo
    puts "asd"
 end
I thought it was supported but it's not. It would be very easy to support it, but it would execute at run time, as if you had put it before the class declaration. However, there's another thing I didn't mention in that wiki page and that is macros. You can write; --- macro define_something "def something; 1; end" end --- Again, this is different from Ruby. Macros are executed at compile time. You can pass arguments to them, and their type will be the AST node of the expression you give them. They must return a String (for now), and it will be mixed in the program (later we'll support returning AST nodes directly). We use macros for attr_accessor and the like: https://github.com/manastech/crystal/blob/master/std/object.cr Just note that this is an experimental feature, and for now only variables, strings and symbols are allowed for macros. Macros can execute arbitrary code and have access to what you defined in your program. That means they can open a file, read/write a database and so on. I believe this can be very powerful for metaprogramming. (this is inspired mainly from Lisp)
 * With a statically typed languages you quite soon get the need for
 interfaces, abstract classes and similar. How is this handled?
If you don't need them in Ruby I don't see why would you need them in Crystal. The only use of interfaces is to satisfy the compiler. But since Crystal is mostly duck-typed interfaces have no use. Another use is probably performance, and we are still considering how to fit everything together. We are writing code in Crystal and see where it's slow, and think of the most little change that's not a burden for the programmer that can help speed up compilation times.
 * Is Ruby code supposed to be able to run of out the box in Crystal?
 That is can I take arbitrary Ruby code and compile it with Crystal and
 expect it to work. If that's the case, what's currently supported and
 what's not supported?
You probably won't have eval, define_method and so on. You will be able to do some of those things with macros, but it's not the same. Most Ruby code should run out of the box, unless something is missing from the standard library. For example I tried running this code: https://gist.github.com/havenwood/4724778 (removing the Time.now lines, because we don't have that yet) and it just worked. And it was much faster than all of the other languages. Our idea was to make a language as similar as Ruby, not with the intention of compiling Ruby. But accidentally (or not :-P) it is happening, slowly. Thanks for your comments and questions!
Feb 17 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-02-17 17:34, Ary Borenszweig wrote:

 As I replied to Denis, you can specify type restrictions in functions
 and methods.

 def foo(x : Int)
    1
 end



 It works similar to overloaded templates: you don't specify the type of
 the function, but which types you can give to it. In the case of Int, of
 course it will always just accept an Int. But you can specify for example

 def foo(x : Enumerable)
 end
Yeah, I saw there's explicit static typing.
 And there's a special restriction, self, that will only match for the
 owner of the method. This is used for example in the Comparable module:

 https://github.com/manastech/crystal/blob/master/std/comparable.cr
So in that case "self" would evaluate, at compile time, to whatever Comparable is mixed in to?
 I thought it was supported but it's not. It would be very easy to
 support it, but it would execute at run time, as if you had put it
 before the class declaration.
That code will be executed as soon as the file has been loaded using "require"?
 However, there's another thing I didn't mention in that wiki page and
 that is macros. You can write;

 ---
 macro define_something
    "def something; 1; end"
 end




 ---
Yeah, I saw that.
 Again, this is different from Ruby.

 Macros are executed at compile time. You can pass arguments to them, and
 their type will be the AST node of the expression you give them. They
 must return a String (for now), and it will be mixed in the program
 (later we'll support returning AST nodes directly).

 We use macros for attr_accessor and the like:

 https://github.com/manastech/crystal/blob/master/std/object.cr

 Just note that this is an experimental feature, and for now only
 variables, strings and symbols are allowed for macros.

 Macros can execute arbitrary code and have access to what you defined in
 your program. That means they can open a file, read/write a database and
 so on. I believe this can be very powerful for metaprogramming.

 (this is inspired mainly from Lisp)
This looks cool.
 If you don't need them in Ruby I don't see why would you need them in
 Crystal.
You don't need them in Ruby because it's dynamically typed.
 The only use of interfaces is to satisfy the compiler. But since Crystal
 is mostly duck-typed interfaces have no use.
But it does support explicit static typing. It doesn't look easy to restrict a method for a given type for something like an interface. So what will happen is one use duck typing and it will basically be the same as templates without constrains.
 Another use is probably performance, and we are still considering how to
 fit everything together. We are writing code in Crystal and see where
 it's slow, and think of the most little change that's not a burden for
 the programmer that can help speed up compilation times.

 * Is Ruby code supposed to be able to run of out the box in Crystal?
 That is can I take arbitrary Ruby code and compile it with Crystal and
 expect it to work. If that's the case, what's currently supported and
 what's not supported?
You probably won't have eval, define_method and so on. You will be able to do some of those things with macros, but it's not the same. Most Ruby code should run out of the box, unless something is missing from the standard library. For example I tried running this code: https://gist.github.com/havenwood/4724778 (removing the Time.now lines, because we don't have that yet) and it just worked. And it was much faster than all of the other languages. Our idea was to make a language as similar as Ruby, not with the intention of compiling Ruby. But accidentally (or not :-P) it is happening, slowly.
I see. -- /Jacob Carlborg
Feb 17 2013
parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
On 2/17/13 4:09 PM, Jacob Carlborg wrote:
 On 2013-02-17 17:34, Ary Borenszweig wrote:

 As I replied to Denis, you can specify type restrictions in functions
 and methods.

 def foo(x : Int)
    1
 end



 It works similar to overloaded templates: you don't specify the type of
 the function, but which types you can give to it. In the case of Int, of
 course it will always just accept an Int. But you can specify for example

 def foo(x : Enumerable)
 end
Yeah, I saw there's explicit static typing.
 And there's a special restriction, self, that will only match for the
 owner of the method. This is used for example in the Comparable module:

 https://github.com/manastech/crystal/blob/master/std/comparable.cr
So in that case "self" would evaluate, at compile time, to whatever Comparable is mixed in to?
Yes.
 I thought it was supported but it's not. It would be very easy to
 support it, but it would execute at run time, as if you had put it
 before the class declaration.
That code will be executed as soon as the file has been loaded using "require"?
Since it's not yet implemented, it could be like that, or it can be that it is evaluated when you execute the program (but not at compile time).
Feb 17 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-02-17 21:22, Ary Borenszweig wrote:

 Since it's not yet implemented, it could be like that, or it can be that
 it is evaluated when you execute the program (but not at compile time).
But if I just but code that the top level of a file, when at runtime is that executed? -- /Jacob Carlborg
Feb 17 2013
parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
On 2/17/13 5:46 PM, Jacob Carlborg wrote:
 On 2013-02-17 21:22, Ary Borenszweig wrote:

 Since it's not yet implemented, it could be like that, or it can be that
 it is evaluated when you execute the program (but not at compile time).
But if I just but code that the top level of a file, when at runtime is that executed?
In the order it was analyzed. Same as in Ruby.
Feb 18 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-02-18 13:46, Ary Borenszweig wrote:

 In the order it was analyzed. Same as in Ruby.
I see. -- /Jacob Carlborg
Feb 18 2013
prev sibling parent reply "JN" <666total wp.pl> writes:
On Sunday, 17 February 2013 at 12:14:40 UTC, Jacob Carlborg wrote:
 Except from what others already have mentioned someone created 
 a language with a Python like syntax written in D. But I think 
 that had explicit types.
http://delight.sourceforge.net/
Feb 17 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-02-17 20:50, JN wrote:

 http://delight.sourceforge.net/
There we go, thanks. -- /Jacob Carlborg
Feb 17 2013
prev sibling next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 2/16/2013 10:28 PM, Ary Borenszweig wrote:
 https://github.com/manastech/crystal/wiki/Introduction
Just a thought - the Introduction needs an introductory (!) paragraph at the beginning explaining what Crystal is, what its point is, and where it fits into the universe of programming languages.
Feb 19 2013
parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
On 2/19/13 6:08 PM, Walter Bright wrote:
 On 2/16/2013 10:28 PM, Ary Borenszweig wrote:
 https://github.com/manastech/crystal/wiki/Introduction
Just a thought - the Introduction needs an introductory (!) paragraph at the beginning explaining what Crystal is, what its point is, and where it fits into the universe of programming languages.
Maybe what's said in the homepage in enough? https://github.com/manastech/crystal
Feb 25 2013
parent Walter Bright <newshound2 digitalmars.com> writes:
On 2/25/2013 6:50 AM, Ary Borenszweig wrote:
 On 2/19/13 6:08 PM, Walter Bright wrote:
 On 2/16/2013 10:28 PM, Ary Borenszweig wrote:
 https://github.com/manastech/crystal/wiki/Introduction
Just a thought - the Introduction needs an introductory (!) paragraph at the beginning explaining what Crystal is, what its point is, and where it fits into the universe of programming languages.
Maybe what's said in the homepage in enough? https://github.com/manastech/crystal
Probably. But it should be in the "Introduction" page!
Feb 26 2013
prev sibling next sibling parent reply Knud Soerensen <4tuu4k002 sneakemail.com> writes:
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/
Feb 20 2013
parent Ary Borenszweig <ary esperanto.org.ar> writes:
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).
Feb 20 2013
prev sibling next sibling parent "Jozsef Sarosi" <fikughin_1 freemail.hu> writes:
 1. Do you know whether a similar language exists?
Why don't you have a look at julialang.org. I know it is different but you may have new ideas to gain speed. Jozsef
Feb 20 2013
prev sibling next sibling parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Sunday, 17 February 2013 at 06:28:09 UTC, Ary Borenszweig 
wrote:

 I'd also like to ask you:

 1. Do you know whether a similar language exists?
Not sure how similar all the goals are (dynamic with static benefits) but there is Magpie: http://magpie.stuffwithstuff.com/
Feb 21 2013
next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Jesse Phillips:

 Not sure how similar all the goals are (dynamic with static 
 benefits) but there is Magpie: http://magpie.stuffwithstuff.com/
I am following the development of Magpie since some time, and beside the nice name, it has a very interesting type system: http://journal.stuffwithstuff.com/2010/10/29/bootstrapping-a-type-system/ Bye, bearophile
Feb 21 2013
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-02-21 21:37, Jesse Phillips wrote:

 Not sure how similar all the goals are (dynamic with static benefits)
 but there is Magpie: http://magpie.stuffwithstuff.com/
Doesn't that run on the JVM? -- /Jacob Carlborg
Feb 21 2013
parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Thursday, 21 February 2013 at 21:28:12 UTC, Jacob Carlborg 
wrote:
 On 2013-02-21 21:37, Jesse Phillips wrote:

 Not sure how similar all the goals are (dynamic with static 
 benefits)
 but there is Magpie: http://magpie.stuffwithstuff.com/
Doesn't that run on the JVM?
I couldn't find what it generates to. It has an interpreter in Java and C++ though.
Feb 21 2013
parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Thursday, 21 February 2013 at 21:59:06 UTC, Jesse Phillips 
wrote:
 Doesn't that run on the JVM?
I couldn't find what it generates to. It has an interpreter in Java and C++ though.
Ok, that sounds really stupid. I thought it had a compiled component, but I don't see that, just looks to be interpreted.
Feb 21 2013
parent "bearophile" <bearophileHUGS lycos.com> writes:
Jesse Phillips:

 Ok, that sounds really stupid. I thought it had a compiled 
 component, but I don't see that, just looks to be interpreted.
Magpie designer (Bob Nystrom) is a quite smart person :-) Here he explains two main kinds of iterations: http://journal.stuffwithstuff.com/2013/01/13/iteration-inside-and-out/ I think Magpie is not meant to become a widespread language, but it contains interesting ideas. I think the core of Magpie is interpreted, but you can run the type system statically, if you want. Bye, bearophile
Feb 21 2013
prev sibling next sibling parent reply "Jordan Miner" <jminer7 gmail.com> writes:
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...
Feb 26 2013
parent "David Nadlinger" <see klickverbot.at> writes:
On Wednesday, 27 February 2013 at 03:48:53 UTC, Jordan Miner 
wrote:
 It does make me wish that LLVM supported exceptions on 
 Windows...
It does support DW2-style exceptions on 32 bit MinGW now and there are preliminary patches for 64 bit SEH, even if 32 bit SEH is still unsupported. Actually, the biggest problem I encountered when I recently focussed on the LDC/MinGW port was TLS support in LLVM/MinGW. The mingw-w64 CRT from trunk already has my fix, and the LLVM patches are only waiting for somebody to actually commit them. Reminds me to note that all that would be left to make Windows/MinGW a first-class target for LDC is another week or two of work on the remaining few test suite/unit test failures and a Windows CI slave… David
Feb 27 2013
prev sibling next sibling parent reply "thedeemon" <dlang thedeemon.com> writes:
On Sunday, 17 February 2013 at 06:28:09 UTC, Ary Borenszweig 
wrote:
 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".

 I started thinking about this idea: a compiled language that 
 looked like a dynamic language. Is it possible?
I think everyone who wants to create languages should first familiarize himself with ML family of languages and especially OCaml. It's got global type inference done right, you can write big programs never specifying types of arguments of functions, they all got inferred, and not just to first occurrence but to most general (polymorphic) form. The compiler is incredibly fast and generated code is pretty fast too (approximately as fast as Java). Things to learn: Damas-Hindley-Milner, structural typing, row polymorphism. So your questions are already answered ages ago: yes, it is possible to have static typing with conciseness of dynamic languages, speed of static languages and a fast compiler which inferences types. Also, knowing OCaml will make your life much easier as a compiler developer. Writing compilers is much much easier and more convenient in ML than in Ruby, I know it from first-hand experience, I did both in the past.
Feb 28 2013
parent "pjmlp" <pjmlp progtools.org> writes:
On Thursday, 28 February 2013 at 08:22:45 UTC, thedeemon wrote:
 On Sunday, 17 February 2013 at 06:28:09 UTC, Ary Borenszweig 
 wrote:
 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".

 I started thinking about this idea: a compiled language that 
 looked like a dynamic language. Is it possible?
I think everyone who wants to create languages should first familiarize himself with ML family of languages and especially OCaml. It's got global type inference done right, you can write big programs never specifying types of arguments of functions, they all got inferred, and not just to first occurrence but to most general (polymorphic) form. The compiler is incredibly fast and generated code is pretty fast too (approximately as fast as Java). Things to learn: Damas-Hindley-Milner, structural typing, row polymorphism. So your questions are already answered ages ago: yes, it is possible to have static typing with conciseness of dynamic languages, speed of static languages and a fast compiler which inferences types. Also, knowing OCaml will make your life much easier as a compiler developer. Writing compilers is much much easier and more convenient in ML than in Ruby, I know it from first-hand experience, I did both in the past.
My university degree had a strong focus in programming languages. We were not allowed to use ML, Lisp or Prolog for compiler design classes because it would make the project too easy. :) -- Paulo
Feb 28 2013
prev sibling next sibling parent "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
On 2013-02-17, 10:52, Russel Winder wrote:

 Why is this thread on the announce mailing list instead of the
 discussion list?
Because it's more an announcement, and less a discussion about D? -- Simen
Mar 20 2013
prev sibling next sibling parent reply Russel Winder <russel winder.org.uk> writes:
On Wed, 2013-03-20 at 17:31 +0100, Simen Kjaeraas wrote:
 On 2013-02-17, 10:52, Russel Winder wrote:
=20
 Why is this thread on the announce mailing list instead of the
 discussion list?
=20 Because it's more an announcement, and less a discussion about D?
The original posting was clearly an announcement. No problem. However as the thread lengthened, it got more and more into discussion of content rather than being announcement, i.e. the thread should have shifted to a non-announcement list almost immediately. This undermines the separation of the list from the DMD one. No big deal though. PS http://www.digitalmars.com/d/archives/digitalmars/D/announce/ appears to stop in 2012-12 --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Mar 20 2013
parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Wed, 20 Mar 2013 13:32:50 -0400, Russel Winder <russel winder.org.uk>  
wrote:

 PS http://www.digitalmars.com/d/archives/digitalmars/D/announce/ appears
 to stop in 2012-12
http://forum.dlang.org/group/digitalmars.D.announce Don't use that other thing any more. -Steve
Mar 21 2013
prev sibling parent "Graham Fawcett" <fawcett uwindsor.ca> writes:
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?
It's not Ruby-like, but Julia has some similarities: http://julialang.org/ Best, Graham
Mar 20 2013