[Issue 10602] Better error message for wrong template lambda given to function
https://issues.dlang.org/show_bug.cgi?id=10602 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=17477, ||https://issues.dlang.org/sh ||ow_bug.cgi?id=9423 --
[Issue 17477] DMD error message for delegate with wrong attributes is very confusing
https://issues.dlang.org/show_bug.cgi?id=17477 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=10602 --
[Issue 9423] Missed conversion of lambda literal with ref argument
https://issues.dlang.org/show_bug.cgi?id=9423 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=10602 --
[Issue 17477] DMD error message for delegate with wrong attributes is very confusing
https://issues.dlang.org/show_bug.cgi?id=17477 Vladimir Panteleevchanged: What|Removed |Added Hardware|x86_64 |All OS|Linux |All --
[Issue 10332] Dustmite should be distributed with the zipped release
https://issues.dlang.org/show_bug.cgi?id=10332 Vladimir Panteleevchanged: What|Removed |Added Status|REOPENED|RESOLVED Component|dmd |installer Resolution|--- |WORKSFORME --- Comment #2 from Vladimir Panteleev --- dustmite has been in the zip files since 2.065.0, closing. --
[Issue 5660] yield syntax sugar
https://issues.dlang.org/show_bug.cgi?id=5660 Vladimir Panteleevchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #12 from Vladimir Panteleev --- I believe it has become an accepted fact that such constructs are done in library code (either using std.concurrency, or Vibe's implementation of fibers), and said implementations are generally satisfactory. In either case, I believe that today enhancement requests to the language itself need to be presented as a D Improvement Proposal: https://github.com/dlang/DIPs If you think this proposal still has merit today, please file a DIP. The current DIP manager can assist you through the process. --
[Issue 6856] Absence of in contract (precondition) on override of method that has one is badly designed
https://issues.dlang.org/show_bug.cgi?id=6856 Vladimir Panteleevchanged: What|Removed |Added Keywords||pull --
[Issue 10276] Nested structs with constructors get a context pointer even if they don't need one
https://issues.dlang.org/show_bug.cgi?id=10276 Vladimir Panteleevchanged: What|Removed |Added Summary|Nested structs get a|Nested structs with |context pointer even if |constructors get a context |they don't need one |pointer even if they don't ||need one Severity|normal |enhancement --
[Issue 14478] isInputRange should allow ranges of non-copyable elements
https://issues.dlang.org/show_bug.cgi?id=14478 Vladimir Panteleevchanged: What|Removed |Added Summary|isInputRange failed to |isInputRange should allow |recognize some ranges |ranges of non-copyable ||elements Severity|major |enhancement --
Re: Update to Bare Metal STM32F4 (ARM Cortex-M4) LCD Demo Proof of Concept
On Friday, 21 July 2017 at 00:27:09 UTC, Mike wrote: On Thursday, 20 July 2017 at 17:09:40 UTC, Mr.D wrote: Thanks for your work with bare metal MCUs! I am dreaming that someday I can program smart house IoT automation on D. You already can; it just may not be the most professional experience. If you have the hardware and the time, do it! Mike Thanks for your work
[Issue 15303] std.json: consider JSON5 support
https://issues.dlang.org/show_bug.cgi?id=15303 Vladimir Panteleevchanged: What|Removed |Added Status|NEW |RESOLVED Hardware|x86_64 |All Resolution|--- |WONTFIX OS|Linux |All --- Comment #2 from Vladimir Panteleev --- JSON5 has received lots of criticism from the technical community: https://news.ycombinator.com/item?id=4031699 http://ilee.co.uk/json5-is-pointless-and-unimaginative/ This is probably better left to a third-party Dub package. --
[Issue 17076] [scope] compiling identity function template with -dip1000 causes error
https://issues.dlang.org/show_bug.cgi?id=17076 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=8914 --
[Issue 8914] Wrong `escaping reference` error on returning static array
https://issues.dlang.org/show_bug.cgi?id=8914 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=17076 --- Comment #2 from Vladimir Panteleev --- Test case above no longer fails to compile since 2.074.0 (https://github.com/dlang/dmd/pull/6420), however, adding an indirection to the parameter type still shows the error: int*[2] f(int*[2] arr...) { return arr; } // Error: returning `arr` escapes a reference to variadic parameter `arr` --
[Issue 4104] No way to get notified about D runtime termination.
https://issues.dlang.org/show_bug.cgi?id=4104 Vladimir Panteleevchanged: What|Removed |Added Keywords||patch --
[Issue 4104] No way to get notified about D runtime termination.
https://issues.dlang.org/show_bug.cgi?id=4104 Vladimir Panteleevchanged: What|Removed |Added Hardware|Other |All OS|Linux |All --- Comment #3 from Vladimir Panteleev --- If this enhancement request is still actual today, please submit the patch as a pull request; otherwise, it's unlikely anything will be done about it. I'll leave this open because it doesn't seem too unlikely that another project will require a similar addition, in which case having an existing issue could be useful. --
[Issue 16618] [REG2.055] Segmentation fault in DMD with cyclic alias this and unknown identifier
https://issues.dlang.org/show_bug.cgi?id=16618 Vladimir Panteleevchanged: What|Removed |Added Hardware|x86 |All Summary|Segmentation fault: 11 |[REG2.055] Segmentation ||fault in DMD with cyclic ||alias this and unknown ||identifier --
[Issue 10256] Fix .deb file production
https://issues.dlang.org/show_bug.cgi?id=10256 Vladimir Panteleevchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WORKSFORME --- Comment #1 from Vladimir Panteleev --- I believe our .deb files have received lots of fixes within the 4 years since this issue was filed, and I don't think we're recently received any reports about problems similar to the one in the original post in the linked thread. If there are still any pertinent problems, please file a new issue for each. --
[Issue 7833] [2.059 Beta] Changelog should clearly mention struct literal/opCmp/opEquals/toHash changes
https://issues.dlang.org/show_bug.cgi?id=7833 Vladimir Panteleevchanged: What|Removed |Added Status|NEW |RESOLVED Component|dmd |dlang.org Resolution|--- |WONTFIX --- Comment #7 from Vladimir Panteleev --- I believe the train has left the station insofar updating the changelog goes. I believe the spec pages have received lots of updates throughout the 5 years since this issue was filed. If you believe they are still lacking in some regard, please open a new issue (or, better yet, send a pull request, as you're already accustomed with the subject.) --
[Issue 11521] Collision of templates instantiated with different same-named locals
https://issues.dlang.org/show_bug.cgi?id=11521 Vladimir Panteleevchanged: What|Removed |Added Keywords||wrong-code Summary|Switch using same name |Collision of templates |variable leads to Access|instantiated with different |Violation |same-named locals Severity|normal |critical --- Comment #1 from Vladimir Panteleev --- Reduced: // test.d / void fun(alias x)() { assert(x == 1); } void main() { if (false) { int i = 0; fun!i(); } { int i = 1; fun!i(); } } /// The problem is that both fun!i instantiations have the same mangled name, even though they refer to different variables and have different code. The mangled name of local variables should have some sort of index in them. --
[Issue 6843] Function to check whether std.conv.to will succeed
https://issues.dlang.org/show_bug.cgi?id=6843 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=6840 --
[Issue 6840] std.conv.maybeTo
https://issues.dlang.org/show_bug.cgi?id=6840 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=6843 --
[Issue 5033] Add explicit 'frame context' and 'this' type modifiers for callback functions
https://issues.dlang.org/show_bug.cgi?id=5033 --- Comment #1 from Vladimir Panteleev--- I believe that this enhancement request is today possible to implement on top of D's existing introspection / metaprogramming / code-generation features. In either case, today enhancement requests to the language itself need to be presented as a D Improvement Proposal: https://github.com/dlang/DIPs Please file a DIP if you think this proposal still has merit today. The current DIP manager can assist you through the process. --
[Issue 5033] Add explicit 'frame context' and 'this' type modifiers for callback functions
https://issues.dlang.org/show_bug.cgi?id=5033 Vladimir Panteleevchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --
Re: How does one determine the UDAs of all symbols contained in a given module?
On Wednesday, 19 July 2017 at 14:23:25 UTC, Jacob Carlborg wrote: Here's an example: Thanks... Minus the AliasSeq bit, this is pretty much what I've been working with since talking to Brain. The main problem I'm facing is that it fails to compileif any of the symbols in the imported module is marked private. findudas.d-mixin-17(17): Error: ScopeDsymbol findudas.getModuleSymbols!"somepackage.mod1".__anonymous.__anonymous variable somepackage.mod1.workhorse is private findudas.d-mixin-17(17): Deprecation: somepackage.mod1.workhorse is not visible from module findudas findudas.d-mixin-21(21): Error: ScopeDsymbol findudas.getModuleSymbols!"somepackage.mod1".__anonymous.__anonymous variable somepackage.mod1.workhorse is private findudas.d-mixin-21(21): Deprecation: somepackage.mod1.workhorse is not visible from module findudas findudas.d(34): Error: template instance findudas.getModuleSymbols!"somepackage.mod1".getModuleSymbols.printUDAs!(mod1) error instantiating findudas.d(43):instantiated from here: getModuleSymbols!"somepackage.mod1"
[Issue 7042] Allocation of 'creal' array with 'new' fails when linking without /noi switch
https://issues.dlang.org/show_bug.cgi?id=7042 Vladimir Panteleevchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #3 from Vladimir Panteleev --- (In reply to Andrej Mitrovic from comment #2) > Perhaps we must always use /noi, in which case this is an invalid bug > report. It's certainly weird that the Microsoft linker defaults to case-insensitivity even though C is case-sensitive, but it's no surprise if weird bugs arise from said case-insensitivity. In any case, I don't see why wrong link settings need to be DMD's burden. Though it's not impossible that a workaround in DMD in theory might exist, the primary cause of this problem is clearly user error. --
[Issue 17604] Reject mutable fields initialized with reference types to data segment
https://issues.dlang.org/show_bug.cgi?id=17604 Vladimir Panteleevchanged: What|Removed |Added Keywords||safe See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=15612 --
[Issue 15612] Break immutability with default initialisers
https://issues.dlang.org/show_bug.cgi?id=15612 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=17604 --
[Issue 10364] Mac OS 10.8 program crash
https://issues.dlang.org/show_bug.cgi?id=10364 Vladimir Panteleevchanged: What|Removed |Added Component|dmd |druntime --- Comment #7 from Vladimir Panteleev --- I reproduced it with macOS 10.12 and DMD 2.074. Changing daemon(0,0) to daemon(0,1) (so that stderr isn't redirected to /dev/null) reveals a clue: core.thread.ThreadError@src/core/thread.d(3002): Unable to load thread state It looks like the daemon() call is interfering with Druntime's threading code. --
Re: How to debug in vscode with mago-mi?
On Thursday, 20 July 2017 at 15:31:55 UTC, WebFreak001 wrote: On Monday, 17 July 2017 at 08:44:46 UTC, Domain wrote: Could anyone show me how to debug in vscode with mago-mi? I have installed vscode with Native Debug, SDLang. I have tried dlang-vscode and code-d. [...] Is the application actually being put in bin/app.exe? Also try a different debugger (the windows debugger from the C/C++ Extension by Microsoft which uses the visual studio debugger is quite good) Yes, I have visual studio installed. I can debug with VisualD. And I can debug with mago-mi from commandline, but not in vs code. When I click debug button, I can see the debug toolbar, but it will be gone in seconds. And no breakpoint hit. My source structure --| |--bin | |--app.exe | |--src | |--app.d | |--dub.json | |--.vscode | |--task.json | |--launch.json | |--.dub
Re: Update to Bare Metal STM32F4 (ARM Cortex-M4) LCD Demo Proof of Concept
On Thursday, 20 July 2017 at 17:09:40 UTC, Mr.D wrote: Thanks for your work with bare metal MCUs! I am dreaming that someday I can program smart house IoT automation on D. You already can; it just may not be the most professional experience. If you have the hardware and the time, do it! Mike
Re: Solving the spurious forward/cyclic reference errors in DMD
I'll start working on this tomorrow, so if you believe this effort will be in vain, please leave a comment.
Re: Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote: Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from Base. However, this is not the case: main.d(6): Error: class main.Derived cannot implicitly generate a default ctor when base class main.Base is missing a default ctor Is it a bug or it should be like this? compiles with: dmd 2.073 fails with: dmd 2.074 dmd 2.075
[Issue 17673] regex(["\\\\\\\\|\\\\\"", "\"|$"]) - wrong whichPattern
https://issues.dlang.org/show_bug.cgi?id=17673 Nikolay (unDEFER) Krivchenkovchanged: What|Removed |Added CC||dmitry.o...@gmail.com, ||unde...@gmail.com --
[Issue 17673] New: regex(["\\\\\\\\|\\\\\"", "\"|$"]) - wrong whichPattern
https://issues.dlang.org/show_bug.cgi?id=17673 Issue ID: 17673 Summary: regex(["|\"", "\"|$"]) - wrong whichPattern Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: unde...@gmail.com regex returns whichPattern wrongly The code demonstrating the problem: https://dpaste.dzfl.pl/d7f94068608e --
Re: Work on ARM backend for DMD started
On 7/20/2017 9:22 AM, solidstate1991 wrote: A few things you should be aware before you trash the reference compiler for D: I wouldn't be discouraged by the nay-sayers. If you want to build an ARM back end for it, do it! About every project I've ever embarked on, including D, started with everyone nay-saying it.
Re: The X Macro using D
On 7/20/2017 2:21 PM, Stefan Koch wrote: Please tell me this is not going to get into dmd :) templates are so much more expensive then macros. (Well, for now :) ) Those templates can and should be replaced by CTFE. If you like, present the CTFE solution. Should be fun!
Re: The X Macro using D
On Thursday, 20 July 2017 at 21:17:45 UTC, Walter Bright wrote: template Y(alias X) { enum Y = [ // id reg mask ty X!("AH", 4, mAX, TYuchar), X!("AL", 0, mAX, TYuchar), X!("AX", 8, mAX, TYushort), X!("BH", 7, mBX, TYuchar), X!("BL", 3, mBX, TYuchar), X!("BP", 13, 0, TYushort), X!("BX", 11, mBX, TYushort), X!("CH", 5, mCX, TYuchar), X!("CL", 1, mCX, TYuchar), X!("CX", 9, mCX, TYushort), X!("DH", 6, mDX, TYuchar), X!("DI", 15, mDI, TYushort), X!("DL", 2, mDX, TYuchar), X!("DX", 10, mDX, TYushort), X!("EAX", 16, mAX, TYulong), X!("EBP", 21, 0, TYulong), X!("EBX", 19, mBX, TYulong), X!("ECX", 17, mCX, TYulong), X!("EDI", 23, mDI, TYulong), X!("EDX", 18, mDX, TYulong), X!("ESI", 22, mSI, TYulong), X!("ESP", 20, 0, TYulong), X!("SI", 14, mSI, TYushort), X!("SP", 12, 0, TYushort), ]; } // Table for identifiers template Xtab(alias A, alias B, alias C, alias D) { enum Xtab = A; } private __gshared const(char)*[24] pseudotab = Y!Xtab; // Register number to use in addressing mode template Xreg(alias A, alias B, alias C, alias D) { enum Xreg = B; } __gshared ubyte[24] pseudoreg = Y!Xreg; // Mask to use for registers affected template Xmask(alias A, alias B, alias C, alias D) { enum Xmask = C; } __gshared regm_t[24] pseudomask = Y!Xmask; // Table for type of pseudo register variable template Xty(alias A, alias B, alias C, alias D) { enum Xty = mTYvolatile | D; } private __gshared const(tym_t)[24] pseudoty = Y!Xty; Please tell me this is not going to get into dmd :) templates are so much more expensive then macros. (Well, for now :) ) Those templates can and should be replaced by CTFE.
Re: An Issue I Wish To Raise Awareness On
On Thursday, July 20, 2017 07:40:35 Dominikus Dittes Scherkl via Digitalmars-d wrote: > On Wednesday, 19 July 2017 at 22:35:43 UTC, Jonathan M Davis > > wrote: > > The issue isn't the object being destroyed. It's what it refers > > to via its member variables. For instance, what if an object > > were to remove itself from a shared list when it's destroyed > > (e.g. because it's an observer in the observer pattern). The > > object has a reference to the list, but it doesn't own it. > > So, even a thread-local object that has references to a shared > list > has to handle those as shared, even in its non-shared destructor. > I can't follow your argument. You can't just strip off shared. To do so defeats the purpose of shared. If you have something like struct S { shared List _list; ~this() { ... } } then inside of the destructor, _list is not treated as shared, meaning that none of the compiler protections for shared are in place, no locking has occurred, and the compiler is free to make optimizations based on the wrong assumption that all of the member variables are thread-local. If nothing else has access to that list, then it'll work, but if anything else does - and if it's a reference type, that's perfectly possible - then you have a threading problem, because shared has been violated. Except in cases where the member variables are all value types and thus no other references to them should exist when the destructor is called, stripping away shared from them means that the compiler can no longer properly enforce shared, and it's going to make the wrong assumptions about whether the data can be treated as thread-local or not. If we go with the assumption that nothing has pointers to the member variables (since doing so would be @system, and they're only valid so long as the struct isn't moved anyway), you can probably strip off the outer layer of shared safely in the destructor, but if you're dealing with a reference type, anything it points to needs to still be treated as shared. - Jonathan M Davis
The X Macro using D
Some time ago, I wrote about the X Macro in C: https://digitalmars.com/articles/b51.html I used it from time to time in C code. It's one of the things I actually like about the C preprocessor. But in translating the aged C code to D it was time to make X work in D. Here's the C code, followed by the D translation. (I suppose it could be done with C++ templates, but I'll leave that to Andrei or Eric Niebler .) C Version // Macro trick to generate several parallel tables #define Y \ X("AH",4,mAX,TYuchar) \ X("AL",0,mAX,TYuchar) \ X("AX",8,mAX,TYushort) \ X("BH",7,mBX,TYuchar) \ X("BL",3,mBX,TYuchar) \ X("BP",13,0,TYushort) \ X("BX",11,mBX,TYushort) \ X("CH",5,mCX,TYuchar) \ X("CL",1,mCX,TYuchar) \ X("CX",9,mCX,TYushort) \ X("DH",6,mDX,TYuchar) \ X("DI",15,mDI,TYushort) \ X("DL",2,mDX,TYuchar) \ X("DX",10,mDX,TYushort) \ X("EAX",16,mAX,TYulong) \ X("EBP",21,0,TYulong) \ X("EBX",19,mBX,TYulong) \ X("ECX",17,mCX,TYulong) \ X("EDI",23,mDI,TYulong) \ X("EDX",18,mDX,TYulong) \ X("ESI",22,mSI,TYulong) \ X("ESP",20,0,TYulong) \ X("SI",14,mSI,TYushort) \ X("SP",12,0,TYushort) // Table for identifiers static const char *pseudotab[] = { #define X(id,reg,m,ty) id, Y #undef X }; // Register number to use in addressing mode unsigned char pseudoreg[] = { #define X(id,reg,m,ty) reg, Y #undef X }; // Mask to use for registers affected regm_t pseudomask[] = { #define X(id,reg,m,ty) m, Y #undef X }; // Table for type of pseudo register variable static unsigned char pseudoty[] = { #define X(id,reg,m,ty) mTYvolatile | ty, Y #undef X }; D Version /* 4 parallel tables using "X Macro" technique */ template Y(alias X) { enum Y = [ // id reg mask ty X!("AH", 4, mAX, TYuchar), X!("AL", 0, mAX, TYuchar), X!("AX", 8, mAX, TYushort), X!("BH", 7, mBX, TYuchar), X!("BL", 3, mBX, TYuchar), X!("BP", 13, 0, TYushort), X!("BX", 11, mBX, TYushort), X!("CH", 5, mCX, TYuchar), X!("CL", 1, mCX, TYuchar), X!("CX", 9, mCX, TYushort), X!("DH", 6, mDX, TYuchar), X!("DI", 15, mDI, TYushort), X!("DL", 2, mDX, TYuchar), X!("DX", 10, mDX, TYushort), X!("EAX", 16, mAX, TYulong), X!("EBP", 21, 0, TYulong), X!("EBX", 19, mBX, TYulong), X!("ECX", 17, mCX, TYulong), X!("EDI", 23, mDI, TYulong), X!("EDX", 18, mDX, TYulong), X!("ESI", 22, mSI, TYulong), X!("ESP", 20, 0, TYulong), X!("SI", 14, mSI, TYushort), X!("SP", 12, 0, TYushort), ]; } // Table for identifiers template Xtab(alias A, alias B, alias C, alias D) { enum Xtab = A; } private __gshared const(char)*[24] pseudotab = Y!Xtab; // Register number to use in addressing mode template Xreg(alias A, alias B, alias C, alias D) { enum Xreg = B; } __gshared ubyte[24] pseudoreg = Y!Xreg; // Mask to use for registers affected template Xmask(alias A, alias B, alias C, alias D) { enum Xmask = C; } __gshared regm_t[24] pseudomask = Y!Xmask; // Table for type of pseudo register variable template Xty(alias A, alias B, alias C, alias D) { enum Xty = mTYvolatile | D; } private __gshared const(tym_t)[24] pseudoty = Y!Xty;
[Issue 13039] combinations
https://issues.dlang.org/show_bug.cgi?id=13039 Sebchanged: What|Removed |Added CC||greensunn...@gmail.com --- Comment #2 from Seb --- See also: https://github.com/dlang/phobos/pull/4026 It has been reworked to mir.combinatorics and works in @nogc: http://docs.mir.dlang.io/latest/mir_combinatorics.html --
Re: static foreach is now in github master
On Thursday, 20 July 2017 at 20:33:47 UTC, Steven Schveighoffer wrote: On 7/20/17 4:08 PM, Seb wrote: On Thursday, 20 July 2017 at 19:53:46 UTC, Jack Stouffer wrote: On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote: https://is.gd/1TCQOh Hmmm, that code is printing 0 1 2 3 0 1 2 3 for me. Shouldn't it just be printing once? I bet you are using `rdmd`? It runs dmd twice on your main file ;-) See also: https://issues.dlang.org/process_bug.cgi https://github.com/dlang/tools/pull/191 https://github.com/dlang/tools/pull/194 (sadly this was reverted) I'm just clicking on the run button on the web page you linked to. How do I not run rdmd there? -Steve Oh because I thought run.dlang.io wasn't using `rdmd`. However, there was a minor glitch today when I added support for flags and stdin to the docker images [2]. The good news is that it has been fixed [2] & everything should behave as usual. Sorry for the inconvenience and continued happy hacking! [1] https://github.com/dlang-tour/core-exec/pull/2 [2] https://github.com/dlang-tour/core-exec/pull/4
Re: static foreach is now in github master
On 7/20/17 4:08 PM, Seb wrote: On Thursday, 20 July 2017 at 19:53:46 UTC, Jack Stouffer wrote: On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote: https://is.gd/1TCQOh Hmmm, that code is printing 0 1 2 3 0 1 2 3 for me. Shouldn't it just be printing once? I bet you are using `rdmd`? It runs dmd twice on your main file ;-) See also: https://issues.dlang.org/process_bug.cgi https://github.com/dlang/tools/pull/191 https://github.com/dlang/tools/pull/194 (sadly this was reverted) I'm just clicking on the run button on the web page you linked to. How do I not run rdmd there? -Steve
Re: static foreach is now in github master
On Thursday, 20 July 2017 at 19:53:46 UTC, Jack Stouffer wrote: On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote: https://is.gd/1TCQOh Hmmm, that code is printing 0 1 2 3 0 1 2 3 for me. Shouldn't it just be printing once? I bet you are using `rdmd`? It runs dmd twice on your main file ;-) See also: https://issues.dlang.org/process_bug.cgi https://github.com/dlang/tools/pull/191 https://github.com/dlang/tools/pull/194 (sadly this was reverted)
Re: static foreach is now in github master
On 7/20/17 3:53 PM, Jack Stouffer wrote: On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote: https://is.gd/1TCQOh Hmmm, that code is printing 0 1 2 3 0 1 2 3 for me. Shouldn't it just be printing once? I think it's because it's using rdmd, and that runs dmd once to generate dependencies, and one more time to compile. It's not specific to static foreach or the new compiler: https://is.gd/g6WPyv -Steve
[Issue 16431] rdmd runs dmd twice for single-files with no dependencies
https://issues.dlang.org/show_bug.cgi?id=16431 Sebchanged: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED |--- --- Comment #5 from Seb --- PR was reverted :/ --
Re: static foreach is now in github master
On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote: https://is.gd/1TCQOh Hmmm, that code is printing 0 1 2 3 0 1 2 3 for me. Shouldn't it just be printing once?
Re: Release D 2.075.0
On Wednesday, 19 July 2017 at 15:36:22 UTC, Martin Nowak wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 [...] Could you please create a post on reddit? Kind regards André
Re: proposed @noreturn attribute
On Wednesday, 19 July 2017 at 10:35:37 UTC, Stefan Koch wrote: On Wednesday, 19 July 2017 at 10:24:35 UTC, Marc Schütz wrote: On Sunday, 16 July 2017 at 20:44:13 UTC, Andrei Alexandrescu wrote: Perhaps we go the inverse route and define the bottom type as typeof(*null). Would that simplify matters? There is some good consistency about it: null: a pointer to anything. But can't be dereferenced. *null: well, therefore... anything. But can't be created. That sounds more like a top type, though, because as you said it can be "anything". A bottom type can not be anything, but only nothing. It's the bottom. Bottom is to Types, as Object is to Classes. Actually, Object should be considered the Top type. All Classes are sub-classes of Object.
Re: Array of Template instantiations
On Thursday, 20 July 2017 at 13:11:56 UTC, Alex wrote: On Thursday, 20 July 2017 at 12:33:43 UTC, Alex wrote: The Problem is, i dont know what type WHAT_TYPE is / i don´t know how to build a loopable something of futures. Ok, i think i understood now. my function `load` returns `KpiResponseEntity` so Future!(KpiResponseEntity)[] futures; seems to work To get the type you can also use `typeof`. alias ResponseType = typeof(async( , queryA )); ResponseType[] futures; futures ~= async( , queryA ); futures ~= async( , queryB ); futures ~= async( , queryC );
Re: How to replace pairs tags with regexp
Ali Thanks! I opened answer form before you answered me!
Re: Release D 2.075.0
On Thursday, 20 July 2017 at 12:10:14 UTC, Adrian Matoga wrote: On Thursday, 20 July 2017 at 07:19:03 UTC, Patrick Schluter wrote: version 2.067 that still had the C++ frontend took more than 100 seconds. I can hardly believe it. I remember versions 2.05x building in about 11 seconds. 1 cpu on 2.4 GHz Westmere, gcc 6.2 version 2.067
How to Select suitable PMDC Motor?
At the point when the engine is working, curls and commutator pivot, be that as it may, magnet and brushes don't turn. The substituting curl current is pivoted with the assistance of the engine commutator and the brushes. As the voltage rises, the brush dc engine speed increments as well. The engine needs legitimate torque and speed to work with the most elevated effectiveness. All in all, how to discover which sort is the best decision for the venture? In light of cost and working application necessities, pick the accompanying elements: Engine Diameter To start with, you have to coordinate the engine distance across to the accessible work space. Engine distance across ranges from 8mm to 120mm. Generally, vast edge estimated engines have higher torque yield. ( an example from http://www.powerjackmotion.com/product-category/electric-motor/pmdc-motor-range/ ) Length The engine length ranges from 16 mm to 70 mm. Brush Carbon brush incorporates graphite, the Baptist oil graphite, and metals (copper, silver) graphite. Bearing Diverse sorts of heading are utilized for high pivotal or spiral load applications. Magnet Neodymium magnets (NdFeB magnets) give higher yield torque anyway they are costly. In spite of the fact that Ferrite magnets have great temperature resistance and minimal effort, their execution is generally direct. All things considered, they have turned into the most generally utilized changeless magnets. For more data, visit our electric engine parts choice. Winding It decides voltage, resistance, and torque consistent choice. We pick just great quality materials of immaculate copper winding. The 12V, 24V, 48V, and 90V DC engine sorts are exceptionally prominent and utilized frequently. Any better idea highly appreciates. Thanks Mark
Re: Release D 2.075.0 does not install on Windows 10 with VS2017
On Thursday, 20 July 2017 at 17:44:29 UTC, Jolly James wrote: On Thursday, 20 July 2017 at 16:28:54 UTC, jan wrote: seems like i am not the first one to have that problem. please fix. everything working fine from here :) Maybe you should state what exactly is not working for you and paste some error messages... +1 As a gentle reminder, the announce NG is __not__ meant for reporting issues. Please use the bugtracker - otherwise your issue might not be seen by the concerning volunteers: http://dlang.org/bugstats.html
Re: How to replace pairs tags with regexp
Question above do not actual now. Now I have got next problem. import std.stdio; import std.regex; import std.file; void main() { auto text = "#Header my header text ##SubHeader my sub header text ###Sub3Header my sub 3 text #Header2 my header2 text"; auto l1 = regex(`(^|\n)#([^#]*)\n([\^]*)(?=\n#[^#]|$)`, ['g', 'm']); foreach(t; text.matchAll(l1)) { writeln(t.hit); } } This code is print to console: #Header my header text How can I modify regex to get it print: #Header my header text ##SubHeader my sub header text ? I tried different combination, some of them are working in online regexp editors, but do not working in D.
Re: How to replace pairs tags with regexp
On 07/20/2017 06:39 AM, Suliman wrote: I have got next code: import std.stdio; import std.regex; import std.file; void main() { auto text = readText("book.txt"); auto inlineCodeBlock = regex("`([^`\n]+)`"); auto bigCodeBlock = regex(r"`{3}[\s\S]*?`{3}"); foreach(t; text.matchAll(bigCodeBlock)) { string t1 = t.hit.replaceFirst(regex("`"),``); string t2 = t1.replaceFirst(regex("`"),``); } } Here I am replacing `foo` to foo. But got replaced data as copy, not in original document. But I need to get replacing in original document. replaceAll is not suitable for it because it's not clear how to get open and close tags ( and ). It's not guaranteed that the original document have space for the modifications. I recommend outputting to a new place. This one build the output in memory, hoping that it will fit: import std.stdio; import std.regex; import std.array; void main() { auto text = q"END first line ``` void main() { } ``` last line END"; auto bigCodeBlock = regex(r"`{3}([\s\S]*?)`{3}"); auto result = appender!string; replaceAllInto(result, text, bigCodeBlock, "$1"); writeln(result.data); } Outputs: first line void main() { } last line Ali
Re: Release D 2.075.0 does not install on Windows 10 with VS2017
On Thursday, 20 July 2017 at 16:28:54 UTC, jan wrote: seems like i am not the first one to have that problem. please fix. everything working fine from here :) Maybe you should state what exactly is not working for you and paste some error messages...
Re: D easily overlooked?
On Thursday, 20 July 2017 at 17:04:14 UTC, Wulfklaue wrote: On Thursday, 20 July 2017 at 16:15:43 UTC, porter wrote: i did the same, but use for windows programs AWD Modula. its free, compiles fast and is used commercially. AWD Modula? You mean Modula 2? yes https://www.modula2.org/adwm2/
Re: Update to Bare Metal STM32F4 (ARM Cortex-M4) LCD Demo Proof of Concept
Thanks for your work with bare metal MCUs! I am dreaming that someday I can program smart house IoT automation on D.
Re: D easily overlooked?
On Thursday, 20 July 2017 at 16:15:43 UTC, porter wrote: i did the same, but use for windows programs AWD Modula. its free, compiles fast and is used commercially. AWD Modula? You mean Modula 2?
Re: opEquals nothrow
On Thursday, 20 July 2017 at 15:10:24 UTC, Aldo wrote: On Thursday, 20 July 2017 at 14:59:50 UTC, Steven Schveighoffer wrote: On 7/20/17 10:38 AM, Aldo wrote: Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple comparison between 2 objects. How to make opEquals nothrow ? You can't. Object.opEquals is not nothrow, so object.opEquals is not nothrow (note the former is the virtual member function, the latter is a global function which is what the compiler actually calls). It is a legacy limitation. Until we get rid of all the Object base methods for things like opEquals and toHash, we will not be able to fix this. -Steve Im using DerelictGLFW3, to process events im doing this : glfwSetMouseButtonCallback(window, ); onMouseClick function must be nothrow. But now I can't do anything in this function because I can't convert my code to nothrow. Can I put a try catch in the body ? extern(C) nothrow { void onMouseClick(GLFWwindow* window, int button, int action, int d) { try { // my code } catch { } } } it seems its working but what about performances ? thanks You could also try assumeWontThrow. https://dlang.org/library/std/exception/assume_wont_throw.html
Release D 2.075.0 does not install on Windows 10 with VS2017
seems like i am not the first one to have that problem. please fix.
Re: Work on ARM backend for DMD started
On Friday, 7 July 2017 at 11:09:27 UTC, Temtaime wrote: DMD is a piece of shit, and adding another one ARM backend with all those bugs and low performance instead of improving ldc is wasting efforts. The only use of dmd is development because of compilation speed. But some persons have "cerveau lent" and just cannot realise it. A few things you should be aware before you trash the reference compiler for D: - Most of DMD's frontend and the part of the backend is in D. This means better productivity in the long run, especially once the whole of the backend is ported to D. - Well, it's the reference compiler. I understand that you would like to see many of the devs on DMD to move towards LDC instead. I myself like some healthy competition. - The performance issues can be fixed in the long run. I myself thinking on fixing some of the issues of DMD, like the SIMD support (might end up in issuing a DIP for better support the hardware functions). I think first I might learn how the current codegen works, issue some improvements, as learning how the arm architecture works is a hard work, I don't even know what to do with condition codes (ignore them completely, or use them in certain situations to save a few conditional jump?), thumb (yet another attribute to force the compiler to use thumb for the part of the code?), etc. I'll recycle some of the preexisting code which was made by another user.
Re: D easily overlooked?
On Thursday, 20 July 2017 at 15:40:04 UTC, Wulfklaue wrote: Windows: Download, install, runs. It integrates perfectly with the Visual Studio Code plugin. Linux a simple apt-get command. No need to download a deb or run a shell script. i did the same, but use for windows programs AWD Modula. its free, compiles fast and is used commercially. i QUIT on D, since you can't install and use, for all the reasons you describe. a consequence for me was to warn people at work to use it.
Re: D easily overlooked?
On Thursday, 20 July 2017 at 15:40:04 UTC, Wulfklaue wrote: After going back recently to good old Pascal. More specific the freepascal compiler combined with Visual Studio Code + Omnipascal, ... it felt just more easy. In a few days time after reading up all the details, i got myself a nice multithreaded http server build without using any standardized framework. Sure it is missing a lot of functionality but i felt more proud writing it in Pascal, then i did writing the same in D The easy to write cross platform Dlls. The more clean design to use those DLL loading without relying on dlsym all the time. The time wasted trying to figure that out in D to get it working correctly. *uch* ... While the language is indeed more "verbose" ( not that much ), the compiler does less checking, it just is more "fun". D feels more like work. Now it also helps that there is massive amount of more documentation for pascal out there, even if its old. At the same Pascal compiles in 0.1 second, give me the speed similar(actually faster) than D, cross platform support, no need to mess with different compiler ( dmd for compile, ldc for speed ). Its even more TTD then D :) Windows: Download, install, runs. It integrates perfectly with the Visual Studio Code plugin. Linux a simple apt-get command. No need to download a deb or run a shell script. i did the same, but use for windows programs AWD Modula. its free, compiles fast and is used commercially. i QUIT on D, since you can't install and use, for all the reasons you describe. a consequence for me was to warn people at work to use it.
WebConfig - a vibe.d HTML form generator & validator from D structs
I just released a vibe.d library that allows you to turn any D struct into an editable HTML5 compatible form with live JS updates but also normal no-JS updates with nearly the same experience. It basically feels like you don't need to write any boilerplate HTML code anymore but instead write D and show your D code with a fancy mask automatically to the user. Additionally it handles all the validation for you so you can be sure that anything the user couldn't type in into the HTML frontend won't be stored inside the backend struct (validation & some corrections for all HTML5 input types). It supports numerous data types as input types: * string - type="text" (there are UDAs to also change the type of a string to email, url, time, week, month, datetime-local, date, color or textarea) * bool - type="checkbox" * enum - a dropdown list (select) or with an UDA a list of radio elements * BitFlags!enum - a list of checkbox elements * DateTime (not SysTime) which is a timezone-less Date & Time combination, can be done with a string too * Date - type="date", can be done with a string too * TimeOfDay - type="time", can be done with a string too * URL (vibe.d) - type="url", can be done with a string too * integer & floating point types - type="number" or with an UDA type="slider" the input names are automatically generated by the variable name (myInputName or my_input_name -> My Input Name) but can also be renamed and with v1.1.0 also translated (i18n) using the upcoming "language" property in vibe.d WebInterfaces, you can depend on vibe.d ~master to use it already now, otherwise everything will default to one language for now. You can also translate or rename enum values with these UDAs (sadly you need to attach them on the member variable because enums can't have UDAs attached to them) which is great for having a large variety of supported languages on your website. A use case for the package is for example a user setting: A user accesses GET /settings and your app looks up the user account and the settings struct saved with it, then just passes the struct without any other obstacles into renderSettings() and it will output prefilled HTML + JS for the user to edit. You just need to accept POST /settings and POST /api/setting and pass both of them into req.processSettings(ref config) which does everything for you. Then it will return a bitfield of changed values (up to 64 fields) that you can check if you actually need to save the updated config. On the no-js version you will also pass that bitfield into the renderer and it will show error strings with it. Another use case would be a small game server front end configuration without a lot of thought or changes needing to go into it. Just send the struct through the render and process functions and don't care about validation and HTML. By default there is no CSS but the layout is very simple (check the GitHub README), but I have a simple material design CSS template you can use if you want a quick and simplistic UI for your form. I haven't covered everything the UDAs allow you to do yet or how you can customize the HTML generation, etc. but you can check out the Documentation[1] and the GitHub repository[2] to find out more. Install the package: dub.json "web-config": "~>1.1.0" dub.sdl dependency "web-config" version="~>1.1.0" DUB Page: http://web-config.dub.pm [1] https://webfreak001.github.io/WebConfig/package.html [2] https://github.com/WebFreak001/WebConfig
Re: opEquals nothrow
On Thursday, 20 July 2017 at 15:10:24 UTC, Aldo wrote: extern(C) nothrow { void onMouseClick(GLFWwindow* window, int button, int action, int d) { try { // my code } catch { } } } Tangent but an easy way of nothrowing: extern(C) nothrow { void onMouseClick(GLFWwindow* window, int button, int action, int d) { scope(failure) return; // my throwing code } } or scope(failure) return -1; if working with error codes.
Re: D easily overlooked?
On Sunday, 16 July 2017 at 08:37:53 UTC, Ecstatic Coder wrote: I sincerely appreciate the effort, really, but admit that there is still a HUGE difference between how D and more popular languages like Python, Go, etc are advertised. I'm still not convinced that D's way is the best in order to significantly improve its popularity among developers... After going back recently to good old Pascal. More specific the freepascal compiler combined with Visual Studio Code + Omnipascal, ... it felt just more easy. In a few days time after reading up all the details, i got myself a nice multithreaded http server build without using any standardized framework. Sure it is missing a lot of functionality but i felt more proud writing it in Pascal, then i did writing the same in D The easy to write cross platform Dlls. The more clean design to use those DLL loading without relying on dlsym all the time. The time wasted trying to figure that out in D to get it working correctly. *uch* ... While the language is indeed more "verbose" ( not that much ), the compiler does less checking, it just is more "fun". D feels more like work. Now it also helps that there is massive amount of more documentation for pascal out there, even if its old. My system needs a dozen core design implementations. Finding the base code for half, in Pascal took me a day. In D it took weeks of searching and trying to understand ( and a lot i do not have ) and i still have less code examples then pascal. At the same Pascal compiles in 0.1 second, give me the speed similar(actually faster) than D, cross platform support, no need to mess with different compiler ( dmd for compile, ldc for speed ). Its even more TTD then D :) Windows: Download, install, runs. It integrates perfectly with the Visual Studio Code plugin. Linux a simple apt-get command. No need to download a deb or run a shell script. It just more user friendly in a strange way. I feel like i can talk hours about Pascal but D feels so C++ like. Maybe that is why its hard to accept. The point that Ecstatic Coder has been trying to make for a long time. D for all its merits feels at times ... do not know how to express.
Re: opEquals nothrow
On 7/20/17 11:10 AM, Aldo wrote: On Thursday, 20 July 2017 at 14:59:50 UTC, Steven Schveighoffer wrote: On 7/20/17 10:38 AM, Aldo wrote: Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple comparison between 2 objects. How to make opEquals nothrow ? You can't. Object.opEquals is not nothrow, so object.opEquals is not nothrow (note the former is the virtual member function, the latter is a global function which is what the compiler actually calls). It is a legacy limitation. Until we get rid of all the Object base methods for things like opEquals and toHash, we will not be able to fix this. Im using DerelictGLFW3, to process events im doing this : glfwSetMouseButtonCallback(window, ); onMouseClick function must be nothrow. But now I can't do anything in this function because I can't convert my code to nothrow. Can I put a try catch in the body ? Yes. extern(C) nothrow { void onMouseClick(GLFWwindow* window, int button, int action, int d) { try { // my code } catch { } } } it seems its working but what about performances ? As long as you don't have any code that throws, it should be pretty close to optimal. -Steve
Re: How to debug in vscode with mago-mi?
On Monday, 17 July 2017 at 08:44:46 UTC, Domain wrote: Could anyone show me how to debug in vscode with mago-mi? I have installed vscode with Native Debug, SDLang. I have tried dlang-vscode and code-d. [...] Is the application actually being put in bin/app.exe? Also try a different debugger (the windows debugger from the C/C++ Extension by Microsoft which uses the visual studio debugger is quite good)
[Issue 13806] std.bitmanip.BitArray -- use of methods named init() messes up templates
https://issues.dlang.org/show_bug.cgi?id=13806 RazvanNchanged: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |FIXED --- Comment #7 from RazvanN --- This seems to have been solved. If there are other cases of init abuse, one can always file a new bug report. Closing as fixed. --
[Issue 14098] std.typecons.wrap should allow wrapping a struct
https://issues.dlang.org/show_bug.cgi?id=14098 RazvanNchanged: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |FIXED --- Comment #2 from RazvanN --- It looks like this have been merged. Closing --
Re: opEquals nothrow
On Thursday, 20 July 2017 at 14:59:50 UTC, Steven Schveighoffer wrote: On 7/20/17 10:38 AM, Aldo wrote: Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple comparison between 2 objects. How to make opEquals nothrow ? You can't. Object.opEquals is not nothrow, so object.opEquals is not nothrow (note the former is the virtual member function, the latter is a global function which is what the compiler actually calls). It is a legacy limitation. Until we get rid of all the Object base methods for things like opEquals and toHash, we will not be able to fix this. -Steve Im using DerelictGLFW3, to process events im doing this : glfwSetMouseButtonCallback(window, ); onMouseClick function must be nothrow. But now I can't do anything in this function because I can't convert my code to nothrow. Can I put a try catch in the body ? extern(C) nothrow { void onMouseClick(GLFWwindow* window, int button, int action, int d) { try { // my code } catch { } } } it seems its working but what about performances ? thanks
Re: opEquals nothrow
On 7/20/17 10:38 AM, Aldo wrote: Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple comparison between 2 objects. How to make opEquals nothrow ? You can't. Object.opEquals is not nothrow, so object.opEquals is not nothrow (note the former is the virtual member function, the latter is a global function which is what the compiler actually calls). It is a legacy limitation. Until we get rid of all the Object base methods for things like opEquals and toHash, we will not be able to fix this. -Steve
Re: opEquals nothrow
On Thursday, 20 July 2017 at 14:38:03 UTC, Aldo wrote: Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple comparison between 2 objects. How to make opEquals nothrow ? thanks Could you show some code.
[Issue 17664] Deprecate implicit casting between shared and unshared
https://issues.dlang.org/show_bug.cgi?id=17664 --- Comment #3 from Steven Schveighoffer--- Making a complete independent copy of a value is not sharing, it's copying. shared doesn't care about the semantic meaning of your integer. It only cares if multiple threads have access to the same memory in RAM. That's its only goal. Anything above that is on you to provide appropriate protections. In other words, don't use int handle, use some UnshareableResource struct that protects the handle internally from accidentally sharing. --
Re: Release D 2.075.0
wow, how nice - but it is not installed correctly with VS2017. While installing, i am told that 64bit will not work. what a SH.T you guys should get your act together - just once. it's always a real experience to install software and have problems. Nice experience!!
opEquals nothrow
Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple comparison between 2 objects. How to make opEquals nothrow ? thanks
Re: If Statement with Declaration
On Thursday, 20 July 2017 at 14:18:48 UTC, Jack Stouffer wrote: On Thursday, 20 July 2017 at 14:05:36 UTC, Iakh wrote: It is not about reduce number of lines. It is about binding related things in one statement. Even so, it's already been shown in this thread that the same effect can be achieved via a block statement (doing exactly what it was designed for) This decreases readability by splitting up parts that (the programmer wants to) semantically belong together. or with a for loop. Which is a hack decreasing readability, because it works opposite to what one generally expects when reading a looping control structure. It's an small increase in terseness for a decrease in readability and an increase in complexity. W.r.t to the `with` solution only: It's a noticeable increase in readability for a minor increase in complexity.
Re: If Statement with Declaration
On Thursday, 20 July 2017 at 14:05:36 UTC, Iakh wrote: It is not about reduce number of lines. It is about binding related things in one statement. Even so, it's already been shown in this thread that the same effect can be achieved via a block statement (doing exactly what it was designed for) or with a for loop. It's an small increase in terseness for a decrease in readability and an increase in complexity.
Re: Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote: Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from Base. However, this is not the case: main.d(6): Error: class main.Derived cannot implicitly generate a default ctor when base class main.Base is missing a default ctor Is it a bug or it should be like this? Interesting that the same code without immutable works.
Re: If Statement with Declaration
On Wednesday, 19 July 2017 at 15:41:18 UTC, Jack Stouffer wrote: On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? To be frank, I don't think that helping the programmer reduce the line count in their program by one line is worth further complicating the language. It is not about reduce number of lines. It is about binding related things in one statement.
Re: If Statement with Declaration
On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I'd prefer a new variant of `with`: with (int i = someFunc()) if (i >= 0) { // use i } It's slightly more verbose, but the meaning is clearer (arguable). It extends automatically to other control structures like `switch`. I wouldn't have this new `with (declaration)` have the magic lookup rules of the existing `with (expression)`. It would be a simpler tool that I'd probably use more than the existing `with`. I like "with" variant. Very mach like haskells "where". I believe it would be cool with expressions. Even can emulate named function arguments with (const skip_comments = false, const skip_empty_line = true) auto diff_result = diff(textA, textB, skip_comments, skip_empty_line);
Re: struct constructors and destructors.
On Wednesday, 19 July 2017 at 14:09:32 UTC, SrMordred wrote: Hm, isnt that wrong? Did my post even go through? http://forum.dlang.org/post/udaxeyujrafklzpww...@forum.dlang.org What's going on here is actually pretty simple. Though calling a destructor on a default-initialized struct should always be valid anyway.
Re: Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote: Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from Base. However, this is not the case: main.d(6): Error: class main.Derived cannot implicitly generate a default ctor when base class main.Base is missing a default ctor Is it a bug or it should be like this? I'd say it's a bug. There was a similar issue at one point where it wouldn't consider default constructor with default args.
[Issue 17664] Deprecate implicit casting between shared and unshared
https://issues.dlang.org/show_bug.cgi?id=17664 --- Comment #2 from anonymous4--- The idea that sharing is opt out contradicts the idea behind shared qualifier. --
How to replace pairs tags with regexp
I have got next code: import std.stdio; import std.regex; import std.file; void main() { auto text = readText("book.txt"); auto inlineCodeBlock = regex("`([^`\n]+)`"); auto bigCodeBlock = regex(r"`{3}[\s\S]*?`{3}"); foreach(t; text.matchAll(bigCodeBlock)) { string t1 = t.hit.replaceFirst(regex("`"),``); string t2 = t1.replaceFirst(regex("`"),``); } } Here I am replacing `foo` to foo. But got replaced data as copy, not in original document. But I need to get replacing in original document. replaceAll is not suitable for it because it's not clear how to get open and close tags ( and ).
Re: Array of Template instantiations
On Thursday, 20 July 2017 at 12:33:43 UTC, Alex wrote: The Problem is, i dont know what type WHAT_TYPE is / i don´t know how to build a loopable something of futures. Ok, i think i understood now. my function `load` returns `KpiResponseEntity` so Future!(KpiResponseEntity)[] futures; seems to work
Re: If Statement with Declaration
On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I'd prefer a new variant of `with`: with (int i = someFunc()) if (i >= 0) { // use i } It'd be nice to have either of these available in D, though I'd prefer the `with` one, since - `with` is currently not widely used - usually only for things like `switch (var) with (EnumName) {...}`; this would make `with` pull its own weight (so to speak) - I think it is way easier to read
Make sure that every function in Phobos has a public example
Examples are a great way to explore functions on Phobos. They provide an intuitive, playful alternative to reading the docs - especially now that they are interactive [1]. They are so important that people even report bugs if they don't exist [2]. However, Phobos still doesn't come with a (public) unittest for every function. So, do you have ten minutes to improve Phobos and "unittestify" a module? This doesn't require in-depth knowledge of Phobos and is a great way to get started with Phobos's codebase. The workflow is rather easy: 1) Pick a module from the blacklist [3] 2) Remove it from the blacklist 3) Run DScanner: `make -f posix.mak dscanner` 4) Add public unittest to the missing places (A public unittest is marked with a /// comment) 5) Run the test of the module to see if your new examples are correct: With the newest compiler: dmd -unittest -run std/foo.d Otherwise:make -f posix.mak std/foo.test 6) Create a branch, commit your work & send a pull request 7) GOTO easy; I went ahead and set a good example: https://github.com/dlang/phobos/pull/5581 Of course, each module can be a separate PR as well. Let me know if you have questions or run into troubles. For example, on Ubuntu 16.10 and Arch Linux, you need to use PIC=1 (e.g. make -f posix.mak dscanner PIC=1) to compile the examples (at least until [4] is merged). Current blacklist [3] - has_public_example="-etc.c.curl,-etc.c.sqlite3,-etc.c.zlib,-std.bitmanip,-std.complex,-std.concurrency,-std.container.array,-std.container.dlist,-std.container.rbtree,-std.container.slist,-std.conv,-std.csv,-std.datetime,-std.datetime.date,-std.datetime.interval,-std.datetime.stopwatch,-std.datetime.systime,-std.datetime.timezone,-std.demangle,-std.digest,-std.digest.hmac,-std.digest.murmurhash,-std.digest.sha,-std.encoding,-std.exception,-std.experimental.allocator,-std.experimental.allocator.building_blocks.allocator_list,-std.experimental.allocator.building_blocks.bitmapped_block,-std.experimental.allocator.building_blocks.fallback_allocator,-std.experimental.allocator.building_blocks.free_list,-std.experimental.allocator.building_blocks.free_tree,-std.experimental.allocator.building_blocks.null_allocator,-std.experimental.allocator.building_blocks.stats_collector,-std.experimental.allocator.common,-std.experimental.allocator.mmap_allocator,-std.experimental.allocator.typ! ed,-std.experimental.checkedint,-std.experimental.logger.core,-std.experimental.logger.filelogger,-std.experimental.logger.multilogger,-std.experimental.typecons,-std.file,-std.format,-std.getopt,-std.internal.math.biguintcore,-std.internal.math.biguintnoasm,-std.internal.math.errorfunction,-std.internal.math.gammafunction,-std.internal.scopebuffer,-std.internal.test.dummyrange,-std.json,-std.math,-std.mathspecial,-std.mmfile,-std.net.curl,-std.net.isemail,-std.numeric,-std.outbuffer,-std.parallelism,-std.path,-std.process,-std.random,-std.range,-std.range.interfaces,-std.range.primitives,-std.regex,-std.regex.internal.ir,-std.socket,-std.stdio,-std.string,-std.traits,-std.typecons,-std.uni,-std.uri,-std.utf,-std.uuid,-std.variant,-std.xml,-std.zip,-std.zlib" [1] https://dlang.org/blog/2017/03/08/editable-and-runnable-doc-examples-on-dlang-org [2] https://issues.dlang.org/show_bug.cgi?id=17670 [3] https://github.com/dlang/phobos/blob/master/.dscanner.ini#L123 [4] https://github.com/dlang/phobos/pull/5586
Array of Template instantiations
Hi, i don't even know if the subject makes any sense :) What i want to achieve is: instead of making: auto v_a = async( , queryA ); auto v_b = async( , queryB ); auto v_c = async( , queryC ); ( async is a function from vibe and returns a "Future" - see http://vibed.org/api/vibe.core.concurrency/async for the async ) i want to something like this: WHAT_TYPE[] futures; futures ~= async( , queryA ); futures ~= async( , queryB ); futures ~= async( , queryC ); And then collect the results somwhere later like: foreach(WHAT_TYPE future ; futures) { writeln( future.getResult() ); } The Problem is, i dont know what type WHAT_TYPE is / i don´t know how to build a loopable something of futures.
Update to Bare Metal STM32F4 (ARM Cortex-M4) LCD Demo Proof of Concept
A few years ago I created a bare metal demo on an ARM Cortex-M4 microcontroller entirely in D. It was just a demonstration that one could do bare metal programming for microcontrollers in D without any dependencies on C or assembly. It was also a proof of some ideas I had about leveraging compile-time features of D to generate highly-optimized code (both small and fast) for these resource constrained systems. I hit a wall, however, with Issue 14758[0], and ultimately abandoned D for other alternatives. Well, that issue was recently fixed in GDC [1]. In addition, he GDC developers did some work to reduce the number of phony stubs one had to add to the runtime to get a build [2], removed the "shared is volatile" hack, and implemented the `volatileLoad/Store` intrinsics so I no longer need to do volatile access in assembly. So, I decided to give it another try, and updated that demo. You can see the results at https://github.com/JinShil/stm32f42_discovery_demo A few observations: * It is a better experience than it was a few years ago. Fewer dirty hacks are required, and the resulting binary is small and fast. * Everything is in D (inline assembly is D). There's no need for any C or assembly startup code, and no need for silly things like -betterC (i.e. -worseD). If you don't want the overhead from a feature of D, don't use it. * Compile times are quite slow (about 1 minute to get a 3kB binary). Some discussion about that is taking place on the GDC forum [4]. * -O2 and -O3 give me a broken binary, but -O0, -O1, and -Os work well. I'm not sure where I'll go from here. I'm interested in helping an amputee play the drums again, and building my own mechanical keyboard, so I probably won't be spending much more time on this LCD demo, except maybe to help compiler devs debug some issues. However, I might spend some more time with D in the near future, and see how far I can take this. I'm still not as excited as I once was, but it's nice to see these improvements. Anyway, Well done, GDC! Mike [0] - TypeInfo causes excessive binary bloat - https://issues.dlang.org/show_bug.cgi?id=14758 [1] - Put the TypeInfo name field into a static var - https://github.com/D-Programming-GDC/GDC/pull/505 [2] - Refactor and reformat typeinfo.cc - https://github.com/D-Programming-GDC/GDC/pull/456 [3] - Slow compile-time discussion at GDC forum - http://forum.dlang.org/post/iqryqssxooypdnszm...@forum.dlang.org
Re: If Statement with Declaration
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? This doesn't enable anything new, and breaks readability conventions.
Re: Release D 2.075.0
On Thursday, 20 July 2017 at 07:19:03 UTC, Patrick Schluter wrote: version 2.067 that still had the C++ frontend took more than 100 seconds. I can hardly believe it. I remember versions 2.05x building in about 11 seconds.
Re: proposed @noreturn attribute
On 20.07.2017 00:21, Tobias Müller wrote: Timon Gehrwrote: [...] What I am saying is: in a language with a bottom type, we can create a function: T f(T)(Bottom b){ return b; // assuming b converts to all types implicitly. } Within the function body, b is a value of type Bottom. We use a value of type Bottom to create a value of any type we want. As I understand it, you can create *variables* of type Bottom but not *values*. Correct. b is a variable, not a value, Within the function body, it is. you cannot actually call that function at runtime. Correct.
[Issue 17671] std.format example is not compiles
https://issues.dlang.org/show_bug.cgi?id=17671 Sebchanged: What|Removed |Added Status|NEW |RESOLVED CC||greensunn...@gmail.com Resolution|--- |FIXED --- Comment #1 from Seb --- Thanks a lot for reporting this issue. We do have a pipeline in place, s.t. all runnable examples are automatically checked: http://dlang.org/blog/2017/03/08/editable-and-runnable-doc-examples-on-dlang-org However, in this case the example changed from 2.074.0 to 2.075.0 as a new feature ws introduced and the daily cron to update the backend didn't run yet. I manually updated it now and everything works again: Run the example: https://is.gd/b3UxtJ See the change that introduced it for 2.075.0: https://github.com/dlang/phobos/commit/cc8eff102f4ddcf15c4def1a5b87786c3040689d --
[Issue 17672] Example from std.format throws exceptions
https://issues.dlang.org/show_bug.cgi?id=17672 Sebchanged: What|Removed |Added Status|NEW |RESOLVED CC||greensunn...@gmail.com Resolution|--- |FIXED --- Comment #1 from Seb --- Thanks a lot for reporting this issue. We do have a pipeline in place, s.t. all runnable examples are automatically checked: http://dlang.org/blog/2017/03/08/editable-and-runnable-doc-examples-on-dlang-org However, in this case the example changed from 2.074.0 to 2.075.0 as a new feature ws introduced and the daily cron to update the backend didn't run yet. I manually updated it now and everything works again: Run the example: https://is.gd/b3UxtJ See the change that introduced it for 2.075.0: https://github.com/dlang/phobos/commit/cc8eff102f4ddcf15c4def1a5b87786c3040689d --
[Issue 17670] Std.bitmanip module has no (runnable) examples
https://issues.dlang.org/show_bug.cgi?id=17670 Sebchanged: What|Removed |Added CC||greensunn...@gmail.com --- Comment #1 from Seb --- FYI: There is a DScanner check has_public_example which is already partially enabled. However, the blacklist of modules still exists. For an example on how trimming down works: https://github.com/dlang/phobos/pull/5581 --
Re: If Statement with Declaration
On Wednesday, 19 July 2017 at 20:42:33 UTC, Steven Schveighoffer wrote: I remember reading a discussion about using with statements to do this earlier as well, but I can't find it. -Steve I don't think this is the discussion you're talking about, but this does bring DIP 1005 to mind: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1005.md Personally, I'm in favor of `with` for both variable declarations and imports. It's pretty intuitive semantically.
[Issue 1998] std.bitarray should have setAll / opSliceAssign(bool) etc
https://issues.dlang.org/show_bug.cgi?id=1998 RazvanNchanged: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #2 from RazvanN --- PR : https://github.com/dlang/phobos/pull/5634 --
Re: An Issue I Wish To Raise Awareness On
On Thursday, 20 July 2017 at 10:19:30 UTC, Kagamin wrote: On Thursday, 20 July 2017 at 07:40:35 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 19 July 2017 at 22:35:43 UTC, Jonathan M Davis wrote: The issue isn't the object being destroyed. It's what it refers to via its member variables. For instance, what if an object were to remove itself from a shared list when it's destroyed (e.g. because it's an observer in the observer pattern). The object has a reference to the list, but it doesn't own it. So, even a thread-local object that has references to a shared list has to handle those as shared, even in its non-shared destructor. I can't follow your argument. Thread local object can't be contained in a shared list, the list is referred as unqualified, and thread local object will be contained in a thread local list, and shared object will be contained in a shared list because of transitivity of the shared qualifier. It's the other way around: ThreadLocal tl; struct ThreadLocal { shared(ListNode*)* listHead; shared(ListNode)* listNode; ~this() { listHead.removeNodeFromList(listNode); } }