[erlang-questions] some language changes

Mats Cronqvist mats.cronqvist@REDACTED
Thu May 31 16:51:06 CEST 2007

ok wrote:
> On 31 May 2007, at 1:51 am, Mats Cronqvist wrote:
> [1. simplify the language]
> [2. replace the preprocessor]

[discussion about ifdefs]

   i would be satisfied it the conditionals were left in, as long as the parser 
runs before the preprocessor.

> [3. Replace type guards by ::constraints on variables in patterns]
>   (a) This proposal makes the language more complicated.


>   (b) It makes some code more readable, but it makes other code
>       less readable.


>   (c) You STILL need type guards when there is a call to element,
>       hd, or tl in a guard, e.g.,
> 	f(N, T) when is_pid(element(N, T)) -> ...

   yes, that would have to go. i find it hard to believe there's a lot of code 
like that out there though.

>   (d) You STILL need type guards when a guard is disjunctive, e.g.,
> 	f(X) when is_record(X, update) ; is_record(X, delete) -> ...

   i guess you'd have to do this instead;

   f(X::record(update)) -> real_f(X);
   f(X::record(delete)) -> real_f(X).

   longer, but not (much) harder on the eyes. probably not a very common pattern 


More information about the erlang-questions mailing list