On Fri, Mar 09, 2012 at 06:50:50PM -0500, bearophile wrote: > Jonathan M Davis: > > > I don't know what the current state of UFCS is. > > I have found a possible problem in it, and probably there are some > missing parts, but it's working well.
I found that x.foo doesn't work, it needs to be x.foo(). But we're deprecating omission of parentheses of non-@property functions anyway, and an external function can hardly be a @property of anything, so I don't think this needs to be fixed. > At first I didn't like it a lot because it's cheap syntax sugar that > adds no new power and gives programmers more freedom to write > different-looking versions of the the same code (and this is often > bad). But it also allows you to write pseudo-members for generic templates that want to access built-in types via some abstract interface. This makes template code much much cleaner. > But I have soon found that it's able to make functional-style code > more readable, because you write: > x.foo().bar().baz().spam() > > Instead of this, where my eye sometimes loses count of the nesting level: > spam(baz(bar(foo(x)))) [...] Personally, I find the chained syntax rather jarring if the object of each . is different. I'm OK with things like jQuery where the base object is always the same, but if it changes across the .'s, it can get confusing to read. OTOH, this is a refreshing change from centuries of silly backwards function notation that we inherited from math, so maybe this is a good thing after all. :-) T -- Always remember that you are unique. Just like everybody else. -- despair.com
