Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Alias and Tuple patterns
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-01-31 (07:41)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Alias and Tuple patterns
[English summary: "," binds tighter than "as" in patterns, so there's
no other possible parsing.]

> Il y a un comportement du parser que je trouve plutot bizarre :
> (<pat1>, <pat2> as a, <pat3>)
> est lu comme :
> (((<pat1>, <pat2>) as a), <pat3>).

C'est du au fait que "," as une priorite plus elevee que "as" dans les
motifs, i.e. (x,y as t) signifie ((x,y) as t) et non pas (x, (y as t)).

> Je m'attendrais plutot a  :
> (<pat1>,(<pat2> as a),<pat3>)

Cette lecture ne respecte pas les regles de priorite.

- Xavier Leroy