Browse thread
The Implicit Accumulator: a design pattern using optional arguments
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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 Engdegård 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: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >