RFC, ensureHeaped

spir denis.spir at gmail.com
Sat Nov 13 13:09:32 PST 2010


On Sat, 13 Nov 2010 13:19:25 -0500
bearophile <bearophileHUGS at lycos.com> wrote:

> Steven Schveighoffer:
> 
> > Then you just wasted time duping that argument.  Instead of a defensive  
> > dup, what if we had a function ensureHeaped (better name suggestions?)  
> 
> I have created a bug report to avoid this whole pair of threads to be lost in the dusts of time:
> http://d.puremagic.com/issues/show_bug.cgi?id=5212
> 
> Feel free to add a note about your ensureHeaped() idea at the end of that enhancement request :-)
> 
> (To that enhancement request I have not added my idea of the @onheap attribute because I think it's too much complex to implement according to the design style of the D compiler).
> 
> Bye,
> bearophile

I was the one bitten by the bug. I think it's really a naughty feature, was about to create a bug entry when saw Bearophile's post. In my opinion, if
	void f(int[] ints) {doWhateverWith(ints);}
works, then
	void f(int[] ints...) {doWhateverWith(ints);}
must just work as well.

I consider variadic args as just syntactic honey for clients of a func, type, lib. There should be no visible semantic difference, even less bugs (and certainly not segfault when the code does not manually play with memory!). But I may have wrong expectations about this feature in D, due to how variadics work in other languages I have used.

It was hard to debug even with the help of 3 experienced D programmers.

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list