[nem-en] Re: match on specific parameter
Michal Moskal
michal.moskal at gmail.com
Sun Jan 29 10:19:05 CET 2006
Some more thoughts:
On 1/29/06, Michal Moskal <michal.moskal at gmail.com> wrote:
> But I personally don't find it very readable. I would like something
> like:
>
> def rev (acc, match lst)
> | x :: xs => rev (x :: acc, xs)
> | [] => acc
>
> or maybe "def rev (acc, match)". I'm not sure about the syntax.
Maybe we could use default parameters as a hint:
def rev (lst, acc = [])
| x :: xs => ...
This however changes semantics of already existing code (I agree, that
probably not very common).
> What do you think?
>
> On a related note, d proposed on IRC, that we could transform:
>
> foo () : ...
> | ...
>
> inside classes and variants to:
>
> foo () : ...
> match (this)
> | ...
>
> which I think also makes sense.
Maybe it should be also possible to say:
foo (match this, some_flag : bool)
| ...
--
Michal Moskal,
http://nemerle.org/~malekith/
More information about the devel-en
mailing list