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

Steven Schveighoffer schveiguy at yahoo.com
Thu Dec 23 10:38:30 PST 2010


On Thu, 23 Dec 2010 12:34:45 -0500, Don <nospam at nospam.com> wrote:

> bearophile 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
>
> I'm almost certain that the behaviour is not intentional.

 From http://www.digitalmars.com/d/2.0/function.html :

"Typesafe variadic functions are used when the variable argument portion  
of the arguments are used to construct an array >>>> or class object <<<<."

(emphasis added)

And it goes on to show a similar example as to what has been discussed  
here.

I think it's intentional, and I agree that I've never used or thought  
"gee, I wish D did this".  I wouldn't be sorry to see it go.  In fact, I'd  
advocate for getting rid of it.  It creates a hidden allocation, which I'm  
very much against.

-Steve


More information about the Digitalmars-d-learn mailing list