Uniform Function Call Syntax?
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Sat Mar 5 23:45:58 PST 2016
On Friday, 4 March 2016 at 01:56:34 UTC, user001 wrote:
> "dot". For mathematical purposes it is a lot easier to
> understand "dot(a, b)" than "a.dot(b)", at least in my opinion.
Why don't you just define it as "dot(a,b)" to begin with?
I think it would be better idea to just add the ability to add
unicode operators, and to avoid precedence issues one could just
require them to use parentheses. That way you could define
opCustom"•" and use it as:
( point1 • point2 )
An often stated golden rule in language design is that there
should be one way to do something. When you break that rule it
often is due to a language design deficiency. UFCS in both D and
C++ are hacks. IMO that makes things more confusing, not more
clear.
More information about the Digitalmars-d
mailing list