[Grace-core] Fwd: Query on built-in objects

Kim Bruce kim at cs.pomona.edu
Mon Jun 18 23:34:31 PDT 2012


That seems fine with me, as the only place I feel we must have the ++ operation is when we have strings that need to be continued on a new line.  Thus I could go with either ++ only for strings or for any sequence, but leave the implicit conversions to the string interpolations.

Kim



On Jun 18, 2012, at 10:28 PM, Andrew P. Black wrote:

> So Smita's question is: why do Numbers have a ++ method (which converts to string and then concatenates), while Booleans don't have one.
> 
> Clearly we should be consistent, but I'm wondering which is best.  I think that it's quite reasonable to use ++ to mean concatenation of any sequence, such as a list of numbers ... so automatic conversion to string seems wrong.
> 
> 	Andrew
> 
> Begin forwarded message:
> 
>> Professor Black,
>> 
>> I found an interesting behavior in Grace, while working on Strings, Numbers and Boolean built-in objects.
>> 
>> Concatenation of Number and String works fine with ++ operator, but throws an error when I tried the same with Boolean and Number, and Boolean and String.
>> 
>> Example: 1 - Boolean and Number/String
>> 
>> var a:= true
>> var b:= " smita"
>> print (a ++ b)
>> 
>> Error around line 3: Method lookup error: no ++ in Boolean.
>> Called Boolean.++ (3)
> 
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailhost.cecs.pdx.edu/mailman/private/grace-core/attachments/20120618/9796c820/attachment-0001.html>


More information about the Grace-core mailing list