Why not?

Daniel Keep daniel.keep.lists at gmail.com
Sun Nov 29 00:32:40 PST 2009



Uriel wrote:
> ...
> 
> Why not to do implicitly cast of these three parameters to new Foo
> object. We know that bar should recieve a Foo object and we have a call
> with parameters which exactly match one of Foo's constructors. It could
> be a nice syntactic sugar though not very hard to implement I think.

Why allow it?

> foo(new Foo(1, 1.0, "1"))

isn't much more typing, and makes it explicit what's going on.  Consider
it from a maintenance perspective: with this addition, you can't
actually tell what's being called.  Is it that foo function there, or is
there another overload somewhere in the imports that takes those
arguments?  There should be a very good reason for having any form of
"magic" syntax.



More information about the Digitalmars-d mailing list