Troublesome nodes
[
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:  Jacques Garrigue <garrigue@m...> 
Subject:  Re: [Camllist] Troublesome nodes 
From: Jeremy Yallop <jeremy.yallop@ed.ac.uk> > I don't yet understand exactly how private abbreviations are supposed to > work. The currently implemented behaviour doesn't accomplish what I > understand to be the intention. For example, given > > module Nat : > sig > type t = private int > val z : t > val s : t > t > end = > struct > type t = int > let z = 0 > let s = (+) 1 > end > > we can write > > # (((Nat.z : Nat.t :> int)  1) :> Nat.t);; >  : Nat.t = 1 It looks like you've found a serious bug in the current implementation. Actually you don't even need a coercion: # (((Nat.z : Nat.t :> int)  1) : Nat.t);;  : Nat.t = 1 This should certainly not be accepted, as you can see by writing # (((Nat.z : Nat.t :> int)  1) : int :> Nat.t);; (* fails *) I think I know the reason, which is probably related to the way abbreviation expansions are cached, but this needs more investigating. Jacques Garrigue