Re: [efene] optional static typing
- Mariano Guerra
- 2010-08-20 @ 21:25
2010/8/20 Роман Пельвецкий <firstname.lastname@example.org>:
> Hello Mariano,
> Since you are the one from a few people who wrote a language for BEAM so
> competent to give an answer.
> So, is it possible to add static compile time type checks for Erlang or
> Does BEAM checks types of variables only in runtime or can it be done in
> compile time too?
it can be done at compile time using type and spec annotations
IIRC dializer was an attempt to add Hindley–Milner type inference
to erlang and since it couldn't be done completely it was added as a
> Even if no performance boost can be achived the typecheck for function
> arguments will be great.
behind the scenes erlang does some type inference to optimize the
code, see hipe for more information (hipe is available in the OTP
> What are your thoughts about that?
I think the current state is a nice balance between static and dynamic
typing, you start your small project with all dynamic types and when
it starts to get big you start to annotate the functions with types
and specs and run dializer to check for errors.
BTW efene supports type and spec
 http://www.erlang.org/doc/man/dialyzer.html and