Version française
Home     About     Download     Resources     Contact us    
Browse thread
List.cons and "::"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <bhurt@j...>
Subject: Re: [Caml-list] List.cons and "::"
Sam Steingold wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Why is :: a syntax, not an infix version of List.cons
>(which for some reason is missing)?
>thanks.
>  
>

So it can be used in pattern matching.  Things used in pattern matching 
the compiler has to know about, and thus the user can't override.  
Things not used in pattern matching can be overridden.  So you can 
redefine + if you wanted to.  I wouldn't recommend it, but you could.  
:: and , you can't override.

Brian