I like the :> and the double semi (and I also like Bert's asPipe).
On 8/26/07, Alan Lovejoy squeak-dev.sourcery@forum-mail.net wrote:
So far, the three pipe operators I like best are "_|", "::" and ":>". I would prefer to use a leading character for the operator's token that can't be the beginning of a valid message. Either "_" or ":" satisfy that constraint quite nicely.
| oneWeekAgo | oneWeekAgo := Timepoint today - 7 days. db getBlogPosts :: filter: [ :blogPost | blogPost date < oneWeekAgo] :: filter: [ :blogPost | db coolPosts includes: item )] :: collectMails :: do: [ :mail | "Happy to announce ..."]
| oneWeekAgo | oneWeekAgo := Timepoint today - 7 days. db getBlogPosts :> filter: [ :blogPost | blogPost date < oneWeekAgo] :> filter: [ :blogPost | db coolPosts includes: item )] :> collectMails :> do: [ :mail | "Happy to announce ..."]
| oneWeekAgo | oneWeekAgo := Timepoint today - 7 days. db getBlogPosts _| filter: [ :blogPost | blogPost date < oneWeekAgo] _| filter: [ :blogPost | db coolPosts includes: item )] _| collectMails _| do: [ :mail | "Happy to announce ..."]
On Aug 26, 2007, at 19:10 , David Mitchell wrote:
I like the :> and the double semi (and I also like Bert's asPipe).
Hehe. Thanks. For those who did not look at my change-set: It did not touch the Compiler at all or modify the syntax. It was strictly Smalltalk (with #asPipe returning a proxy object).
Personally I find ";;" quite fitting. To me, ":>" looks still selector-like.
I'd rather not use "_" as it would make a useful character to allow for in selectors later (for simpler interaction with other languages).
- Bert -
+1
; returns self ;; returns result is very clean, easy to remember and teach.
Ron
-----Original Message----- From: Bert Freudenberg
On Aug 26, 2007, at 19:10 , David Mitchell wrote:
I like the :> and the double semi (and I also like Bert's asPipe).
Hehe. Thanks. For those who did not look at my change-set: It did not touch the Compiler at all or modify the syntax. It was strictly Smalltalk (with #asPipe returning a proxy object).
Personally I find ";;" quite fitting. To me, ":>" looks still selector-like.
I'd rather not use "_" as it would make a useful character to allow for in selectors later (for simpler interaction with other languages).
- Bert -
Double semicolon also was my original choice for the change set I sent yesterday, as the comment in Parser>>pipe attests. The concern that made me change it to :> was the similarity of ; and ;;. It may sound good from the logical point of view, in practice I'm afraid it can be a source of bugs. Anyway, here is the full set that does ;; as well as :>.
--Vassili
On 8/27/07, Ron Teitelbaum Ron@usmedrec.com wrote:
+1
; returns self ;; returns result is very clean, easy to remember and teach.
Ron
-----Original Message----- From: Bert Freudenberg
On Aug 26, 2007, at 19:10 , David Mitchell wrote:
I like the :> and the double semi (and I also like Bert's asPipe).
Hehe. Thanks. For those who did not look at my change-set: It did not touch the Compiler at all or modify the syntax. It was strictly Smalltalk (with #asPipe returning a proxy object).
Personally I find ";;" quite fitting. To me, ":>" looks still selector-like.
I'd rather not use "_" as it would make a useful character to allow for in selectors later (for simpler interaction with other languages).
- Bert -
Vassili Bykov wrote:
... The concern that made me change it to :> was the similarity of ; and ;;. It may sound good from the logical point of view, in practice I'm afraid it can be a source of bugs.
That's my concern also.
By the way, I just checked the ANSI syntax, and discovered that the $_ (underscore) character is also legal as the first character in an identifier (Somehow, I had wrongly developed the notion that it could not occur in the first position.) So I no longer favor "_|" as the token for the pipe operator.
Double semicolon also was my original choice for the change set I sent yesterday, as the comment in Parser>>pipe attests. The concern that made me change it to :> was the similarity of ; and ;;. It may sound good from the logical point of view, in practice I'm afraid it can be a source of bugs. Anyway, here is the full set that does ;; as well as :>.
--Vassili
BTW, that rocks! You wouldn't happen to know how to patch the refactoring browser's parser as well would you?
Ramon Leon http://onsmalltalk.com
squeak-dev@lists.squeakfoundation.org