On Thu, 2008-03-13 at 15:08 +0000, Sam Mason wrote:
> No, it's a special operator that only the compiler could provide because
> it returns a by-ref.  For example:
> 
>   (proclaim asref : (fn (mutable 'a) (by-ref (mutable 'a))))
> 
>   (define (inc (x : (by-ref (mutable int32))))
>     (set! x (+ x 1)))
> 
>   (define (f (x))
>     (inc (asref x))
>     x)

At the moment, the ASREF is completely unnecessary.

> If this function existed, then you'd never want to allow the compiler to
> infer a by-ref to a mutable object.  It would probably also want to get
> a nicer name/symbol.

The compiler doesn't need to infer that here. The BY-REF is stated
explicitly in the formal parameter type.

I am unclear. Is your goal to make the taking of the reference explicit
at the location of the use occurrence? That might very well make sense.

> > 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.
> 
> Yes, and that's why it's all a bit nasty.  This is still all coming from
> a comment a long time ago that's stuck in my head about auditing and
> seems to have taken on a life of its own.

I think that annotating the ref-taking at the call site might not be a
bad idea, but I don't think this is something that needs to be fixed
today.  We're about to do a complete syntax overhaul in any case, and we
take this up then.


shap

_______________________________________________
bitc-dev mailing list
bitc-dev@coyotos.org
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to