How to check that import module will succeed?

2019-07-25 Thread Andrey Zherikov via Digitalmars-d-learn
Is there a way to check whether some module, say "foo", is available for import before doing "import foo"? I want to create a function that imports module if it's available or does something else otherwise. So I think the code should look something like this: mixin template my_import(alias

Re: Is betterC affect to compile time?

2019-07-25 Thread Mike Franklin via Digitalmars-d-learn
On Thursday, 25 July 2019 at 18:37:49 UTC, Jonathan M Davis wrote: There's probably at least one bug report on it, but as I understand it, it's not a bug in the sense that the implementation is currently expected to handle such a case. It's an area where betterC should be improved upon, but

Re: Any way to move in @disabled this(this) type in to a wrapping template?

2019-07-25 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 25 July 2019 at 21:58:06 UTC, aliak wrote: Haha. Ironic. Thanks, again :) Though, if you use auto ref, and you check if it's mutable and not copyable and then move, then that means you could potentially be applying move to an object on behalf of the clients auto a =

Re: Any way to move in @disabled this(this) type in to a wrapping template?

2019-07-25 Thread aliak via Digitalmars-d-learn
On Thursday, 25 July 2019 at 21:23:33 UTC, Paul Backus wrote: On Thursday, 25 July 2019 at 20:38:59 UTC, aliak wrote: On Thursday, 25 July 2019 at 19:35:36 UTC, aliak wrote: Basically, can template W be made to handle an S that can't be copied? import std; static struct S { int i;

Re: Any way to move in @disabled this(this) type in to a wrapping template?

2019-07-25 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 25 July 2019 at 20:38:59 UTC, aliak wrote: On Thursday, 25 July 2019 at 19:35:36 UTC, aliak wrote: Basically, can template W be made to handle an S that can't be copied? import std; static struct S { int i; @disable this(this); this(int i) { this.i = i; } } [...]

Re: Any way to move in @disabled this(this) type in to a wrapping template?

2019-07-25 Thread aliak via Digitalmars-d-learn
On Thursday, 25 July 2019 at 19:35:36 UTC, aliak wrote: Basically, can template W be made to handle an S that can't be copied? import std; static struct S { int i; @disable this(this); this(int i) { this.i = i; } } struct W(T) { T value; this(T value) { this.value

Any way to move in @disabled this(this) type in to a wrapping template?

2019-07-25 Thread aliak via Digitalmars-d-learn
Basically, can template W be made to handle an S that can't be copied? import std; static struct S { int i; @disable this(this); this(int i) { this.i = i; } } struct W(T) { T value; this(T value) { this.value = value; } } auto wrap(T)(T value) { return

Re: Is betterC affect to compile time?

2019-07-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 25, 2019 8:20:03 AM MDT Ali Çehreli via Digitalmars-d- learn wrote: > On 07/25/2019 05:46 AM, Oleg B wrote: > > On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: > >> Those restrictions don't stop at runtime. > > > > It's vary sad. > > > > What reason for such

Re: dip1000, perhaps annotate with return, and vibe-d

2019-07-25 Thread aliak via Digitalmars-d-learn
On Wednesday, 24 July 2019 at 16:23:48 UTC, Paul Backus wrote: On Wednesday, 24 July 2019 at 12:54:51 UTC, aliak wrote: [...] It should go on the constructor's parameter; i.e., this(auto return ref T value) { /* ... */ } Under the hood, a constructor actually returns the constructed value

Re: Is betterC affect to compile time?

2019-07-25 Thread bauss via Digitalmars-d-learn
On Thursday, 25 July 2019 at 18:06:02 UTC, Jonathan Marler wrote: On Thursday, 25 July 2019 at 12:46:48 UTC, Oleg B wrote: On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: Those restrictions don't stop at runtime. It's vary sad. What reason for such restrictions? It's

Re: Is betterC affect to compile time?

2019-07-25 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 25 July 2019 at 12:46:48 UTC, Oleg B wrote: On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: Those restrictions don't stop at runtime. It's vary sad. What reason for such restrictions? It's fundamental idea or temporary implementation? Yes it is very sad.

Re: Is betterC affect to compile time?

2019-07-25 Thread Ali Çehreli via Digitalmars-d-learn
On 07/25/2019 05:46 AM, Oleg B wrote: On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: Those restrictions don't stop at runtime. It's vary sad. What reason for such restrictions? It's fundamental idea or temporary implementation? It looks like a bug to me. Ali

Re: Is betterC affect to compile time?

2019-07-25 Thread Oleg B via Digitalmars-d-learn
On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: Those restrictions don't stop at runtime. It's vary sad. What reason for such restrictions? It's fundamental idea or temporary implementation?

Re: Is betterC affect to compile time?

2019-07-25 Thread rikki cattermole via Digitalmars-d-learn
On 26/07/2019 12:30 AM, Oleg B wrote: On Thursday, 25 July 2019 at 12:20:04 UTC, Mike Franklin wrote: If you read the documentation for betterC (https://dlang.org/spec/betterc.html#consequences) you'll see that there are features of the D language which are not supported. Therefore,

Re: Is betterC affect to compile time?

2019-07-25 Thread Oleg B via Digitalmars-d-learn
On Thursday, 25 July 2019 at 12:20:04 UTC, Mike Franklin wrote: If you read the documentation for betterC (https://dlang.org/spec/betterc.html#consequences) you'll see that there are features of the D language which are not supported. Therefore, libraries that use such features (e.g.

Re: Is betterC affect to compile time?

2019-07-25 Thread Mike Franklin via Digitalmars-d-learn
On Thursday, 25 July 2019 at 12:01:40 UTC, Oleg B wrote: Hello everyone! I try build this code with betterC import core.stdc.stdio; import std.format : format; extern(C) int main() { mixin(format!`enum str = "%s\0";`("hello")); fprintf(stderr, "%s\n", str.ptr); return 0; } but

Is betterC affect to compile time?

2019-07-25 Thread Oleg B via Digitalmars-d-learn
Hello everyone! I try build this code with betterC import core.stdc.stdio; import std.format : format; extern(C) int main() { mixin(format!`enum str = "%s\0";`("hello")); fprintf(stderr, "%s\n", str.ptr); return 0; } but compilation fails

Re: How to contact people on the forum

2019-07-25 Thread Greatsam4sure via Digitalmars-d-learn
On Wednesday, 24 July 2019 at 16:40:58 UTC, Mike Parker wrote: On Wednesday, 24 July 2019 at 16:37:33 UTC, Greatsam4sure wrote: On Wednesday, 24 July 2019 at 15:56:43 UTC, drug wrote: 24.07.2019 18:51, Greatsam4sure пишет: Good day everyone. I am thinking,  if there is a  way to contact any