Sam Mason wrote: > On Wed, Mar 12, 2008 at 02:14:54PM -0400, Swaroop Sridhar wrote: >> In the original mail proposing by-ref (then called stack-ref), >> http://www.coyotos.org/pipermail/bitc-dev/2007-June/000915.html > > I thought these discussions seemed familiar! Rereading what was said > back then, I'm not sure if I can add much to the discussion. > > One thing I haven't noticed is about introducing a simple operator: > > (fn (mutable 'a) (by-ref (mutable 'a)))
Is this a type annotation for functions? If so, do you mean to say that this is a function accepting two arguments one by value and the other by reference? (note that nothing can be returned by reference). Currently, by-ref is a part of the type system. Function types which require by-ref arguments must be written with a by-ref type at the corresponding argument positions. > that compiles to a no-op but is there to aid auditing. Immutable > by-refs could be automatic. So, are you suggesting that if we write (by-ref 'a), where 'a cannot unify with a mutable type? This cannot be the case since the type variable must be able to unify with any type. Prof. Shapiro suggested introducing a notion of (immutable t) as a type. So, we can write (fn ((by-ref (immutable 'a))) ()) to represent a function that only accepts a immutable by-reference argument. Another option is to introduce an internal Immutable type-class. So, the above type can be written as: (forall (Immutable 'a) (fn ((by-ref 'a)) ()). Swaroop. _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
