[M3devel] small objects

Tony Hosking hosking at cs.purdue.edu
Thu Apr 9 03:51:36 CEST 2009


On 9 Apr 2009, at 10:15, Rodney M. Bates wrote:
> I think I am getting a bit lost in all the proposals, variations,  
> counterproposals, etc., but
> from this argument I am inferring that your plan is that only  
> variables declared REFANY
> and not any proper subtype of REFANY can ever have a value with a  
> tag bit set?   Then
> the 4 narrowing operations, when and only when applied to an  
> expression of static
> type REFANY, would change to make a runtime check for a tag bit and  
> fail if it's set?
> It would take this to prevent a tagged value from getting into a  
> variable declared a
> proper subtype of REFANY, which can be dereferenced.

Yes, that's the minimalist proposal that Mika initiated and I refined  
slightly to handle TYPECODE.

> This would preclude making your abstract data type an opaque subtype  
> of REFANY,
> and would mean all supposedly unrelated ADT modules that used the  
> tag technique
> could be broken by client code that mixed up the REFANY values of  
> one of them with
> those of another.  I consider this a definite breach of Modula-3's  
> otherwise bulletproof
> type safety.

Umm.  I don't see how they can "break".   Can you offer a scenario?   
Either a REFANY is tagged or it is not.  "Unrelated ADT modules that  
use the tag technique" would all still work.  Are you saying you want  
a way to stamp out differently typed tagged REFANYs?  Seems a little  
tricky given that we are proposing just a single bit to distinguish  
tagged from untagged REFANY.  Unless you propose a completely static  
type constructor that stamps out different tagged reference types that  
are completely unrelated, and cannot be stored in a REFANY?  But that  
breaks the whole purpose of tagging which is to support values  
embedded in references.




More information about the M3devel mailing list