double -> double[]... | feature or bug?

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Dec 23 08:27:33 PST 2010


On 12/23/10, bearophile <bearophileHUGS at lycos.com> wrote:
> spir:
>
>> While I understand some may consider this a nice feature, for me this is
>> an enormous bug. A great way toward code obfuscation. I like D among other
>> reasons because it's rather clear compared to other languages of the
>> family.
>
> The main problem here is that I have never felt the need of that feature, so
> for me it's useless. Has Walter added it after a good number of people have
> asked for this feature? Has any one here needed it?
>
> Bye,
> bearophile
>

You should probably ask in d-general. It looks like a dangerous
feature to have. If you have that function laying in another imported
module you might not even realize that you're constructing an object.
Consider this:

void test(int x, int y, string z);  // your module which you
accidentally forgot to import
void test(int x, Foo f ...);  // some other module that *is* imported
test(1, 4, "def");  // calling site that constructs a Foo object

Maybe it takes more typing, but I prefer this:
test(1, new Foo(4, "def"));

It's explicit and you can reason about it without having to inspect
other modules.


More information about the Digitalmars-d-learn mailing list