[M3devel] small objects

Tony Hosking hosking at cs.purdue.edu
Tue Apr 7 14:26:08 CEST 2009


You can't do anything directly with a REFANY.  To use it you need to  
narrow to a concrete type.  We would disallow that for tagged values  
with a run-time check. Existing code needs to check (using ISTYPE or  
TYPECASE), or know by design, what type is safe to narrow to, before  
narrowing anyway. So I think all is ok.

On 7 Apr 2009, at 22:12, hendrik at topoi.pooq.com wrote:

> On Tue, Apr 07, 2009 at 04:55:12PM +1000, Tony Hosking wrote:
>> After all of this -- I may simply be coming back around to your
>> original proposal -- why not simply declare:
>>
>> TaggedInteger.T = REFANY;
>
> You'd be adding a range of integers to the set of things a REFANY  
> could
> hold.  Might that enable one to pass these integers as REFANYs to
> existing code that isn't expecting it?  Might code that checks its  
> input
> for suitable preconditions then let this case slide?  Or would any  
> test
> that checks that a REFANY holds an appropriate reference or NIL
> automatically manage to exclude tagged integers, just as it excludes
> inappropriate references?
>
> I don't mind the proposed semantics for REFANY -- if it had been
> there from the beginning.  But with a lot of existing code in existing
> libraries, would it be safer to use a new type for this new meaning?
>
> You could, of course, stull have an unsafe module that defines
>
> TaggedInteger.T = NEWTYPEWITHNEWNAME;
>
> -- hendrik




More information about the M3devel mailing list