From: dblack@... Date: 2006-09-29T19:55:19+09:00 Subject: Re: New magical version of Symbol.to_proc Hi -- On Fri, 29 Sep 2006, Dr Nic wrote: > Trans wrote: >> But as I suggest, >> if we see it for what it really is --an adapter, then it makes perfect >> sense, and doesn;t seem so magical after all (except that it still >> offers some nicely terse syntax). > > I agree - it is very nice syntax. The ship has clearly sailed on the magic dot, but for the record let me explain what I don't like about it. My problem with something like this: x.should.be.equal.to(y) (and I don't mean to parody RSpec; that's a made-up example but I think it's pretty close) is that it uses method calling *syntax* for method and/or argument name *semantics*. To my eye it's basically just clustering a bunch of words together that pertain to what's going on, and connecting them with dots in a kind of imitation of spaces or underscores. It's very hard to know what "x.should.be" returns. I can figure it out, of course. But it has a tone of "don't worry about what's actually happening; just read the dot-connected words like a string", which makes me uncomfortable. (Actually I think RSpec itself now allows underscores to formulate method names.) I do understand how the "magic dot" works. It works just like every other dot :-) I just think there are better-fitted ways to do most of these things. array.lengths, for example :-) Anyway, just to save some bandwidth: * I really do understand how it works :-) * I do know that all method chaining has a bit of this quality. * I'm not trying or expecting to stop anyone from doing it; I'm just discussing the possible drawbacks. David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org