On Sunday 06 March 2011 09:34:07 Adam D. Ruppe wrote: > bearophile: > > UFCS is a huge hack that I hope to never see in D :-) > > How is it a hack? I can understand there being implementation problems > that can make it undesirable to add, but calling it hack? > > It's one of the most elegant syntax proposals I've ever seen! It > unifies objects and other functions in syntax. It improves > encapsulation by giving full support to non-member functions. It > improves modularity for the same reason. > > With ufcs, there'd be no desire to add useless members due to > object syntax. Everything is equal - easy extensibility, better > protection, cleaner interfaces. > > It's the opposite of a hack.
It is _not_ a hack. Whether it's desirable or not is another matter, but it is _not_ a hack. And really, the term hack is very imprecise and often subjective. It's the sort of accusation that pretty much kills any legitimate debate. It's generally unsupportable and subjective, so it adds nothing to the debate, but it has such a stink about it that it tends to make people avoid whatever was declared to be a hack. Sure, you still have lots of parens with UFCS, but you _do_ get the argument order that Bearophile was looking for. And while I've generally found the idea of using UFCS with primitives to be pointless, this is actually an example where it's _useful_ with primitives. No, UFCS is not a hack. Its implementation has enough problems due to ambiguities and the like that it may never make it into the language even if pretty much everyone would _like_ it in the language, but it's not a hack. - Jonathan M Davis P.S. Entertainingly enough, www.merriam-webster.com's definition for hack doesn't make it look bad at all: "a usually creative solution to a computer hardware or programming problem or limitation" It makes me wonder if the usage of the word (and thus its common meaning) has shifted over time or if the poor non-techy, dictionary folk just plain got it wrong. The hacker's dictionary definition makes it look more like the typical usage, but even it is a bit of a mixed bag in that respect: 1. /n./ Originally, a quick job that produces what is needed, but not well. 2. /n./ An incredibly good, and perhaps very time-consuming, piece of work that produces exactly what is needed.
