On 26/08/07, Ramon Leon ramon.leon@allresnet.com wrote:
As observation..
This discussion is a good example of purists who throwing away any new ideas just because they 'don't follow standard' or 'can be done with current syntax'.
Honestly I see no harm in adding a pipe '|' symbol as a special syntax symbol, like cascade ';' or period '.' A pipe is like continuation which simply does: evaluate expression to the left, then continue evaluation with expression to the right, taking left result as receiver. We need only minor changes to parser to add this syntax sugar, and no changes in complier because it don't breaks old syntax or message passing semantics.
It's a good idea, the pipe, but not necessarily a well thought through implementation. As Tim and Has point out, | is already used in several places in the image and using it for special syntax for the pipe would cause problems with existing code. As Hans mentions, there's also the issue of portability to other dialects.
Yes, i missed that its already used as selector (just little scared using | in expressions, because its already used to define temps in methods and blocks). But i was after idea, no matter what symbol could be used for it.
Fabio's proposal to hijack ; for a pipe operator is obviously a non starter, he clearly doesn't understand how much Smalltalk code relies on ;.
Yes, i agree, cascade operator is not something which can be just dropped out.
The way to get past the purists isn't by argument, it's by showing them an implementation that works, and addresses their concerns. A working implementation is the difference between some who's serious about an idea and someone who's just complaining. It's easy to point at the old timers and blame them for blocking progress, it's much harder to do something that would actually be considered progress.
I like an idea because for me its obvious, that pipe operator will improve the code readability, and also helps type less when coding. I start typing expression not from '(' , but from message send, so first i have to type:
a someMessage: param1
then i see that i need to send second message to result, but since my first message uses keyword selector i can't just continue typing and must go back and place '(' before send , and then ')' after it. and only then i start typing next message. Also, sometimes , if expression became too long, its hard to find place where i must put open parenthesis, thats where 'pipe' can be really helpful. Maybe some people are soo intelligent, that they start typing expression from 2 or 3 opening parenthesis, because they already see how their expression will look like. Sorry then, I'm not so gifted to see full expression in mind, which can be about 10 lines of code. ;)
Let me remind you , people, that one of the strongest sides of smalltalk, is easy to read and easy to express code. And smalltalk was always after that idea, from its very birth. I just want to point that denying an idea which makes it even more simpler is against spirit of smalltalk. So, who the purist? :)
Squeak is the perfect experimental platform, so if someone hacked it up, and it worked well, there's a fairly decent chance people will look seriously at it. Even if they don't, it could always be maintained as a private extension to the language (I'm sure many exist).
And about working implementation, you are right. I can do this. But i doubt that someone who against idea from its roots will use it someday. See, if i don't like lemons, you can buy me million of them, but i'm still will not eat them :)
Ramon Leon http://onsmalltalk.com