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
List.cons and "::"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

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

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

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.