Re: format with floating points GC allocating in DMD 2.090
On 31/01/2020 09:45, bauss wrote: > On Friday, 31 January 2020 at 07:20:17 UTC, cc wrote: >> char[4096] buf; >> writeln(GC.stats.usedSize); >> foreach (i; 0 .. 10) { >> sformat(buf, "%f", 1.234f); >> writeln(GC.stats.usedSize); >> } >> >> Output with DMD32 D Compiler v2.089.1-dirty (Win10 x64): >> 16 >> 16 >> 16 >> ... >> >> Output with DMD32 D Compiler v2.090.0-dirty: >> 16 >> 848 >> 1664 >> 2480 >> 3296 >> 4112 >> 4944 >> 5760 >> 6576 >> 7392 >> 8208 > > Report it as a bug because it's definitely a bug and there was changes > to the GC in 2.090.0 It's a change in std.format: https://issues.dlang.org/show_bug.cgi?id=20566
Re: How to use sets in D?
On Friday, 7 February 2020 at 22:03:00 UTC, H. S. Teoh wrote: On Fri, Feb 07, 2020 at 07:37:08PM +, mark via Digitalmars-d-learn wrote: [snip] bool[E] works just fine. [snip] Or you can wrap void[0][E] in a nice user-defined type that gives nice set-like syntax. But IMO, this is all overkill, and adds needless complexity. Just use bool[E] or std.container.rbtree. :-D I didn't think bool[E] would be a win because although it is only one byte per item, it won't align so wouldn't it end up taking 4 bytes of space anyway. The void[0][E] you showed is good, but, I'll try using the rbtree since I'd rather use an out-of-the-box collection. Thanks for the replies.
Re: Flatten a range of static arrays
On 08.02.20 02:38, ag0aep6g wrote: Simplified, we're looking at this: struct Joiner { int[3] _items; int[] _current; } void main() @safe { Joiner j; j._current = j._items[]; } I.e., a self-referential struct. Or most fundamentally: struct Joiner { Joiner* p; } void main() @safe { Joiner j; j.p = /* error */ } `dmd -dip1000` complains about the marked line: Error: reference to local variable j assigned to non-scope j.p What if I mark `j` as `scope`? Then I should be able to assign a reference-to-local to `j.p`. Indeed, the error goes away, but another takes its place: Error: cannot take address of scope local j in @safe function main Right. That can't be allowed, because `scope` gives only one level of protection, and `` would need two (one for `j` itself and one for the thing it points at). I went a bit overboard with that second reduction. The original struct is self-referential, but it's not recursive. The errors are the same for the first reduction. But it's not as clear that they're necessary. In the first reduction, `j` might be `scope`, but `j._items` has no indirections. `scope` doesn't actually mean anything for it. It's just an `int[3]` on the stack. So taking its address could be allowed. But (the current implementation of) DIP 1000 is apparently too conservative for that. It seems to treat pointers into a struct the same as pointers to the whole thing.
Re: total newbie + IDE
On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote: Hi guys, I am total newbie and trying to learn a little bit of programming for personal purposes (web scrapping, small databases for personal use etc.). I've been trying to install any of IDE available, but had no success. I use Manjaro, so for the most task I use its AUR, where: Dexed points to obsolete github (https://github.com/Basile-z/dexed) Dlangide is missing dependency (dlangide ~master depends on dsymbol ~>0.2.9), dub gives an error: .dub/packages/dlangui-0.9.182/dlangui/src/dlangui/widgets/editors.d(3797,21): Deprecation: foreach: loop index implicitly converted from size_t to int /usr/bin/dmd failed with exit code 1. So I've stick with Kate for the beginning, but I'll need a decent IDE for later. Please, can anyone help me solving these problems? Thank you S I've used d-mode with emacs and its been OK. Two other options for Linux are CodeBlocks and Monodevelop, both which have D support. As linked before, dexed is available here https://github.com/akira13641/dexed and I compiled it just a few days ago with success.
Re: Flatten a range of static arrays
On 08.02.20 01:17, Steven Schveighoffer wrote: The original code is not invalid though. f is not valid, and that is a bug, but the original code posted by nullptr should be fine by memory safety standards. Maybe. But then it should also work with `int[3] front;`. If there is no possible way to do the original code with dip1000 attributes, then that's a bug with dip1000's design (would not be surprised). Or DIP 1000 just doesn't allow that kind of code. @safe (including DIP 1000) is not supposed to allow all de-facto safe programs. Simplified, we're looking at this: struct Joiner { int[3] _items; int[] _current; } void main() @safe { Joiner j; j._current = j._items[]; } I.e., a self-referential struct. Or most fundamentally: struct Joiner { Joiner* p; } void main() @safe { Joiner j; j.p = /* error */ } `dmd -dip1000` complains about the marked line: Error: reference to local variable j assigned to non-scope j.p What if I mark `j` as `scope`? Then I should be able to assign a reference-to-local to `j.p`. Indeed, the error goes away, but another takes its place: Error: cannot take address of scope local j in @safe function main Right. That can't be allowed, because `scope` gives only one level of protection, and `` would need two (one for `j` itself and one for the thing it points at). If that code were allowed, you could do this: struct Joiner { Joiner* p; } Joiner g; void main() @safe { scope Joiner j; () @trusted { j.p = } (); /* pretend it's allowed */ g = *j.p; /* dereference and copy */ } Returning a copy of a dereferenced `scope` pointer is always allowed, because `scope` only provides one level of protection.
Re: Flatten a range of static arrays
On 2/7/20 6:30 PM, ag0aep6g wrote: On 08.02.20 00:10, nullptr wrote: ``` import std; struct SomeRange { int[3] val; enum empty = false; auto popFront() @safe {} ref auto front() @safe { return val; } } void main() @safe { SomeRange().take(10).map!((return ref x) => x[]).joiner.writeln; } ``` I don't know how applicable this is to your use case, but this code will compile and run under -dip1000. That shouldn't compile. You have found a hole in DIP 1000. struct SomeRange { int[3] val = [10, 20, 30]; ref auto front() @safe { return val; } } int[] f() @safe { SomeRange sr; // return sr.val[]; /* error, as expected */ return sr.front[]; /* no error, but escapes reference to local */ } void main() @safe { auto x = f(); import std.stdio; writeln(x); /* Prints garbage. */ } I'm too lazy right now to check if it's already in Bugzilla. The original code is not invalid though. f is not valid, and that is a bug, but the original code posted by nullptr should be fine by memory safety standards. If there is no possible way to do the original code with dip1000 attributes, then that's a bug with dip1000's design (would not be surprised). -Steve
Re: Flatten a range of static arrays
On 2/7/20 6:10 PM, nullptr wrote: ``` import std; struct SomeRange { int[3] val; enum empty = false; auto popFront() @safe {} ref auto front() @safe { return val; } } void main() @safe { SomeRange().take(10).map!((return ref x) => x[]).joiner.writeln; } ``` I don't know how applicable this is to your use case, but this code will compile and run under -dip1000. I tried the AST button. for the front function I got: return pure nothrow @nogc ref @safe int[3] front() return Note the duplicate return attributes. When I type that in, it doesn't compile, the return at the front is invalid. When I remove that return, I get a safety error. So something is weird about how the attributes are inferred. Either there is some magic attribute not being printed, or an attribute that can't be specified manually, or it's a bug. -Steve
Re: Flatten a range of static arrays
On 08.02.20 00:10, nullptr wrote: ``` import std; struct SomeRange { int[3] val; enum empty = false; auto popFront() @safe {} ref auto front() @safe { return val; } } void main() @safe { SomeRange().take(10).map!((return ref x) => x[]).joiner.writeln; } ``` I don't know how applicable this is to your use case, but this code will compile and run under -dip1000. That shouldn't compile. You have found a hole in DIP 1000. struct SomeRange { int[3] val = [10, 20, 30]; ref auto front() @safe { return val; } } int[] f() @safe { SomeRange sr; // return sr.val[]; /* error, as expected */ return sr.front[]; /* no error, but escapes reference to local */ } void main() @safe { auto x = f(); import std.stdio; writeln(x); /* Prints garbage. */ } I'm too lazy right now to check if it's already in Bugzilla.
Re: Flatten a range of static arrays
On Friday, 7 February 2020 at 22:55:29 UTC, Dennis wrote: Oops, minimized a bit too much. Corrected test case: ``` import std; struct S { @safe: int[3] front = [10, 20, 30]; bool empty = false; void popFront() {empty = true;} } void main() @safe { S.init.map!((return ref x) => x[]).joiner.writeln; } ``` It indeed still errors with -dip1000, but without -dip1000 it compiles now interestingly. ``` import std; struct SomeRange { int[3] val; enum empty = false; auto popFront() @safe {} ref auto front() @safe { return val; } } void main() @safe { SomeRange().take(10).map!((return ref x) => x[]).joiner.writeln; } ``` I don't know how applicable this is to your use case, but this code will compile and run under -dip1000.
Re: Flatten a range of static arrays
On Friday, 7 February 2020 at 21:40:36 UTC, Steven Schveighoffer wrote: S.popFront is not @safe, and S is not a template. So no inferrence. Oops, minimized a bit too much. Corrected test case: ``` import std; struct S { @safe: int[3] front = [10, 20, 30]; bool empty = false; void popFront() {empty = true;} } void main() @safe { S.init.map!((return ref x) => x[]).joiner.writeln; } ``` It indeed still errors with -dip1000, but without -dip1000 it compiles now interestingly.
Re: How to use sets in D?
On Fri, Feb 07, 2020 at 07:37:08PM +, mark via Digitalmars-d-learn wrote: > I am porting code from other languages to D as part of learning D, and > I find I've used sets quite a lot. AFAIK D doesn't have a built-in set > type or one in the std. lib. > > However, I've been perfectly successfully using int[E] where E is my > ElementType, and adding with set[element] = 0. I mostly only need add, > remove, iteration, and in, with uniqueness what I care most about. > > I know I could use bool[E] and set[element] = false, or I suppose > container.rbtree. Would either of these--or something else built-in or > in the std. lib.--be better? bool[E] works just fine. The bool does take up 1 byte, though, so if you're *really* want to optimize that away, you could do this: alias Unit = void[0]; enum unit = Unit.init; // Look, ma! A bona fide set! Unit[E] mySet; mySet[...] = unit; mySet.remove(...); ... // etc. Or you can wrap void[0][E] in a nice user-defined type that gives nice set-like syntax. But IMO, this is all overkill, and adds needless complexity. Just use bool[E] or std.container.rbtree. :-D T -- If you look at a thing nine hundred and ninety-nine times, you are perfectly safe; if you look at it the thousandth time, you are in frightful danger of seeing it for the first time. -- G. K. Chesterton
Re: Flatten a range of static arrays
On 2/7/20 4:17 PM, Dennis wrote: On Friday, 7 February 2020 at 20:55:14 UTC, nullptr wrote: Depending on how your range is structured, it might be possible to just mark front as returning by ref to make this work. That's a good one. I can't make front() return by ref, but I can make front a member variable of the range struct. Only problem: @safe function ... cannot call @system function std.algorithm.iteration.joiner!(...).joiner I don't know why. I don't have time to delve into this at the moment but if anyone wants to try, here's a minimal testcase: ``` import std; struct S { int[3] front = [10, 20, 30]; bool empty = false; void popFront() {empty = true;} } void main() @safe { S.init.map!((return ref x) => x[]).joiner.writeln; } ``` flags: -dip1000 -dip25 S.popFront is not @safe, and S is not a template. So no inferrence. But I did that, and it still doesn't compile. Not sure why not. Another fun dip1000 problem... -Steve
Re: Flatten a range of static arrays
On Friday, 7 February 2020 at 20:55:14 UTC, nullptr wrote: Depending on how your range is structured, it might be possible to just mark front as returning by ref to make this work. That's a good one. I can't make front() return by ref, but I can make front a member variable of the range struct. Only problem: @safe function ... cannot call @system function std.algorithm.iteration.joiner!(...).joiner I don't know why. I don't have time to delve into this at the moment but if anyone wants to try, here's a minimal testcase: ``` import std; struct S { int[3] front = [10, 20, 30]; bool empty = false; void popFront() {empty = true;} } void main() @safe { S.init.map!((return ref x) => x[]).joiner.writeln; } ``` flags: -dip1000 -dip25
Re: Flatten a range of static arrays
On Friday, 7 February 2020 at 20:31:47 UTC, Steven Schveighoffer wrote: The only solution I can provide is to wrap the static array into a range (maybe something like this exists in Phobos?): Thanks. I was hoping something like that existed in Phobos, but I can't find anything.
Re: Flatten a range of static arrays
On Friday, 7 February 2020 at 20:13:57 UTC, Dennis wrote: If I have an input range with element type `int[3]`, how do I easily turn it into a range of `int` so I can map it? If it were an int[3][] I could simply cast it to an int[] before mapping, but I don't want to eagerly turn it into an array. I thought of doing this: ``` range.map!(x => x[]).joiner.map!(x => x*2); ``` But it gives: Error: returning x[] escapes a reference to parameter x, perhaps annotate with return I tried doing: ``` map!((return x) => x[]) // same error map!((return ref x) => x[]) // does not match, map.front is not an lvalue ``` I can easily work around it with some more code, but I wonder if someone knows an easy solution. Depending on how your range is structured, it might be possible to just mark front as returning by ref to make this work.
Re: Flatten a range of static arrays
On 2/7/20 3:13 PM, Dennis wrote: If I have an input range with element type `int[3]`, how do I easily turn it into a range of `int` so I can map it? If it were an int[3][] I could simply cast it to an int[] before mapping, but I don't want to eagerly turn it into an array. I thought of doing this: ``` range.map!(x => x[]).joiner.map!(x => x*2); ``` But it gives: Error: returning x[] escapes a reference to parameter x, perhaps annotate with return This is correct. Consider that you did not mark x as ref. So what x actually is is a function local. If you returned x[], you just returned a reference to a local, which is about to go out of scope. I tried doing: ``` map!((return x) => x[]) // same error map!((return ref x) => x[]) // does not match, map.front is not an lvalue ``` I can easily work around it with some more code, but I wonder if someone knows an easy solution. This means your actual input range is not an array (map should forward the lvalueness of it). This means you can't just slice, as you will again return references to the local stack frame. The only solution I can provide is to wrap the static array into a range (maybe something like this exists in Phobos?): struct SARange(T, size_t N) { T[N] storage; size_t elem; auto front() { return storage[elem]; } void popFront() { ++elem; } bool empty() { return elem >= N; } } auto asRange(T : E[N], E, size_t N)(T val) { return SARange!(E, N)(val); } range.map!(x => x.asRange).joiner.map!(x => x*2); -Steve
Flatten a range of static arrays
If I have an input range with element type `int[3]`, how do I easily turn it into a range of `int` so I can map it? If it were an int[3][] I could simply cast it to an int[] before mapping, but I don't want to eagerly turn it into an array. I thought of doing this: ``` range.map!(x => x[]).joiner.map!(x => x*2); ``` But it gives: Error: returning x[] escapes a reference to parameter x, perhaps annotate with return I tried doing: ``` map!((return x) => x[]) // same error map!((return ref x) => x[]) // does not match, map.front is not an lvalue ``` I can easily work around it with some more code, but I wonder if someone knows an easy solution.
Re: How to use sets in D?
On Friday, 7 February 2020 at 19:37:08 UTC, mark wrote: I am porting code from other languages to D as part of learning D, and I find I've used sets quite a lot. AFAIK D doesn't have a built-in set type or one in the std. lib. However, I've been perfectly successfully using int[E] where E is my ElementType, and adding with set[element] = 0. I mostly only need add, remove, iteration, and in, with uniqueness what I care most about. I know I could use bool[E] and set[element] = false, or I suppose container.rbtree. Would either of these--or something else built-in or in the std. lib.--be better? I have not that much experience, but i have asked the exact same thing in the IRC. rbtree was recommended. However, if it is not performance critical (in terms of speed or size), your solution works fine as well.
How to use sets in D?
I am porting code from other languages to D as part of learning D, and I find I've used sets quite a lot. AFAIK D doesn't have a built-in set type or one in the std. lib. However, I've been perfectly successfully using int[E] where E is my ElementType, and adding with set[element] = 0. I mostly only need add, remove, iteration, and in, with uniqueness what I care most about. I know I could use bool[E] and set[element] = false, or I suppose container.rbtree. Would either of these--or something else built-in or in the std. lib.--be better?
Re: Does D have an equvalent of: if (auto = expr; expr)
Thanks for the excellent replies.
Re: Does D have an equvalent of: if (auto = expr; expr)
On Friday, 7 February 2020 at 08:52:44 UTC, mark wrote: Some languages support this kind of thing: if ((var x = expression) > 50) print(x, " is > 50") Is there anything similar in D? Yes assuming that the expression is bool evaluable. This includes - pointers: `if (auto p = giveMeSomePtr()){}` - classes references: `if (auto p = giveMeSomeClasses()){}` - integers `if (auto p = giveMeAnInt()){}` and using the in operators as you've been answered previously. The problem is that this support only one variable and that the If condition must be either a variable or a relational expression. Not both. To overcome the limitation of a single variable I've made a little template: --- /** * Encapsulates several variables in a tuple that's usable as a if condition, * as a workaround to the single declaration allowed by the language. * * Params: * a = The expressions giving the variables. * The variables must be evaluable to $(D bool). * * Returns: * A tuple containing the variables. */ auto ifVariables(A...)(auto ref A a) if (A.length) { static struct IfVariables(A...) { private A tup; alias tup this; this() @disable; this(this) @disable; this(ref A a) { tup = a; } bool opCast(T : bool)() const { static foreach (i; 0 .. A.length) if (!tup[i]) return false; return true; } } return IfVariables!A(a); } /// unittest { assert(ifVariables(new Object, true, new Object)); assert(!ifVariables(new Object, false, new Object)); // typical usage bool isDlangExpressive(){return true;} if (auto a = ifVariables(new Object, isDlangExpressive())) {} // use the variables if (auto a = ifVariables(new Object, new Object)) { assert(a.length == 2); assert(a[0] !is a[1]); } } ---
Re: total newbie + IDE
On Friday, 7 February 2020 at 18:10:07 UTC, bachmeier wrote: On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote: Hi guys, I am total newbie and trying to learn a little bit of programming for personal purposes (web scrapping, small databases for personal use etc.). I've been trying to install any of IDE available, but had no success. I use Manjaro, so for the most task I use its AUR, where: Dexed points to obsolete github (https://github.com/Basile-z/dexed) [...] [...] The new Github link for Dexed is https://github.com/akira13641/dexed No I've reuploaded the most recent version here https://gitlab.com/basile.b/dexed. However, 1. no more binaries 2. don't care about requests anymore. 3. code for the Windows version is not maintained. So it's not recommened for newbies, or only those who can manage things by themselves.
Re: total newbie + IDE
On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote: Hi guys, I am total newbie and trying to learn a little bit of programming for personal purposes (web scrapping, small databases for personal use etc.). I've been trying to install any of IDE available, but had no success. I use Manjaro, so for the most task I use its AUR, where: Dexed points to obsolete github (https://github.com/Basile-z/dexed) Dlangide is missing dependency (dlangide ~master depends on dsymbol ~>0.2.9), dub gives an error: .dub/packages/dlangui-0.9.182/dlangui/src/dlangui/widgets/editors.d(3797,21): Deprecation: foreach: loop index implicitly converted from size_t to int /usr/bin/dmd failed with exit code 1. So I've stick with Kate for the beginning, but I'll need a decent IDE for later. Please, can anyone help me solving these problems? Thank you S Apparently Dlangide is no longer maintained, but it hasn't been moved to the inactive list. The AUR for Manjaro must be old. The new Github link for Dexed is https://github.com/akira13641/dexed I think most IDE users have settled on VS Code at this point. Some others do use IntelliJ: https://github.com/intellij-dlanguage/intellij-dlanguage I'd use VS Code if I wanted an IDE just because it's what others use.
Re: total newbie + IDE
On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote: Hi guys, I am total newbie and trying to learn a little bit of programming for personal purposes (web scrapping, small databases for personal use etc.). I've been trying to install any of IDE available, but had no success. [...] Try Visual Studio Code with Code-D extension.
total newbie + IDE
Hi guys, I am total newbie and trying to learn a little bit of programming for personal purposes (web scrapping, small databases for personal use etc.). I've been trying to install any of IDE available, but had no success. I use Manjaro, so for the most task I use its AUR, where: Dexed points to obsolete github (https://github.com/Basile-z/dexed) Dlangide is missing dependency (dlangide ~master depends on dsymbol ~>0.2.9), dub gives an error: .dub/packages/dlangui-0.9.182/dlangui/src/dlangui/widgets/editors.d(3797,21): Deprecation: foreach: loop index implicitly converted from size_t to int /usr/bin/dmd failed with exit code 1. So I've stick with Kate for the beginning, but I'll need a decent IDE for later. Please, can anyone help me solving these problems? Thank you S
Re: Can't compile dlangui
On Friday, 7 February 2020 at 14:25:05 UTC, Jan Hönig wrote: I am afraid that dlangui and dlangide is currently not maintained, since i can reproduce the error as well. If you're sure that's the case, then it should be pushed to the inactive section on this page: https://wiki.dlang.org/IDEs
Re: D create many thread
On 2/7/20 2:34 AM, bauss wrote: On Thursday, 6 February 2020 at 22:00:26 UTC, tchaloupka wrote: On Wednesday, 5 February 2020 at 13:05:59 UTC, Eko Wahyudin wrote: Hi all, I'm create a small (hallo world) application, with DMD. But my program create 7 annoying threads when create an empty class. If you don't want the parallel sweep enabled for your app, you can turn it of ie with: ``` extern(C) __gshared string[] rt_options = [ "gcopt=parallel:0" ]; ``` Or in various other ways as described in mentioned documentation: https://dlang.org/spec/garbage.html#gc_config Why are we doing it like that? That's the least user-friendly method of configuring the GC I have ever seen. The reason this has to be configured this way is because the parallel scanning is an implementation detail, and shouldn't be exposed via the core.memory.GC interface. But I still maintain, a hello world program should not need this to avoid spawning 6 threads to scan itself. -Steve
Re: Can't compile dlangui
On Friday, 7 February 2020 at 12:04:10 UTC, A.Perea wrote: Hi, I'm trying to compile dlangide, and it fails when compiling the dependency dlangui. Trying to compile dlangui independently gives the same error message (see below for full stack trace) As phobos nor dlangui can be broken, it should be something related to wrong installation on my side?, wrong versions of dmd/dub/phobos? dmd version: DMD64 D Compiler v2.090.0 dub version: DUB version 1.19.0, built on Jan 5 2020 Thanks for any help. I am afraid that dlangui and dlangide is currently not maintained, since i can reproduce the error as well. If you are looking for a good editor for D: I am using VisualStudioCode with the code-d plugin. If you don't like Microsoft's calling home features, you can go for Codium: https://vscodium.com/
Can't compile dlangui
Hi, I'm trying to compile dlangide, and it fails when compiling the dependency dlangui. Trying to compile dlangui independently gives the same error message (see below for full stack trace) As phobos nor dlangui can be broken, it should be something related to wrong installation on my side?, wrong versions of dmd/dub/phobos? dmd version: DMD64 D Compiler v2.090.0 dub version: DUB version 1.19.0, built on Jan 5 2020 Thanks for any help. dub run dlangui Building package dlangui in /home/aperea/.dub/packages/dlangui-0.9.182/dlangui/ Performing "debug" build using /usr/bin/dmd for x86_64. dlangui 0.9.182: building configuration "default"... ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/dom/cssparser.d(86,18): Deprecation: union field intValue with default initialization 0 must be before field typeFlagId /usr/include/dmd/phobos/std/math.d(282,12): Error: variable std.math.floatTraits!(inout(double)).RECIP_EPSILON only parameters or stack based variables can be inout /usr/include/dmd/phobos/std/math.d(6814,15): Error: template instance std.math.floatTraits!(inout(double)) error instantiating /usr/include/dmd/phobos/std/format.d(2652,27): instantiated from here: isInfinity!(inout(double)) /usr/include/dmd/phobos/std/format.d(1875,20): instantiated from here: formatValueImpl!(Appender!string, inout(double), char) /usr/include/dmd/phobos/std/conv.d(1072,16):instantiated from here: formatValue!(Appender!string, inout(double), char) /usr/include/dmd/phobos/std/conv.d(222,24):instantiated from here: toImpl!(string, inout(double)) ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/core/settings.d(501,33): instantiated from here: to!(inout(double)) /usr/include/dmd/phobos/std/format.d(2671,31): Error: template instance std.math.signbit!(inout(double)) error instantiating /usr/include/dmd/phobos/std/format.d(1875,20): instantiated from here: formatValueImpl!(Appender!string, inout(double), char) /usr/include/dmd/phobos/std/conv.d(1072,16):instantiated from here: formatValue!(Appender!string, inout(double), char) /usr/include/dmd/phobos/std/conv.d(222,24):instantiated from here: toImpl!(string, inout(double)) ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/core/settings.d(501,33): instantiated from here: to!(inout(double)) /usr/include/dmd/phobos/std/format.d(2709,10): Error: forward reference to inferred return type of function call function () @trusted { import core.stdc.stdio : snprintf; return snprintf(buf2.ptr, buf2.length, sprintfSpec.ptr, fs.width, fs.precision == fs.UNSPECIFIED ? -1 : fs.precision, tval); } () ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/dialogs/filedlg.d(377,54): Deprecation: function std.typecons.Nullable!(SysTime).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/dialogs/filedlg.d(377,63): Deprecation: function std.typecons.Nullable!(SysTime).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/dialogs/filedlg.d(377,73): Deprecation: function std.typecons.Nullable!(SysTime).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/dialogs/filedlg.d(377,81): Deprecation: function std.typecons.Nullable!(SysTime).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/dialogs/filedlg.d(377,90): Deprecation: function std.typecons.Nullable!(SysTime).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/graphics/ftfonts.d(541,9): Deprecation: foreach: loop index implicitly converted from size_t to int ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/graphics/scene/scene3d.d(123,9): Deprecation: variable res is shadowing variable dlangui.graphics.scene.scene3d.visit.res. Rename the foreach variable. ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/widgets/editors.d(3447,9): Deprecation: foreach: loop index implicitly converted from size_t to int ../../.dub/packages/dlangui-0.9.182/dlangui/src/dlangui/widgets/editors.d(3797,21): Deprecation: foreach: loop index implicitly converted from size_t to int /usr/bin/dmd failed with exit code 1.
Re: Does D have an equvalent of: if (auto = expr; expr)
On Friday, 7 February 2020 at 08:52:44 UTC, mark wrote: Some languages support this kind of thing: if ((var x = expression) > 50) print(x, " is > 50") Is there anything similar in D? Yes and no. It only works for bools or things that convert to bool. You might have seen: string[string] dict; if (auto p = "key" in dict) { writeln(*p); } That works because the 'in' operator on aa's returns a pointer, which can be compared to bool.
Re: How make Executable Dlang EXE ask for "Run as Administrator"?
Solved adding this code in resource.rc, converted to resource.res and linked to .d source. This code add the file "manifest.manifest" to resource. 1 24 "manifest.manifest"
Does D have an equvalent of: if (auto = expr; expr)
Some languages support this kind of thing: if ((var x = expression) > 50) print(x, " is > 50") Is there anything similar in D?