forget

Joe Armstrong joe@REDACTED
Tue May 28 09:54:11 CEST 2002


> 
> I don't know if I misunderstand what you mean but one idea I have had
> is to use something similar to Prolog DCG (definite clause grammar)
> syntax so that the code can be written hiding the extra parameter
> passed around to every call. For example something like
> 
>   foo() -->
>          bar(),                   % Call to other --> functions that return
>          X = baz(),               % implicitly return {AnyValue,HiddenVar}
>          Val = v(),               % Special call v() returns hidden parameter
>                                   % at the point of the call.
>          c(Value = zab(Val,X)),   % Not a --> call, normal function call
>          Value.
> 
> could be expanded by the preprocessor to
> 
>   foo(S0) ->
>          {_,S1} = bar(S0),
>          {X,S2} = baz(S1),
>          Val = S2,            % or a call {Val,S3} = v(S2) if not special
>          Value = zab(Val,X),
>          {Value,S2}.          % or {Value,S3} if c/0 not special 
> 
>   v(S) -> {S,S}.
> 
> But I don't know how much cluttering is removed, if any, for real
> programs. Works nice for Prolog but for Erlang it may not be as
> useful,

  Umm - and then we can say "Erlang has got Monads!" 

  /Joe

> 
> kent
> 




More information about the erlang-questions mailing list