On Tuesday, 9 April 2013 at 13:02:27 UTC, bearophile wrote:
deadalnix:
I don't think this makes any sense. Constructor are not
regular function.
From studying functional languages like Haskell I have learnt
that considering "constructors" like the other functions gives
some advantages. The uniformity of the idea of "function" is
very useful.
Right now, in D, you'll find plenty of magic associated with
constructors. This is fundamentaly problematic when you want to
disguise them as functions.
I would be in general for reducing the magic associated with
constructor in order to allow them to behave like function, but
right now, they are different beasts.
What you are saying here has no content, so it has no value
(it's equivalent to a -0 vote). If you want to put an argument
you have to explain what are the practical disadvantages/risks
in D of calling a struct opCall with the UFCS.
UFCS work with function, but do not with first class functions
(ie values) or delegate. opCall on struct is much closer to a
delegate than a function.