Re: Runtime heterogeneous collections?

2019-01-19 Thread Steven O via Digitalmars-d-learn
I'd like to thank everyone for their help! I was finally able to do what I'd like. I didn't end up using a variant, but maybe there's a better way to do what I want using it, and I just couldn't figure it out. Here's the solution I finally came up with: https://run.dlang.io/is/GdDDBp If

Re: Am I misusing with?

2019-01-19 Thread Q. Schroll via Digitalmars-d-learn
On Saturday, 19 January 2019 at 20:38:00 UTC, faissaloo wrote: On Saturday, 19 January 2019 at 20:07:34 UTC, Rubn wrote: On Saturday, 19 January 2019 at 17:49:31 UTC, faissaloo wrote: [...] If you look at the implementation, "lines" is a struct.

Re: Am I misusing with?

2019-01-19 Thread faissaloo via Digitalmars-d-learn
On Saturday, 19 January 2019 at 20:07:34 UTC, Rubn wrote: On Saturday, 19 January 2019 at 17:49:31 UTC, faissaloo wrote: [...] If you look at the implementation, "lines" is a struct. https://github.com/dlang/phobos/blob/v2.084.0/std/stdio.d#L4330 [...] Ah that makes some sense, thanks for

Re: Am I misusing with?

2019-01-19 Thread Rubn via Digitalmars-d-learn
On Saturday, 19 January 2019 at 17:49:31 UTC, faissaloo wrote: This seems to work fine file = File("test.txt", "r"); with (file) { scope(exit) close(); foreach (string line; file.lines()) { line_array ~= line; } } however: file =

Re: Compiling to 68K processor (Maybe GDC?)

2019-01-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 19 January 2019 at 12:54:28 UTC, rikki cattermole wrote: I have no idea about GDC, but the -betterC flag is pretty recent so its support may not be what you would consider first class there yet. so specifically -betterC has been around for years, but it has only recently become

Am I misusing with?

2019-01-19 Thread faissaloo via Digitalmars-d-learn
This seems to work fine file = File("test.txt", "r"); with (file) { scope(exit) close(); foreach (string line; file.lines()) { line_array ~= line; } } however: file = File("test.txt", "r"); with (file) { scope(exit) close();

Re: Compiling to 68K processor (Maybe GDC?)

2019-01-19 Thread Patrick Schluter via Digitalmars-d-learn
On Saturday, 19 January 2019 at 12:54:28 UTC, rikki cattermole wrote: On 20/01/2019 1:38 AM, Edgar Vivar wrote: Hi, I have a project aiming to old 68K processor. While I don't think DMD would be able for this on the other hand I think GDC can, am I right? If yes would be any restriction of

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-19 Thread Zenw via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote: As an example let's say I have a type 'Window' that represents a win32 window. I'd like to be able to construct an instance of the type with some optional parameters that default to some reasonable settings and create the

Re: Compiling to 68K processor (Maybe GDC?)

2019-01-19 Thread rikki cattermole via Digitalmars-d-learn
On 20/01/2019 1:38 AM, Edgar Vivar wrote: Hi, I have a project aiming to old 68K processor. While I don't think DMD would be able for this on the other hand I think GDC can, am I right? If yes would be any restriction of features to be used? Or the compiler would be smart enough to handle

Compiling to 68K processor (Maybe GDC?)

2019-01-19 Thread Edgar Vivar via Digitalmars-d-learn
Hi, I have a project aiming to old 68K processor. While I don't think DMD would be able for this on the other hand I think GDC can, am I right? If yes would be any restriction of features to be used? Or the compiler would be smart enough to handle this properly? Edgar V.

Re: Alternative to Interfaces

2019-01-19 Thread Kagamin via Digitalmars-d-learn
On Friday, 18 January 2019 at 18:48:46 UTC, Jonathan M Davis wrote: Yes, but some D features will use the GC They would like to allocate, but they don't know nor care where it's allocated from, if the developer uses custom memory management, he will know how it's allocated and will be able