Version franaise
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
The Implicit Accumulator: a design pattern using optional arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Robert Fischer <robert.fischer@S...>
Subject: Re: [Caml-list] The Implicit Accumulator: a design pattern using optional arguments
I don't have a top-level with me right now, so I'm shooting from the 
hip, but I don't think it is a compile-time error to attempt to use the 
referential equality operator on two different types.  If I'm right, 
then you will want a separate is-equals function that wraps the 
referential equality check and enforces type safety.

Robert Fischer
IT Firefighter
Smokejumper Consulting

Mattias Engdegrd wrote:
>> # let symbol =
>>    let m = Hashtbl.create 1 in
>>    fun string ->
>>      try Hashtbl.find m string with Not_found ->
>>      Hashtbl.add m string string;
>>      string;;
>> val symbol : '_a -> '_a = <fun>
> Nice, but perhaps it should return a different type to avoid accidentally
> comparing an interned string with a non-interned one?
> We would need an accessor to extract the string from an abstract type but
> I suppose that would be inlined.
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: