[nem-en] Re: match on specific parameter
Alejandro Serrano
trupill at yahoo.es
Sun Jan 29 19:36:11 CET 2006
Philippe Quesnel escribió:
>
>
> On 1/29/06, *Kamil Skalski* <kamil.skalski at gmail.com
> <mailto:kamil.skalski at gmail.com>> wrote:
>
> 2006/1/29, Michal Moskal <michal.moskal at gmail.com
> <mailto:michal.moskal at gmail.com>>:
>
> The problem of single / multiple matching bothers be for a long time.
> Ocaml allows to
> "implicitly" match on one or more LAST parameters, maybe this is not
> as bad design as I thought some time ago.
>
>
> yeah, I was just thinking about something like that.
> but on the 1st parameters, seems more intuitive than going backwards
> from the last ones.
>
> tt( a, b, c )
> | (1, true) => ...
> | (-1, true) => ...
> | (0, false) => ...
>
> would match on a & b ?
> it could get complicated (compiler wise) when you factor in 'which
> params inference' on top of type inference ??
>
> it looks clean, but is it clear ? or too obscure...
> just an idea
>
In my opinion, it should match in all parameters on in none:
tt (a, b, c)
| (1, true, _) =>
If you want to match other thing, I find cleaner
tt (a, b, c)
match (a, b)
| (1, true) =>
And it would help both coder, and type inference engine
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
More information about the devel-en
mailing list