Re: I can't build dsfml2 or derelict.sfml whit dsss

2011-09-22 Thread deadalnix
DSFML2 doesn't exist right now. So no doubt you'll have trouble to compile it. I don't know what you are try to achieve, but definitively not what you believe. Note that my answer in the mentionned link give you all you need to use SFML with D. SFML2 is currently on a devellopement stage,

Why this simple binaryHeap program does not compile?

2011-09-22 Thread Cheng Wei
import std.container; class T { int i; } void main() { auto array = Array!(T); auto heap = BinaryHeap!(Array!(T), a.i b.i)(array); } After compiling: dmd2/linux/bin32/../../src/phobos/std/container.d(1612): Error: template std.conv.emplace(T) if (!is(T == class)) does not match

Re: Conditional Compilation with Version

2011-09-22 Thread Timon Gehr
On 09/22/2011 04:17 AM, alex wrote: Hi Y'all!! Just as a note, I am new to the news group, but slightly less new to D =) Back on topic: I am unable to get multiple version specifications to work (from the website) sometihng like: version (foo) { version = bar; version = baz; } version (bar)

Re: I can't build dsfml2 or derelict.sfml whit dsss

2011-09-22 Thread Trass3r
DSFML2's dsss file is just a remnant from the old DSFML. Also I don't really update DSFML2 anymore. A SWIG wrapper would be a better idea but it's hard to make it use our custom system module instead of wrapping the original one. In general using dsss isn't advisable, since rebuild is

Re: I can't build dsfml2 or derelict.sfml whit dsss

2011-09-22 Thread Mike Parker
On 9/22/2011 1:10 PM, Cuauhtémoc Ledesma wrote: First at all sorry for my english. After trying to build derelict (using the command dsss net install derelict) to get derelict.sfml, I figured that the problem maybe is dsss, becouse every time I invoke it the output is as if I hadn't written

Re: Dynamic Array Question

2011-09-22 Thread Steven Schveighoffer
On Wed, 21 Sep 2011 00:09:08 -0400, Jesse Phillips jessekphillip...@gmail.com wrote: On Tue, 20 Sep 2011 14:28:54 -0400, Steven Schveighoffer wrote: You can deallocate the original array. The soon-to-be-deprecated method Note:

Re: Is this a bug in execvp of std.process

2011-09-22 Thread Steven Schveighoffer
On Wed, 21 Sep 2011 00:30:11 -0400, Cheng Wei riverch...@gmail.com wrote: #import std.process void main() { execvp(ip, route); } result: Object ute is unknown, try ip help. That is the first two bytes are lost Adding two spaces works: #import std.process void main() { execvp(ip,

Wrong const attribute?

2011-09-22 Thread Paolo Invernizzi
Hi all, I've found nothing on bugzilla for that, what I'm missing? Or it's a bug? (DMD 2.055) struct Bar { immutable int i; this(int j){ i = j; } } struct Foo { Bar bar; } void main(){ auto b = Bar(1); auto f = Foo(); f.bar = Bar(2); // Error: can only

Re: Wrong const attribute?

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 04:12 Paolo Invernizzi wrote: Hi all, I've found nothing on bugzilla for that, what I'm missing? Or it's a bug? (DMD 2.055) struct Bar { immutable int i; this(int j){ i = j; } } struct Foo { Bar bar; } void main(){ auto b = Bar(1); auto f =

Re: Why this simple binaryHeap program does not compile?

2011-09-22 Thread Ellery Newcomer
On 09/22/2011 06:10 AM, Cheng Wei wrote: Is this a bug or I use the binary heap wrongly? Thanks a lot! Looks like a bug in Array. emplace doesn't accept a pointer to a chunk for class types. Report that puppy!

Re: Why this simple binaryHeap program does not compile?

2011-09-22 Thread David Nadlinger
On 9/22/11 7:20 PM, Ellery Newcomer wrote: Looks like a bug in Array. emplace doesn't accept a pointer to a chunk for class types. Report that puppy! See https://github.com/D-Programming-Language/phobos/commit/65a0c2158b1d2ea8e9d3094746739da636266089. David

Using pure to create immutable

2011-09-22 Thread Jesse Phillips
The discussion on Reddit brought to my attention that pure functions can return and assign to an immutable. http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/c2lsgek I am trying to modify the example request to make use of this, but have failed.

Re: Heap fucntion calls

2011-09-22 Thread Simen Kjaeraas
On Thu, 22 Sep 2011 00:43:09 +0200, deadalnix deadal...@gmail.com wrote: Great answer ! Thank you very much, it answered almost everything ! But what about, in the exemple you gave me (which is great by the way) if foo as parameters ? Those parameters are passed on the stack by copy to the

Re: Using pure to create immutable

2011-09-22 Thread Dmitry Olshansky
On 22.09.2011 22:53, Jesse Phillips wrote: The discussion on Reddit brought to my attention that pure functions can return and assign to an immutable. http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/c2lsgek I am trying to modify the example request to make use

Re: Using pure to create immutable

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 23:36:40 Dmitry Olshansky wrote: On 22.09.2011 22:53, Jesse Phillips wrote: The discussion on Reddit brought to my attention that pure functions can return and assign to an immutable. http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutabil

Templated ctors can't call each other?

2011-09-22 Thread Andrej Mitrovic
import std.typetuple; import std.traits; struct Foo { this(T1, T2)(T1 x, T2 y) if (allSatisfy!(isIntegral, T1, T2)) { this.x = x; this.y = y; } this(P)(P point) // ..constraints needed of course { this(point.x, point.y); } int x, y; } struct

Re: Using pure to create immutable

2011-09-22 Thread Steven Schveighoffer
On Thu, 22 Sep 2011 15:44:21 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, September 22, 2011 23:36:40 Dmitry Olshansky wrote: On 22.09.2011 22:53, Jesse Phillips wrote: The discussion on Reddit brought to my attention that pure functions can return and assign to an

Re: Using pure to create immutable

2011-09-22 Thread Steven Schveighoffer
On Thu, 22 Sep 2011 16:09:29 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 22 Sep 2011 15:44:21 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, September 22, 2011 23:36:40 Dmitry Olshansky wrote: On 22.09.2011 22:53, Jesse Phillips wrote: The discussion

Re: Using pure to create immutable

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 16:09:29 Steven Schveighoffer wrote: On Thu, 22 Sep 2011 15:44:21 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, September 22, 2011 23:36:40 Dmitry Olshansky wrote: On 22.09.2011 22:53, Jesse Phillips wrote: The discussion on Reddit

Re: Using pure to create immutable

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 16:11:05 Steven Schveighoffer wrote: On Thu, 22 Sep 2011 16:09:29 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 22 Sep 2011 15:44:21 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, September 22, 2011 23:36:40 Dmitry

Re: Using pure to create immutable

2011-09-22 Thread Steven Schveighoffer
On Thu, 22 Sep 2011 16:15:20 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, September 22, 2011 16:09:29 Steven Schveighoffer wrote: Technically, something like this could be cast to immutable: T[] foo(const(T)[] arg) pure Since it can be proven that the result is new

Re: Using pure to create immutable

2011-09-22 Thread Steven Schveighoffer
On Thu, 22 Sep 2011 16:23:12 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, September 22, 2011 16:11:05 Steven Schveighoffer wrote: On Thu, 22 Sep 2011 16:09:29 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 22 Sep 2011 15:44:21 -0400, Jonathan M Davis

Re: Using pure to create immutable

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 13:25 Steven Schveighoffer wrote: On Thu, 22 Sep 2011 16:15:20 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, September 22, 2011 16:09:29 Steven Schveighoffer wrote: Technically, something like this could be cast to immutable: T[]

Re: Using pure to create immutable

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 14:03 Jonathan M Davis wrote: In any case, in order for a function to be able to have its return value implicitly value implicitly cast to immutable, it must pure and all of its arguments must be immutable[...] Ouch! I really must reread my posts more before

Re: Using pure to create immutable

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 14:10 Steven Schveighoffer wrote: On Thu, 22 Sep 2011 17:03:08 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: In any case, in order for a function to be able to have its return value implicitly value implicitly cast to immutable, it must pure and all of

allSatisfy could use some constraints

2011-09-22 Thread Andrej Mitrovic
import std.string; import std.traits; import std.typetuple; void main() { if (allSatisfy!(isNumeric, int, short)) { } } D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\typetuple.d(576): Error: template instance F is not a template declaration, it is a overloadset This took a good while

Re: Using pure to create immutable

2011-09-22 Thread Jesse Phillips
Dmitry Olshansky Wrote: Maybe: - List!T makeFromArray(T)(immutable T[] array) pure { -- Dmitry Olshansky Thank you this lets it compile. I think I had that somewhere, but forgot about it. As Steve mentions, it probably should also work for const arguments too.

Re: Using pure to create immutable

2011-09-22 Thread bearophile
Jesse Phillips: Thank you this lets it compile. I think I had that somewhere, but forgot about it. As Steve mentions, it probably should also work for const arguments too. If you are convinced of this, then I suggest you to add an enhancement request in Phobos about it. It will make purity

Re: allSatisfy could use some constraints

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 15:36 Andrej Mitrovic wrote: import std.string; import std.traits; import std.typetuple; void main() { if (allSatisfy!(isNumeric, int, short)) { } } D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\typetuple.d(576): Error: template instance F is not a

Re: allSatisfy could use some constraints

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 16:45 Jonathan M Davis wrote: On Thursday, September 22, 2011 15:36 Andrej Mitrovic wrote: import std.string; import std.traits; import std.typetuple; void main() { if (allSatisfy!(isNumeric, int, short)) { } }

Re: allSatisfy could use some constraints

2011-09-22 Thread Andrej Mitrovic
On 9/23/11, Jonathan M Davis jmdavisp...@gmx.com wrote: Though given that allSatisfy!(isNumeric, int, short) will work with std.traits.isNumeric and not std.string.isNumeric, I suspect that a template constraint could be added which would fix the problem simply by checking whether the

Re: allSatisfy could use some constraints

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 17:03 Andrej Mitrovic wrote: On 9/23/11, Jonathan M Davis jmdavisp...@gmx.com wrote: Though given that allSatisfy!(isNumeric, int, short) will work with std.traits.isNumeric and not std.string.isNumeric, I suspect that a template constraint could be added