Experiments with emscripten and D
H. S. Teoh
hsteoh at quickfur.ath.cx
Sun Aug 18 19:21:12 PDT 2013
On Sun, Aug 18, 2013 at 06:52:14AM +0200, deadalnix wrote:
[...]
> I feel pretty confident I can do a wat speech for D.
[...]
Please do, I'm curious to hear it. :)
I can't think of any major WATs in D that come from the language itself.
Compiler bugs, OTOH, often elicits a "wat?!" from me, one recent example
being this gem from a friend:
import std.algorithm, std.stdio;
void main()
{
int[] arr = [3,4,2,1];
bool less(int a, int b)
{ return a < b; }
bool greater(int a, int b)
{ return a > b; }
{
auto dg = &less;
sort!(dg)(arr);
}
//this dg *should* be different from older destroyed dg
//rename to dg2 and everything works as expected
auto dg = &greater;
sort!(dg)(arr);
writeln(arr);
//outputs [1,2,3,4] instead of [4,3,2,1]
//change dg variable name in either place and it works
//also, if you don't do the 1st sort, it works correctly even with same variable name
}
http://d.puremagic.com/issues/show_bug.cgi?id=10619
T
--
We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true. -- Robert Wilensk
More information about the Digitalmars-d
mailing list