[M3devel] Resummary of tagged reference proposals

Jay jay.krell at cornell.edu
Tue Jun 2 17:52:43 CEST 2009


Um, but can't tagged unions be safe?

Can't you tell the compiler which tag maps to which part of the union and all reads would be checked?

And writes would set the tag?

Something like that?

Plus optimize away some of the tag checks.

And then like you say, sometimes the tag can be combined with the value, nice description.

 

After all, tagged unions are the only type in Microsoft VBScript and JScript, safe languages.

 

Granted, as you say, objects often fit the same scenarios.

 

 - Jay

 
> Date: Tue, 2 Jun 2009 07:23:53 -0400
> From: hendrik at topoi.pooq.com
> To: m3devel at elegosoft.com
> Subject: Re: [M3devel] Resummary of tagged reference proposals
> 
> On Tue, Jun 02, 2009 at 08:51:31PM +1000, Tony Hosking wrote:
> > Union types are anathema to the design of the Modula-3 type system.
> 
> So I have heard. But I don't understand why. Certainly 
> variant records a la Pascal would be for security reasons. 
> Did they get tarred with the same brush? Or were unions 
> considered unnecessary once the language had objects and 
> inheritance?
> 
> -- hendrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20090602/301eb2ed/attachment-0002.html>


More information about the M3devel mailing list