Crystal
thedeemon
dlang at thedeemon.com
Thu Feb 28 00:22:44 PST 2013
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.
More information about the Digitalmars-d-announce
mailing list