caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Alias and Tuple patterns
@ 1997-01-29 10:35 Yann Coscoy
  1997-01-30 10:06 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Yann Coscoy @ 1997-01-29 10:35 UTC (permalink / raw)
  To: caml-list


(************************ french *********************************)

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>).

Je m'attendrais plutot a  :

(<pat1>,(<pat2> as a),<pat3>).

   Yann Coscoy


(*************************** english *******************************)

The parser has a stange behaviour :

(<pat1>, <pat2> as a, <pat3>)

is understood as :

(((<pat1>, <pat2>) as a), <pat3>).

I was expecting :

(<pat1>,(<pat2> as a),<pat3>).

   Yann Coscoy







^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Alias and Tuple patterns
  1997-01-29 10:35 Alias and Tuple patterns Yann Coscoy
@ 1997-01-30 10:06 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 1997-01-30 10:06 UTC (permalink / raw)
  To: Yann Coscoy; +Cc: caml-list

[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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-01-31  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-29 10:35 Alias and Tuple patterns Yann Coscoy
1997-01-30 10:06 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).