Enhanced type guard syntax]
Thu Sep 18 21:13:47 CEST 2003
> isOne( X ) when X == 1; X == "one" -> true;
> isOne( X ) -> false.
isOne(1) -> true;
% or maybe even
? Looks simpler to me ;-)
> Most of the languages are either STRONGLY or weakly typed.
> Erlang can be both and more -- it can match patterns that can
> be specified/grouped through their semantics, not only syntax.
> For example, when we say ONE, we can write it as "1" or
> "one" -- it wouldn't change the meaning, right?
In your example, the guards X==1 and X=="one" are not typing guards, but
matching ones. Thus according to the proposal, they would remain valid.
More information about the erlang-questions