[Grace-core] Numbers and structural typing

Kim Bruce kim at cs.pomona.edu
Thu Oct 16 22:39:47 PDT 2014


What you pointed out is indeed a problem -- and the current implementation ignores it -- add something else of type Number and things will break.  Brands (an idea Tim has been exploring) allow you to essentially insert nominal typing in a structural system.  Modula-3 did this.  If we do it, and make Number a branded type, then the idea is we can keep other classes from having the same type and thus not have to worry about them interacting with Number in binary methods.

Make sense?

Kim



On Oct 16, 2014, at 10:23 PM, Marco Servetto <marco.servetto at gmail.com> wrote:

> Hi Kim, thanks for giving me a solution without explaining what is the problem.
> 
> I see that there is something wrong around what I pointed out, but  I
> have no clear idea what.
> 
> Also, what is the semantic of types in grace? I tough they was only
> for extra safety/type safety, right? and a class is only a wrapped
> function, so the object should have no idea who created him... plus
> the brand would just be a label, actually stored in a field, right?
> thus an object may declare to be of any brand in the untyped version.
> what happen then? it must be well defined, and I can not see an end of
> my reasoning here.




More information about the Grace-core mailing list