Growable BinaryHeap: use w/Array?

2011-03-06 Thread Magnus Lie Hetland
Just wondering: If I want a growable binary heap (I'd be open to other priority queue structures, for that matter ;), is the standard way in D (w/Phobos) to combine std.container.BinaryHeap with std.container.Array? Any reason why BinaryHeap can't deal with ordinary dynamic array appending, or

std.gc doc page

2011-03-06 Thread Magnus Lie Hetland
It seems std.gc is no longer available -- or, rather, that it is now core.memory? Is there a reason why this page exists, and has a link in the sidebar? http://www.digitalmars.com/d/2.0/phobos/std_gc.html (Yes, the documentation is for core.memory, but the page name/link name is std.gc.

Re: Growable BinaryHeap: use w/Array?

2011-03-06 Thread Magnus Lie Hetland
On 2011-03-06 14:37:19 +0100, Magnus Lie Hetland said: Just wondering: If I want a growable binary heap (I'd be open to other priority queue structures, for that matter ;), is the standard way in D (w/Phobos) to combine std.container.BinaryHeap with std.container.Array? Another thing ...

Re: Growable BinaryHeap: use w/Array?

2011-03-06 Thread David Nadlinger
On 3/6/11 2:58 PM, Magnus Lie Hetland wrote: alias Tuple!(real,int) Entry; Array!Entry Q; […] alias Tuple!(real,int) Entry; Array!Entry Q; Is it just me, or is there really no difference between the two snippets? ;) David

Re: Growable BinaryHeap: use w/Array?

2011-03-06 Thread Magnus Lie Hetland
On 2011-03-06 15:00:29 +0100, David Nadlinger said: On 3/6/11 2:58 PM, Magnus Lie Hetland wrote: alias Tuple!(real,int) Entry; Array!Entry Q; [...] alias Tuple!(real,int) Entry; Array!Entry Q; Is it just me, or is there really no difference between the two snippets? ;) $(WITTY_REPLY) ;-)

dmd gdc in archlinux

2011-03-06 Thread %u
i can't install dmd or gdc in arch linux from AUR i don't way?

Re: in/out with -release

2011-03-06 Thread Jesse Phillips
user@domain.invalid Wrote: I still think I would like it if you could be a little more explicit about the in/out blocks. Are they always disabled entirely (skipped) with -release, or just certain things? Thanks for your help! -Kai Meyer By definition, if a pre contract fails, then the

Re: dmd gdc in archlinux

2011-03-06 Thread Jérôme M. Berger
%u wrote: i can't install dmd or gdc in arch linux from AUR i don't way? For gdc, which package exactly are you trying to install? On what platform (32 or 64 bits)? And what error do you get? Jerome -- mailto:jeber...@free.fr http://jeberger.free.fr Jabber:

No case ranges in final switches?

2011-03-06 Thread bearophile
Do you know why final switches disallow case ranges? Case ranges are not bug-prone: void main() { ubyte u; final switch (u) { case 0: .. case 100: break; case 101: .. case 255: break; } } DMD 2.052 gives the errors: test.d(4): Error: case

Static Associative Array

2011-03-06 Thread Peter Lundgren
Can you define an associative array in a way that can be evaluated at compile time like you can with non-associative arrays?

Re: dmd gdc in archlinux

2011-03-06 Thread %u
in dmd: this the error massage object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /usr/include/d import path[1] = /usr/include/d/druntime/import in gdc: i can't install it and i use this command yaourt -R gdc

Re: std.gc doc page

2011-03-06 Thread Jonathan M Davis
On Sunday 06 March 2011 05:39:14 Magnus Lie Hetland wrote: It seems std.gc is no longer available -- or, rather, that it is now core.memory? Is there a reason why this page exists, and has a link in the sidebar? http://www.digitalmars.com/d/2.0/phobos/std_gc.html (Yes, the documentation

Re: Static Associative Array

2011-03-06 Thread bearophile
Jonathan M Davis: I'm pretty sure not. I think that it's currently suffering the same fate as stuff like classes and is not yet able to be CTFEed. Some day... This works: import std.stdio; string foo(int x) { auto aa = [1: hello, 2: red]; return aa[x]; } enum string s = foo(1);

Re: Static Associative Array

2011-03-06 Thread Andrej Mitrovic
What about: enum : string[int] { aa = [1: blue, 2: red] } enum string s = aa[1]; void main() { writeln(s); }

Re: Static Associative Array

2011-03-06 Thread Jonathan M Davis
On Sunday 06 March 2011 16:30:00 Andrej Mitrovic wrote: What about: enum : string[int] { aa = [1: blue, 2: red] } enum string s = aa[1]; void main() { writeln(s); } In both cases, the AA does not exist past compile time. That may be why it works. - Jonathan M Davis

Re: Win7 64-bit

2011-03-06 Thread Stewart Gordon
On 01/03/2011 23:19, Dan McLeran wrote: never mind, i got it. i had to pass the switches: -D -unittest -cov life is hard. it's even harder when you're dumb. Would you care to enlighten the rest of us on what code you were using that requires those extra switches? Stewart.

Re: Win7 64-bit

2011-03-06 Thread Jonathan M Davis
On Sunday 06 March 2011 17:48:12 Stewart Gordon wrote: On 01/03/2011 23:19, Dan McLeran wrote: never mind, i got it. i had to pass the switches: -D -unittest -cov life is hard. it's even harder when you're dumb. Would you care to enlighten the rest of us on what code you were using

Re: Static Associative Array

2011-03-06 Thread Peter Lundgren
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article On Sunday 06 March 2011 14:05:04 Peter Lundgren wrote: Can you define an associative array in a way that can be evaluated at compile time like you can with non-associative arrays? I'm pretty sure not. I think that it's currently

Re: Static Associative Array

2011-03-06 Thread bearophile
Peter Lundgren: If not, then what is the D way to initialize a static field of a struct or class a la Java's static initializer blocks? I don't mind constructing the associative array at run-time if I have to, but I can't afford to do it more than the once needed. Is this good enough?

Re: No case ranges in final switches?

2011-03-06 Thread Bekenn
On 3/6/2011 1:11 PM, bearophile wrote: Do you know why final switches disallow case ranges? Case ranges are not bug-prone: void main() { ubyte u; final switch (u) { case 0: .. case 100: break; case 101: .. case 255: break; } }

Re: Static Associative Array

2011-03-06 Thread Andrej Mitrovic
On 3/7/11, Jonathan M Davis jmdavisp...@gmx.com wrote: Kidding, just kidding..

Re: No case ranges in final switches?

2011-03-06 Thread Jonathan M Davis
On Sunday 06 March 2011 18:26:26 Bekenn wrote: On 3/6/2011 1:11 PM, bearophile wrote: Do you know why final switches disallow case ranges? Case ranges are not bug-prone: void main() { ubyte u; final switch (u) { case 0: .. case 100:

Re: Static Associative Array

2011-03-06 Thread Jonathan M Davis
On Sunday 06 March 2011 18:33:04 Andrej Mitrovic wrote: On 3/7/11, Jonathan M Davis jmdavisp...@gmx.com wrote: Kidding, just kidding.. That _did_ seem like a rather rude post for you... - Jonathan M Davis

Benchmarking with -profile

2011-03-06 Thread Peter Lundgren
How do you guys benchmark your D code? I tried using the -profile option, but was surprised to see wildly varying results (greater than an order of magnitude difference in Func Time) from one run to the next.

Re: No case ranges in final switches?

2011-03-06 Thread Jonathan M Davis
On Sunday 06 March 2011 18:51:04 bearophile wrote: Bekenn: Final switch is really just meant to be used with enums; since enumeration values don't have to cover the whole range of possible base type values, and enumeration values don't often have a natural ordering, ranges make little

Re: Static Associative Array

2011-03-06 Thread spir
On 03/07/2011 03:22 AM, Peter Lundgren wrote: == Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article On Sunday 06 March 2011 14:05:04 Peter Lundgren wrote: Can you define an associative array in a way that can be evaluated at compile time like you can with non-associative arrays? I'm

Re: dmd gdc in archlinux

2011-03-06 Thread %u
== Quote from %u (asm...@hotmail.com)'s article i can't install it and i use this command yaourt -R gdc i mean yaourt -S gdc