A provocative naming idea for "setter" methods

Brian Rice water at tunes.org
Tue Sep 20 06:42:30 PDT 2005


Yes, those are other options I had considered.

On Sep 20, 2005, at 3:13 AM, Tony Garnock-Jones wrote:

> Brian Rice wrote:
>
>> <A-
>> <-A-
>> <A<
>>
>
> Does there have to be punctuation on both sides?
>
>    myObject x= 3.
>    window top= 200.

Right, this looks the best, and even is easier to type (no shift-key  
for = vs. : ), but would require a lexer change. Some experiments  
verify for me that this kind of identifier is currently interpreted  
as a unary selector, not binary. It's a little confusing with " x = "  
for equality comparison, but it's explainable with our same reasoning  
of using whitespace as significant for identifiers. But I like it.

> Otherwise, perhaps,
>
>    myObject =x= 3.
>    window =top= 200.

I think =x= looks too much like equality or some kind of  
comparison... in fact, I'm wondering whether that idiom should be  
reserved specifically for special versions of equality, but that's  
another topic.

> or
>
>    myObject :x= 3.
>    window :top= 200.
>
> Of course, that last one might run foul of the special role of  
> colon in ST-like syntaces.

The use of a colon would unfortunately cause problems in our grammar  
(not just the implementation, but the specification), as you allude to.

--
-Brian




More information about the Slate mailing list