[erlang-questions] Bug ?!
Robert Virding
robert.virding@REDACTED
Tue Oct 3 22:39:12 CEST 2006
A pattern is describes a data structure. On the LHS you use it to test
the struture of and pull apart a term while on the RHS you use it to
build a term.
I agree with Richard that the result of allowing such constructs in
patterns will lead to things difficult to understand, both syntactically
and semantically. Yes, you can give LOTS of examples which are easy to
understand but once you release to a poor unspecting public you would be
surprised at some of the things they will do with it.
I believe it is important to keep things clean, consistent and elegant
otherwise you will end up with a language built on exceptions.
Robert
datacompboy wrote:
>
> Quote:
> Basically, it's because that expands to element(<field number>, <variable>), and that happens not to be allowed.
> (end of quote)
>
>
> Yes, right, but I just think that compiler can do such:
>
> Var#rec.val -> expands to LambdaVar=element(#rec.val, Var), LambdaVar
> so matching possible.
> And optimization pass should just remove LambdaVar in cases like
> X = Y#recy.xval.
>
> But i'm not sure about optimizations of erlang, so can't say is that possible in current realization
> --
> --- suicide proc near\n call death\n suicide endp
> _________________________________________________________
> Post sent from http://www.trapexit.org
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list