[squeak-dev] Authorize upArrow in binary symbols

Frank Shearar frank.shearar at gmail.com
Thu Feb 27 06:55:17 UTC 2014


On 26 February 2014 14:19, tim Rowledge <tim at rowledge.org> wrote:
>
> On 26-02-2014, at 2:02 PM, Tobias Pape <Das.Linux at gmx.de> wrote:
>
>>
>> On 26.02.2014, at 21:39, tim Rowledge <tim at rowledge.org> wrote:
>>
>>>
>>> I had a whole lot of stuff typed but really it boils down to something simple. We need at least one symbol within the common character set that we can use as a syntactic element not related to a typical character - a return token.
>>
>> Don’t get me wrong, but how do you come to the conclusion “We need [paraphrased: a distinct] return token”?
>> I mean, all other languages do without it, no?
>
> C/Pascal/others use the return token ‘return’ spelled out. Those languages have a large complex syntax with ugly precedence rules so complex they need wall posters to list them all. In that context using a whole word seems a relatively minor crime. Smalltalk is simple. I like simple.

C yes, Pascal no. In Pascal you assign to a pseudovariable called
Result. For the record I am totally OK with the three keypresses
involved in typing ":=". It should be even longer, because assignment
is evil (*), and if you assign you should be punished. (This is why a
cast in Scala is called "asInstanceOf". It's deliberately ugly and
painful to write to make you avoid it.) But that's just me.

>> I don’t want to say, we want to be like others,
>> but apparently, we (Smalltalk family, w/ Self etc.) are lonesome single-charcter return token users, aren’t we?
>> (Not that this would be wrong) So again, why do we need it explicitly?
>
> Because that is how Smalltalk is. If we tried to use ‘return’, how would that read?
>
> foo: aNumber
> |temp|
> temp := 4 + aNumber.
> return temp
>  - that looks both ugly and annoying to parse.
>
> foo: aNumber
> |temp|
> temp := 4 + aNumber.
> temp return
>  - a little less ugly to read, and it even looks like a message send but implementation would be fairly nasty. Something like
> return
>    thisContext sender returnValue: self
>
> Yuck. How about we don’t break something that works nicely?

I don't understand why you're even saying this. No one is suggesting
adding a new keyword. No one is suggesting breaking anything. We're
talking about allowing ^ as a perfectly sensible binary selector. Now
the last time someone suggested a seemingly minor grammatical change,
it turned out to have nasty effects elsewhere in the grammar. _If
that's the case_ we shouldn't allow ^ as a binary selector. But
someone needs to actually do the due diligence, and see what happens.
We know of one case where a syntactic error turns into an unexpected
message send. I'm OK with that, if that's the only fallout. You should
have written a test for the method.

frank

(*) If you need gospel to back up this seeming heresy, go grep for
"assignment" in The Early History of Smalltalk, written by some guy we
might have heard of, here and there.

> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> An algorithm must be seen to be believed.


More information about the Squeak-dev mailing list