[Grace-core] On numbers and objects

Kim Bruce kim at cs.pomona.edu
Mon Nov 8 23:45:38 PST 2010


[e-mail delayed by a server outage.]

Yeah, I was confused about that e-mail as well.

I do think we are going to have to make pragmatic decisions like that suggested by Andrew on Booleans.  At the worst case, we can check to see if it is an object from the official Boolean class (I suspect we'll have to have some mechanism like that, alas) and throw an exception if not.

Kim



On Nov 8, 2010, at 1:34 PM, Andrew P. Black wrote:

> 
> On 8 Nov 2010, at 13:17, James Noble wrote:
> 
>> The hard part is what about constructors for *user-defined value types*.
>> Do they always run? Or run most of the time?  Or run, but then the object may be deleted
>> and replaced with an indistinguishable clone?
> 
> I'm still trying to figure out what this means.
> 
>> Actually, I quite like the last option: this should work, I think, if we continue to forbid
>> the use of "self" within constructors.
> 
> 
> Maybe this is the question:  Suppose I write an object constructor that creates an object (called maybe) whose type conforms to that of Boolean.   Can I use mabe in an if?
> 
> The pragmatic answer is "no".  This is a blemish on the language, because our story is that '''if''' is just a message on an object, and anything that quacks like a duck is a duck.   The Self answer is "of course yes", and we would end up standing on our hands trying to implement it efficiently, just like the Self team did.   
> 
> In Emerald we just said that a few basic types can't be reimplemented by user-defined types.  I think that Boolean should be one of those.  I think that String should NOT be one of those.    If we had Nat32 built-in, then it should not be re-implementable either, but since we have Rational, which will be slow anyway, allowing re-implementation should be OK.
> 
> 	Andrew
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core



More information about the Grace-core mailing list