Re: What exactly does the compiler switch -betterC do?

2016-10-06 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 12:42:14 UTC On Wednesday, 5 October 2016 at 12:42:14 UTC, Jacob Carlborg wrote: No. There's a difference between DMD 2.070.0 and 2.071.0: OK, I'll retry on OSX, the bug report said Linux though. Seems like we're dragging in all of the _Dmain stuff. IIRC

Re: Why can't static arrays be sorted?

2016-10-06 Thread ag0aep6g via Digitalmars-d-learn
On 10/06/2016 09:54 PM, TheGag96 wrote: Interestingly enough, I found that using .each() actually compiles without the [] [...] why can the compiler consider it a range here but not .sort()? each is not restricted to ranges. It accepts other `foreach`-ables, too. The documentation says that

Re: Why can't static arrays be sorted?

2016-10-06 Thread TheGag96 via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis wrote: It doesn't even make conceptual sense for a static array to be a range, because you can't remove elements from it. - Jonathan M Davis Interestingly enough, I found that using .each() actually compiles without the [] but

Re: Shared an non-shared

2016-10-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 05, 2016 21:10:01 Begah via Digitalmars-d-learn wrote: > Although the triple buffer seems a good idea, there is one > problem. > I will need three time as much ram than what i currently need. > Not to mention, every time i switch buffer i will need to copy > all changes made

Re: Getting GtkD working with OpenGL

2016-10-06 Thread Mike Wey via Digitalmars-d-learn
On 10/06/2016 05:18 PM, Chalix wrote: On Thursday, 6 October 2016 at 13:35:01 UTC, Mike Parker wrote: So, change DerelictGL3.load to DerelictGL.load, then add a call to DerelictGL.reload after creating and activating the context. Thank you! That fixed the segmentation fault problem and the

Re: Rust-like collect in D

2016-10-06 Thread ag0aep6g via Digitalmars-d-learn
On 10/06/2016 07:44 PM, ag0aep6g wrote: https://dlang.org/phobos/std_container_util.html#.make More specifically, the second overload is where it's at: https://dlang.org/phobos/std_container_util.html#.make.2

Re: Rust-like collect in D

2016-10-06 Thread ag0aep6g via Digitalmars-d-learn
On 10/06/2016 04:32 PM, Nordlöw wrote: Is there a concept in D similar to Rust's `collect`: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect If not, I'm eager to implement it to support D-style containers. What would the desired interface look like? Perhaps:

Re: Rust-like collect in D

2016-10-06 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 6 October 2016 at 17:22:10 UTC, Dicebot wrote: On Thursday, 6 October 2016 at 16:56:26 UTC, Nordlöw wrote: Is there a way to do this, or do we need something similar to `collect` in Phobos? Something like import std.container.array : Array; 0.iota(n).collect!Array You mean

Re: Rust-like collect in D

2016-10-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 6 October 2016 at 16:56:26 UTC, Nordlöw wrote: Is there a way to do this, or do we need something similar to `collect` in Phobos? Something like import std.container.array : Array; 0.iota(n).collect!Array You mean semantics like this? Container collect(Container, Range) (Range

Re: Rust-like collect in D

2016-10-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 06, 2016 16:56:26 Nordlöw via Digitalmars-d-learn wrote: > On Thursday, 6 October 2016 at 16:14:33 UTC, Dicebot wrote: > > If an entity (i.e. container) implements OutputRange API, you > > can already do it: > > > > 0.iota(n).copy(container); > > Ahh, not quite what I

Re: Rust-like collect in D

2016-10-06 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 6 October 2016 at 16:14:33 UTC, Dicebot wrote: If an entity (i.e. container) implements OutputRange API, you can already do it: 0.iota(n).copy(container); Ahh, not quite what I wanted... I want to mimic the functional style Rust provides, where the `container` is constructed

Re: Rust-like collect in D

2016-10-06 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 6 October 2016 at 16:14:33 UTC, Dicebot wrote: If an entity (i.e. container) implements OutputRange API, you can already do it: 0.iota(n).copy(container); Thanks, that's what I was looking for.

Re: Rust-like collect in D

2016-10-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 6 October 2016 at 14:32:44 UTC, Nordlöw wrote: Is there a concept in D similar to Rust's `collect`: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect If not, I'm eager to implement it to support D-style containers. What would the desired interface look like?

Re: Rust-like collect in D

2016-10-06 Thread cym13 via Digitalmars-d-learn
On Thursday, 6 October 2016 at 14:58:34 UTC, Nordlöw wrote: On Thursday, 6 October 2016 at 14:33:59 UTC, rikki cattermole wrote: So an input range to array? Sure std.array : array. No, we want a generic alternative that fills any kind of container, typically non-GC allocated. Sounds like

Re: Getting GtkD working with OpenGL

2016-10-06 Thread Chalix via Digitalmars-d-learn
On Thursday, 6 October 2016 at 13:35:01 UTC, Mike Parker wrote: So, change DerelictGL3.load to DerelictGL.load, then add a call to DerelictGL.reload after creating and activating the context. Thank you! That fixed the segmentation fault problem and the crash :) But I still struggle with the

Re: File.write write extra CR character if a string has CRLF on windows

2016-10-06 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 6 October 2016 at 15:00:00 UTC, Pham wrote: string s is multi-lines (CRLF as line break) The write function will write extra CR character for each CRLF pair -> why (bug?) import std.file; import std.stdio; string s = ...; auto fHandle = File("f:\\text.txt", "w"); // open for

File.write write extra CR character if a string has CRLF on windows

2016-10-06 Thread Pham via Digitalmars-d-learn
string s is multi-lines (CRLF as line break) The write function will write extra CR character for each CRLF pair -> why (bug?) import std.file; import std.stdio; string s = ...; auto fHandle = File("f:\\text.txt", "w"); // open for writing fHandle.write(s); fHandle.close();

Re: Rust-like collect in D

2016-10-06 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 6 October 2016 at 14:33:59 UTC, rikki cattermole wrote: So an input range to array? Sure std.array : array. No, we want a generic alternative that fills any kind of container, typically non-GC allocated.

Re: Rust-like collect in D

2016-10-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/10/2016 3:32 AM, Nordlöw wrote: Is there a concept in D similar to Rust's `collect`: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect If not, I'm eager to implement it to support D-style containers. What would the desired interface look like? Perhaps:

Rust-like collect in D

2016-10-06 Thread Nordlöw via Digitalmars-d-learn
Is there a concept in D similar to Rust's `collect`: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect If not, I'm eager to implement it to support D-style containers. What would the desired interface look like? Perhaps: 0.iota(n).collect!Array Or can/should we just

Re: Getting GtkD working with OpenGL

2016-10-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 October 2016 at 10:49:40 UTC, Chalix wrote: glMatrixMode(GL_MODELVIEW); /*Here the program crashes with There are two things wrong with your use of Derelict. First, though you are correctly importing derelict.opengl3.gl to get the deprecated functions (which the gl3

Re: Callbacks in D

2016-10-06 Thread Kagamin via Digitalmars-d-learn
https://dlang.org/phobos/std_concurrency.html#.receive

Re: DLang IDE for macOS

2016-10-06 Thread Alexander Milushev via Digitalmars-d-learn
On Thursday, 6 October 2016 at 10:09:24 UTC, Andrea Fontana wrote: On Thursday, 6 October 2016 at 09:51:20 UTC, Alexander Milushev wrote: On Thursday, 6 October 2016 at 09:45:03 UTC, Andrea Fontana wrote: On Thursday, 6 October 2016 at 09:31:43 UTC, Alexander Milushev wrote: Hi all, Is there

Re: Struct immutable data and dict

2016-10-06 Thread Patric Dexheimer via Digitalmars-d-learn
On Thursday, 6 October 2016 at 03:48:22 UTC, Mike Parker wrote: On Thursday, 6 October 2016 at 03:05:18 UTC, Patric Dexheimer wrote: [...] There's a difference between initialization and assignment. [...] On Thursday, 6 October 2016 at 03:48:22 UTC, Mike Parker wrote: On Thursday, 6

Re: Getting GtkD working with OpenGL

2016-10-06 Thread Chalix via Digitalmars-d-learn
On Tuesday, 4 October 2016 at 17:00:34 UTC, Mike Wey wrote: Replace "import glgdk.GLContext;" with "import gdk.GLContext;" Hey Mike, you've been a great help so far! Thank you :) I thought now I am ready to draw something, but I struggle with the GLContext and GdkGlContext. Where do I get a

Re: DLang IDE for macOS

2016-10-06 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 6 October 2016 at 09:51:20 UTC, Alexander Milushev wrote: On Thursday, 6 October 2016 at 09:45:03 UTC, Andrea Fontana wrote: On Thursday, 6 October 2016 at 09:31:43 UTC, Alexander Milushev wrote: Hi all, Is there any good IDE for DLang for macOS? I have used Xamarin Studio with

Re: DLang IDE for macOS

2016-10-06 Thread Alexander Milushev via Digitalmars-d-learn
On Thursday, 6 October 2016 at 09:45:03 UTC, Andrea Fontana wrote: On Thursday, 6 October 2016 at 09:31:43 UTC, Alexander Milushev wrote: Hi all, Is there any good IDE for DLang for macOS? I have used Xamarin Studio with D Language Addin but currently it does not supported by developer. Also

Re: DLang IDE for macOS

2016-10-06 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 6 October 2016 at 09:31:43 UTC, Alexander Milushev wrote: Hi all, Is there any good IDE for DLang for macOS? I have used Xamarin Studio with D Language Addin but currently it does not supported by developer. Also I have tried Idea with D Language plugin but autocomplete did not

DLang IDE for macOS

2016-10-06 Thread Alexander Milushev via Digitalmars-d-learn
Hi all, Is there any good IDE for DLang for macOS? I have used Xamarin Studio with D Language Addin but currently it does not supported by developer. Also I have tried Idea with D Language plugin but autocomplete did not work.

Re: Why can't static arrays be sorted?

2016-10-06 Thread Adrian Matoga via Digitalmars-d-learn
On Thursday, 6 October 2016 at 09:17:08 UTC, pineapple wrote: On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis wrote: Would just like to point out that this is design weirdness on Phobos' part - the library I've been writing does not have this problem. It doesn't even make

Re: Why can't static arrays be sorted?

2016-10-06 Thread pineapple via Digitalmars-d-learn
On Thursday, 6 October 2016 at 09:17:08 UTC, pineapple wrote: On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis wrote: Would just like to point out that this is design weirdness on Phobos' part - the library I've been writing does not have this problem. It doesn't even make

Re: Why can't static arrays be sorted?

2016-10-06 Thread pineapple via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis wrote: Would just like to point out that this is design weirdness on Phobos' part - the library I've been writing does not have this problem. It doesn't even make conceptual sense for a static array to be a range, because you

Callbacks in D

2016-10-06 Thread DLearner via Digitalmars-d-learn
Please, could someone post here, or provide a link to, some simple, debugged examples. Best regards