How to specify a version from dub build command

2020-07-06 Thread adnan338 via Digitalmars-d-learn
I have a separate version for flatpak builds in my app. Let's say I have a large project that builds with dub that goes like this: import std.stdio; void main() { version (flatpak) { writeln(`Flatpak build`); } else { writeln("Edit source/app.d to

Re: I need an Easy example to understand Alias This

2020-07-06 Thread Ali Çehreli via Digitalmars-d-learn
On 7/6/20 5:44 PM, Marcone wrote: On Tuesday, 7 July 2020 at 00:42:40 UTC, Ali Çehreli wrote: On 7/6/20 5:35 PM, Marcone wrote: Hi, I study Dlang for one year, and I can't understand alias this. I need an Easy example to understand Alias This. Is the following example useful?   http://ddili.

Re: I need an Easy example to understand Alias This

2020-07-06 Thread Ali Çehreli via Digitalmars-d-learn
On 7/6/20 5:35 PM, Marcone wrote: Hi, I study Dlang for one year, and I can't understand alias this. I need an Easy example to understand Alias This. Is the following example useful? http://ddili.org/ders/d.en/alias_this.html Ali

Re: I need an Easy example to understand Alias This

2020-07-06 Thread Marcone via Digitalmars-d-learn
On Tuesday, 7 July 2020 at 00:42:40 UTC, Ali Çehreli wrote: On 7/6/20 5:35 PM, Marcone wrote: Hi, I study Dlang for one year, and I can't understand alias this. I need an Easy example to understand Alias This. Is the following example useful? http://ddili.org/ders/d.en/alias_this.html Ali

I need an Easy example to understand Alias This

2020-07-06 Thread Marcone via Digitalmars-d-learn
Hi, I study Dlang for one year, and I can't understand alias this. I need an Easy example to understand Alias This.

opApply and attributes

2020-07-06 Thread solidstate1991 via Digitalmars-d-learn
See implementation of data structure here: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/treemap.d#L565 If I try to compile this code, it'll fail, limiting it's usecase: @safe pure unittest { alias IntMap = TreeMap!(int, int, false); IntMap test;

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread kinke via Digitalmars-d-learn
On Monday, 6 July 2020 at 22:02:37 UTC, Kayomn wrote: On Monday, 6 July 2020 at 21:09:57 UTC, kinke wrote: Similar case here; the 'varargs' end up in a GC-allocated array. I've recently changed `scope` slice params, so that array literal arguments are allocated on the caller's stack instead; s

Re: Calling a C function whose name is a D reserved word or keyword

2020-07-06 Thread rikki cattermole via Digitalmars-d-learn
https://dlang.org/spec/pragma.html#mangle pragma(mangle, "body") extern(C) void body_func();

Calling a C function whose name is a D reserved word or keyword

2020-07-06 Thread Cecil Ward via Digitalmars-d-learn
Is there a special mechanism in D for handling this problem, where an existing C function might be a name that is reserved in D? Of course I could write a wrapper function in C and call that.

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread Kayomn via Digitalmars-d-learn
On Monday, 6 July 2020 at 21:09:57 UTC, kinke wrote: Similar case here; the 'varargs' end up in a GC-allocated array. I've recently changed `scope` slice params, so that array literal arguments are allocated on the caller's stack instead; so adding `scope` for these variadics *should* probably

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread kinke via Digitalmars-d-learn
On Monday, 6 July 2020 at 20:25:11 UTC, Kayomn wrote: Though, admittedly I'm kind of used to seeing this error message since it appears any time you try and do something that relies on type info in betterC, intentionally or not. A notable example is forgetting to supply an arrange length when

dub build=ddox, where the are the docs?

2020-07-06 Thread claptrap via Digitalmars-d-learn
Ok yeah it starts up a server and opens a webpage, great, but where are the docs? Cant find any info on command line switches for dub or ddox on how to get it to just dump the docs in a folder.

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread Kayomn via Digitalmars-d-learn
On Monday, 6 July 2020 at 20:25:11 UTC, Kayomn wrote: example is forgetting to supply an arrange length when array length*

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread Kayomn via Digitalmars-d-learn
On Monday, 6 July 2020 at 20:20:44 UTC, Stanislav Blinov wrote: I'd say the original error should be reported on bugzilla, if it isn't already; if only for the error message which is ridiculously obscure. Yeah, you're tellin' me lol. I spent the better part of the day tracking this one down,

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 6 July 2020 at 20:06:51 UTC, Kayomn wrote: Something discovered in the D Language Code Club Discord server with the help of Wild is that the following code: struct Test { ~this() {} } void tester(Test test, Test[] tests...) { } extern(C) void main() { tester(Test(), Test()); }

BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread Kayomn via Digitalmars-d-learn
Something discovered in the D Language Code Club Discord server with the help of Wild is that the following code: struct Test { ~this() {} } void tester(Test test, Test[] tests...) { } extern(C) void main() { tester(Test(), Test()); } Raises the "TypeInfo cannot be used with ~betterC" erro

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-06 Thread Jacob Carlborg via Digitalmars-d-learn
On Sunday, 5 July 2020 at 21:06:32 UTC, Per Nordlöw wrote: Is there a way to construct a custom written hash-table container (struct) from an AA-literal expression? I think your best bet is a tuple of pairs, because then you're not limited to compile time values, but it won't look pretty: im

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-06 Thread Jacob Carlborg via Digitalmars-d-learn
On Monday, 6 July 2020 at 01:43:43 UTC, user1234 wrote: --- import std; struct AA { void opIndexAssign(int v, string k) @nogc {} } void main(string[] args) @nogc { AA myCustom; enum literal = ["one":1, "two":2].stringof[1..$-1]; enum pairs = literal.split(',').array;

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-06 Thread Atwork via Digitalmars-d-learn
On Monday, 6 July 2020 at 11:51:19 UTC, Jacob Carlborg wrote: On Monday, 6 July 2020 at 01:43:43 UTC, user1234 wrote: Hereh we go ;) --- import std; struct AA { void opIndexAssign(int v, string k) @nogc {} } void main(string[] args) @nogc { AA myCustom; enum literal = ["one"

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-06 Thread Jacob Carlborg via Digitalmars-d-learn
On Monday, 6 July 2020 at 01:43:43 UTC, user1234 wrote: Hereh we go ;) --- import std; struct AA { void opIndexAssign(int v, string k) @nogc {} } void main(string[] args) @nogc { AA myCustom; enum literal = ["one":1, "two":2].stringof[1..$-1]; enum pairs = literal.split