« SoC, MacIntel, etc. | Main | HsSyck Cabalized. »



Feed You can follow this conversation by subscribing to the comment feed for this post.

foo .bar;  # foo($_.bar())

Ack. So where in P5 you say


in P6 you’d have to say the following?


(Notice the placement of dots vs arrows.)

I don’t like that any more than I like it when Ruby makes me do that… hopefully, `given` combined with the shortcut for invoking methods on the topic will mostly remove the need for method chaining.

Aristotle: Actually, you'd need to use the "long dot" form:


That is, "\" and "." separated by optional whitespace is an alternate spelling of the "." form. This hopefully provides sufficient visual clue on both sides as to not confuse people from either camp. :-)

I don’t know if I like where this is going… does this mean that

foo. bar;

is also wrong, and

foo\ .bar;

is necessary instead?

I have to say, sometimes I can really feel Abigail. :-(

Right, that is the case indeed. And yes, I agree with your feeling.

However, the Rubyish alternative of allowing "dangling" method calls:


Really looks no cleaner to me...

I don’t like that either (and said so in the other comment). I wish it was possible to arrange the dots like the arrows in Perl 5:


If that’s not possible I’m really hoping I can just rely on topicalisation instead…

given foo {

of course, those mean different things:




as a method call doesn't always return its invocant (nor would you always want it to).

They can mean different things. However, because Perl 5 does not have a syntactic shortcut for “$_->”, it is common practice to return the invocant from a method where there’s not something useful to return, so that you can chain method calls on the same invocant.

If such chains do mean something different in a lot of your code, that most likely just means the code is hard to read…

well, half (say) of the method calls i make are accessors, which want to return a piece or aspect or acquaintance of their invocant, and are especially useful in chains.

in any case, the idiom for stacked chaining now has to use whatever form long dot has (finally?) taken... if you can come up with a better form that will bear the design pressures on this new language, please speak up; i imagine there isn't anyone that's overjoyed with the latest syntax. it's meant to suggest '\' line continuations, so makes some sense to me, but still looks odd and rather ugly.

The comments to this entry are closed.

June 2014

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          


My Photo