Re: Antipattern in core.memory.GC.addRange?
On Friday, 22 September 2017 at 21:29:10 UTC, Steven Schveighoffer wrote: GC.addRange has this signature: static nothrow @nogc void addRange(in void* p, size_t sz, const TypeInfo ti = null); I see a large problem with this. Let's say you malloc an array of struct pointers: struct Foo { ... } import core.stdc.stdlib; auto ptrs = (cast(Foo *)malloc(Foo.sizeof * 10))[0 .. 10]; Now, you want to store GC pointers in that block, you need to add the range to the GC: GC.addRange(ptrs.ptr, ptrs.length); See the problem? Yes, you forgot to multiply by Foo.sizeof. Using the pattern from the example in the documentation, the code would be: size_t bytes = Foo.sizeof * 10; auto ptrs = (cast(Foo *)malloc(bytes))[0 .. 10]; GC.addRange(ptrs.ptr, bytes);
[Issue 17596] dmd d 2.073.2 and 2.074.1 interim generated dmd segfaults on FreeBSD 12-CURRENT
https://issues.dlang.org/show_bug.cgi?id=17596 --- Comment #10 from Cy Schubert--- Sorry about the absence. Too many projects, this one happened to be pushed down the stack. I'm looking at this again. --
Re: Dub use local fork
On Saturday, 23 September 2017 at 03:13:15 UTC, Nicholas Wilson wrote: my dub.selections.json is currently: { "fileVersion": 1, "versions": { "derelict-cl": "2.0.0", "derelict-cuda": "2.0.1", "derelict-util": "2.1.0", "taggedalgebraic": "0.10.7" } } I want derelict-cl to use C:\Users\me\Documents\GitHub\DerelictCL How do I do that? http://code.dlang.org/package-format?lang=json#version-specs "derelict-cl": { "path": "C:/Users/me/Documents/GitHub/DerelictCL" }
Re: Dub use local fork
On 23/09/2017 4:13 AM, Nicholas Wilson wrote: I want to use a fork of one of my dub dependencies so I can make sure that it works before I merge the fork into upstream. http://code.dlang.org/advanced_usage says Path-based dependencies Package descriptions in the dub.json/dub.sdl can specify a path instead of a version; this can be used with Git submodules or subtrees, or with a known directory layout, to use arbitrarily defined versions of a dependency. Note that this should only be used for non-public packages. Path-based selections You can specify arbitrary versions, branches, and paths in the dub.selections.json file, even if they contradict the dependency specification of the packages involved (note that DUB will output a warning in that case). but doesn't give any examples. my dub.selections.json is currently: { "fileVersion": 1, "versions": { "derelict-cl": "2.0.0", "derelict-cuda": "2.0.1", "derelict-util": "2.1.0", "taggedalgebraic": "0.10.7" } } I want derelict-cl to use C:\Users\me\Documents\GitHub\DerelictCL How do I do that? Thanks Nic Alternatively you can alter the package that dub already knows about. Does the trick more easily ;)
[Issue 17851] htonl already defined in phobos64.lib
https://issues.dlang.org/show_bug.cgi?id=17851 --- Comment #1 from Heromyth--- It seems these functions have been defined in Ws2_32.lib, see https://msdn.microsoft.com/en-us/library/windows/desktop/ms738556(v=vs.85).aspx --
Dub use local fork
I want to use a fork of one of my dub dependencies so I can make sure that it works before I merge the fork into upstream. http://code.dlang.org/advanced_usage says Path-based dependencies Package descriptions in the dub.json/dub.sdl can specify a path instead of a version; this can be used with Git submodules or subtrees, or with a known directory layout, to use arbitrarily defined versions of a dependency. Note that this should only be used for non-public packages. Path-based selections You can specify arbitrary versions, branches, and paths in the dub.selections.json file, even if they contradict the dependency specification of the packages involved (note that DUB will output a warning in that case). but doesn't give any examples. my dub.selections.json is currently: { "fileVersion": 1, "versions": { "derelict-cl": "2.0.0", "derelict-cuda": "2.0.1", "derelict-util": "2.1.0", "taggedalgebraic": "0.10.7" } } I want derelict-cl to use C:\Users\me\Documents\GitHub\DerelictCL How do I do that? Thanks Nic
[Issue 17851] New: htonl already defined in phobos64.lib
https://issues.dlang.org/show_bug.cgi?id=17851 Issue ID: 17851 Summary: htonl already defined in phobos64.lib Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: bitwo...@qq.com When building a simple demo for libevent(https://github.com/D-Programming-Deimos/libevent) on Windows 10 X64, I got these errors blown: ws2_32.lib(WS2_32.dll) : error LNK2005: htonl already defined in phobos64.lib(winsock2_1f3b_225.obj) ws2_32.lib(WS2_32.dll) : error LNK2005: htons already defined in phobos64.lib(winsock2_1f3a_22c.obj) ws2_32.lib(WS2_32.dll) : error LNK2005: ntohl already defined in phobos64.lib(winsock2_1f3d_225.obj) ws2_32.lib(WS2_32.dll) : error LNK2005: ntohs already defined in phobos64.lib(winsock2_1f3c_22c.obj) I redefined these functions in druntime\src\core\sys\windows\winsock2.d. For example: uint htonl(uint x) { return bswap(x); } is changed to: uint htonl(uint x); After rebuilding the phobos64.lib, I can eliminate these errors. Here is a test code: import std.stdio; import deimos.event2.event; import std.socket; void main() { event_base_loopbreak(null); InternetAddress addr1 = new InternetAddress("127.0.0.1", 80); writeln(addr1.port); writeln(addr1.addr); } Compiler: dmd v2.076.0/VC++ 2017 OS: Windows 10 x64 --
Re: Connecting python to D on socket of localhost : target machine actively refuses connection
On 23/09/2017 3:26 AM, Sergei Degtiarev wrote: On Friday, 22 September 2017 at 04:06:08 UTC, Enjoys Math wrote: Here's my minimal D code (server.d): public: this(ushort port, string address="") { super(& run); if (address == "") address = "DESKTOP-T49RGUJ"; this.port = port; this.address = address; . listener.bind(new InternetAddress(address, port)); It seems to me, you pass invalid address to bind(). InternetAddress takes ipv4 dot notation string x.x.x.x, and for bind you are to supply INADDR_ANY For DNS resolution: https://dlang.org/phobos/std_socket.html#.getAddress
Re: Connecting python to D on socket of localhost : target machine actively refuses connection
On Friday, 22 September 2017 at 04:06:08 UTC, Enjoys Math wrote: Here's my minimal D code (server.d): public: this(ushort port, string address="") { super(& run); if (address == "") address = "DESKTOP-T49RGUJ"; this.port = port; this.address = address; . listener.bind(new InternetAddress(address, port)); It seems to me, you pass invalid address to bind(). InternetAddress takes ipv4 dot notation string x.x.x.x, and for bind you are to supply INADDR_ANY
Re: Finding class template instantiations via runtime reflection (for openmethods)
On Thursday, 21 September 2017 at 20:32:38 UTC, Jean-Louis Leroy wrote: Neither 'Bar!int' nor 'BarInt' appear in 'localClasses'. Ideas? The information you can retrieve through localClasses is limited. AFAIK it only retrieves plain non-template classes declared directly in the module. Last I checked, non-template classes added via mixin were skipped as well. I'm not sure how much work can be expected in this area. Things related to runtime reflection have slowly been getting removed from druntime and dmd. I don't think there's much left of it. Your best bet is to scrape the info you need on your own using D's traits: https://dlang.org/phobos/std_traits.html https://dlang.org/spec/traits.html I would recommend trying to work with std.traits first (as opposed to __traits). If you need to scan entire modules at a time, then start with something like this: foreach(m; __traits(allMembers, fully.qualified.modulename)) { // __traits(getMember, ... , ...) }
Re: Finding class template instantiations via runtime reflection (for openmethods)
On Thursday, 21 September 2017 at 20:32:38 UTC, Jean-Louis Leroy wrote: Neither 'Bar!int' nor 'BarInt' appear in 'localClasses'. Ideas? The information you can retrieve through localClasses is limited. AFAIK it only retrieves plain non-template classes declared directly in the module. Last I checked, non-template classes added via mixin were skipped as well. I'm not sure how much work can be expected in this area. Things related to runtime reflection have slowly been getting removed from druntime and dmd. I don't think there's much left of it. Your best bet is to scrape the info you need on your own using D's traits: https://dlang.org/phobos/std_traits.html https://dlang.org/spec/traits.html I would recommend trying to work with std.traits first (as opposed to __traits). If you need to scan entire modules at a time, then start with something like this: foreach(m; __traits(allMembers, fully.qualified.modulename)) { // __traits(getMember, ... , ...) }
Re: Finding class template instantiations via runtime reflection (for openmethods)
On Thursday, 21 September 2017 at 20:32:38 UTC, Jean-Louis Leroy wrote: Neither 'Bar!int' nor 'BarInt' appear in 'localClasses'. Ideas? The information you can retrieve through localClasses is limited. AFAIK it only retrieves plain non-template classes declared directly in the module. Last I checked, non-template classes added via mixin were skipped as well. I'm not sure how much work can be expected in this area. Things related to runtime reflection have slowly been getting removed from druntime and dmd. I don't think there's much left of it. Your best bet is to scrape the info you need on your own using D's traits: https://dlang.org/phobos/std_traits.html https://dlang.org/spec/traits.html I would recommend trying to work with std.traits first (as opposed to __traits). If you need to scan entire modules at a time, then start with something like this: foreach(m; __traits(allMembers, fully.qualified.modulename)) { // __traits(getMember, ... , ...) }
[Issue 17850] New: Poor Documentation of the Realtime thread feature
https://issues.dlang.org/show_bug.cgi?id=17850 Issue ID: 17850 Summary: Poor Documentation of the Realtime thread feature Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dlang.org Assignee: nob...@puremagic.com Reporter: vorl...@web.de I've spent far more time than an average C/C++ developer taking a quick glance at Dlang and then immediately dismissed it as not suitable because it has a gc and yet I still had trouble finding this feature and even after knowing it exists it still wasn't easy to find it. Without seeing some ad hoc comments from Walter Bright on reddit I probably would even know a about the existence of this feature at all. The other reddit users always suggested a suboptimal solution to the problem. The https://dlang.org/spec/garbage.html page drowns you with a wall of text yet hides the ability to avoid the garbage collector for individual threads. This is a critical feature for D to compete with C/C++/Rust rather than Java or the billion other programming languages with a garbage collector. Without it I didn't even consider using D at all. "Normally, all threads other than the collector thread must be halted while the collection is in progress." Should be clarified by something along the lines of "The stop the world pause can be mitigated by detaching the thread from the runtime to turn it into a realtime thread. The thread function of a realtime thread must be marked with @nogc and it must not hold any GC roots." which is written here https://wiki.dlang.org/Memory_Management#Real_Time but unless you're looking for it you won't find it. I also have a problem with the documentation of the detaching functions. https://dlang.org/phobos/core_thread.html#.thread_detachThis "Deregisters the calling thread from use with the runtime. If this routine is called for a thread which is not registered, the result is undefined." They do not clarify what detaching the runtime actually does. At the very least the documentation should mention that detached threads will not be paused by the garbage collector. The general description of the thread class should also hint at the possibility of realtime threads so that it will be more visible even to those who just want to use regular threads which should include most developers. https://dlang.org/phobos/core_thread.html#.Thread Finally I would suggest that someone writes a small blogpost about realtime threads that illustrates how to use them which hopefully appears at the top of google search results. --
Re: A potential danger to dub
On Saturday, 16 September 2017 at 17:09:34 UTC, David Gileadi wrote: Let me preface this by saying I love package managers and think dub is one of the best things with dlang. However they can also sometimes be dangerous, as this PyPI incident[1] shows: several Python packages were uploaded that contained names similar to the standard library, and had an extra semi-malicious payload. They are apparently now part of live software. You could of course expect developers to do due diligence with the things they download, but of course they don't. It's probably worth paying attention to what the PyPI devs do to help mitigate this, and perhaps repeat some of those things with dub. [1] https://arstechnica.com/information-technology/2017/09/devs-unknowingly-use-malicious-modules-put-into-official-python-repository/ The main vector of attack was slightly misnamed popular packages. That can be solved by adding checksums and adding some sort of "certified real repo" badge systems to the package manager.
Re: Simple web server benchmark - vibe.d is slower than node.js and Go?
On Thursday, 21 September 2017 at 08:01:23 UTC, Vadim Lopatin wrote: There is a simple set of simple web server apps written in several languages (Go, Rust, Scala, Node-js): https://github.com/nuald/simple-web-benchmark I've sent PR to include D benchmark (vibe.d). I was hoping it could show performance at least not worse than other languages. But it appears to be slower than Go and even Node.js Are there any tips to achieve better performance in this test? Under windows, I can get vibe.d configured to use libevent to show results comparable with Go. With other configurations, it works two times slower. Under linux, vibe.d shows 45K requests/seconds, and Go - 50K. The only advantage of D here is CPU load - 90% vs 120% in Go. I'm using DMD. Probably, ldc could speed up it a bit. Probably, it's caused by single threaded async implementation while other languages are using parallel handling of requests? Its a bit uneven benchmark as you are testing default Go vs default D + Vibe.D. One can use a more faster framework like Go's Gin https://github.com/gin-gonic/gin In my tests in the past with Vibe.D 0.8, Go was faster with the alternative frameworks.
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan It's an ongoing process to make the registry more reliable. However, since a couple of months we run multiple mirrors. At the moment there is: https://code-mirror.dlang.io (EU) https://code-mirror2.dlang.io (US) http://code-mirror3.dlang.io (Heroku, US) - You can run one yourself with --mirror - The next DUB release will contain default fallbacks to these mirrors
Antipattern in core.memory.GC.addRange?
GC.addRange has this signature: static nothrow @nogc void addRange(in void* p, size_t sz, const TypeInfo ti = null); I see a large problem with this. Let's say you malloc an array of struct pointers: struct Foo { ... } import core.stdc.stdlib; auto ptrs = (cast(Foo *)malloc(Foo.sizeof * 10))[0 .. 10]; Now, you want to store GC pointers in that block, you need to add the range to the GC: GC.addRange(ptrs.ptr, ptrs.length); See the problem? Why would addRange work this way, when D has such a better mechanism for this? Can we fix it? -Steve
[Issue 17848] Example of floating point literals in the documentation is invalid
https://issues.dlang.org/show_bug.cgi?id=17848 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dlang.org https://github.com/dlang/dlang.org/commit/90bce087c1671bec00cf1a2d2d2d6bc84ed3cc4e fix issue 17848 - Example of floating point literals in the documentation is invalid 'd' is not a valid float suffix. It's not in the grammar, and dmd doesn't accept it. https://github.com/dlang/dlang.org/commit/0b2a4a97797c2ec462dfbafa5248e7cc068d0e43 Merge pull request #1897 from aG0aep6G/patch-3 fix issue 17848 - Example of floating point literals in the documenta… merged-on-behalf-of: Steven Schveighoffer--
[Issue 16548] Shadowing a variable not detected when nesting foreach with associative arrays
https://issues.dlang.org/show_bug.cgi?id=16548 Vladimir Panteleevchanged: What|Removed |Added Keywords||accepts-invalid, diagnostic Hardware|x86_64 |All OS|Windows |All --- Comment #1 from Vladimir Panteleev --- Second variable doesn't need to be a foreach variable, either: /// test.d /// void main() { int x; int[int] aa; foreach (k, v; aa) { int x; } } // --
[Issue 17849] Lexical link for align keyword goes to obscure iasm usage
https://issues.dlang.org/show_bug.cgi?id=17849 Steven Schveighofferchanged: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #5 from Steven Schveighoffer --- PR was merged. --
[Issue 17849] Lexical link for align keyword goes to obscure iasm usage
https://issues.dlang.org/show_bug.cgi?id=17849 Steven Schveighofferchanged: What|Removed |Added Keywords||pull --- Comment #4 from Steven Schveighoffer --- PR: https://github.com/dlang/dlang.org/pull/1898 --
[Issue 17849] Lexical link for align keyword goes to obscure iasm usage
https://issues.dlang.org/show_bug.cgi?id=17849 Steven Schveighofferchanged: What|Removed |Added Status|RESOLVED|REOPENED CC||schvei...@yahoo.com Hardware|x86 |All Resolution|INVALID |--- Summary|Documentation of align is |Lexical link for align |incorrect |keyword goes to obscure ||iasm usage OS|Linux |All Severity|enhancement |trivial --- Comment #3 from Steven Schveighoffer --- Agreed. There is no reason to link to iasm, as align is much more prevalent as a normal attribute. It's also telling that zero other keywords link to the iasm page. Reopening with altered title. --
[Issue 17849] Documentation of align is incorrect
https://issues.dlang.org/show_bug.cgi?id=17849 --- Comment #2 from Peter Varo--- My confusion was coming from the fact, that the 'lexical' page is referencing the 'iasm' when introducing the 'align' keyword. (https://github.com/dlang/dlang.org/blob/master/spec/lex.dd#L942) I think the fact alone, that we have a keyword that can be used in two ways, yet the documentation fails to connect those two explaining the difference between these scenarios is confusing, not to mention how hard it is to follow/understand this for a new comer, who has no idea that D has a "built-in mini-language" and the official documentation they are following is pointing at the "lesser used feature"... So I agree, the bug I reported is invalid, but the above case related to this one is still something that needs attention IMO. --
Re: How to list all process directories under /proc/
On Sunday, 17 September 2017 at 08:15:58 UTC, Ky-Anh Huynh wrote: Hi, I want to list all processes by scanning /proc/. The following code doesn't work [code] foreach (string fstatm; dirEntries("/proc/", "[0-9]*", SpanMode.shallow)) { writefln("pid %s", fstatm); } [/code] as it only list a few entries before exiting [code] pid /proc/9 pid /proc/935 pid /proc/9146 pid /proc/9149 pid /proc/9150 pid /proc/9151 pid /proc/9756 pid /proc/9759 pid /proc/9760 pid /proc/9761 [/code] I don't want to use `SpanMode.depth` or `SpanMode.breadth` because it will scan so deeply and there would be a permission problem. Any ideas? Thanks a lot Are you familiar with libprocps ? Maybe you had better make use of this library, or, at least, peek into its code, for reference.
Re: Weka.IO in the news... but not mentioning Dlang... why?
On 21/09/17 09:18, Suliman wrote: On Thursday, 3 August 2017 at 21:01:28 UTC, Joakim wrote: On Thursday, 3 August 2017 at 20:55:35 UTC, Pradeep Gowda wrote: On Thursday, 3 August 2017 at 20:47:30 UTC, Joakim wrote: Please tell me which enterprise storage company advertises the programming languages they implemented their product in. ;) We hope to have a post on the D blog with info from Weka sometime soon, that should be a good way to get the word out. They do mention it on their jobs page - http://www.weka.io/company/careers/ (see under "Data Path Developer" position). Sure, a lot of companies do that, not what I meant by advertising, ie in their news articles and press releases. Weka has been very open by giving talks at DConf, that's going to be noticed more than some job opening buried in their website: http://dconf.org/2015/talks/zvibel.html http://dconf.org/2016/talks/zvibel.html Hi guys from Weka! Could you explain what difference from your product and Hadoop? One is a linear database and the other is a filesystem? If that doesn't satisfy you, please describe to me the difference between D and Microsoft Word, so I know what kind of answer you're expecting. Shachar
Re: What the hell is wrong with D?
On Tuesday, 19 September 2017 at 18:34:13 UTC, Brad Anderson wrote: On Tuesday, 19 September 2017 at 18:17:47 UTC, jmh530 wrote: On Tuesday, 19 September 2017 at 17:40:20 UTC, EntangledQuanta wrote: Thanks for wasting some of my life... Just curious about who will justify the behavior and what excuses they will give. Pretty sure it would be exactly the same thing in C... It is (and Java and C# and pretty much every other C style language though the nicer implicit conversion rules means it gets caught more easily). It is a big source of programmer mistakes. It comes up frequently in PVS Studio's open source analysis write ups. So I checked for all the languages listed: C, C#, Java, Javascript, C++, PHP, Perl and D. All have the same order of precedence except, as always the abomination of all languages: C++ (kill it with fire). C++ is the only language that has the ternary operator have the same precedence than the assignment operators. This means a>=5?b=100:b=200; will compile in C++ but not in all the other languages. That's one reason why it irritates me when people continuously refer to C and C++ as if it was the same thing (yes I mean you Walter and Andrei). Even PHP and Perl got it right, isn't that testament of poor taste Bjarne?. :-)
[Issue 17848] Example of floating point literals in the documentation is invalid
https://issues.dlang.org/show_bug.cgi?id=17848 ag0ae...@gmail.com changed: What|Removed |Added Keywords||pull, spec CC||ag0ae...@gmail.com Hardware|x86 |All Assignee|nob...@puremagic.com|ag0ae...@gmail.com OS|Linux |All Severity|enhancement |minor --- Comment #1 from ag0ae...@gmail.com --- https://github.com/dlang/dlang.org/pull/1897 --
[Issue 17849] Documentation of align is incorrect
https://issues.dlang.org/show_bug.cgi?id=17849 ag0ae...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED CC||ag0ae...@gmail.com Resolution|--- |INVALID --- Comment #1 from ag0ae...@gmail.com --- The iasm.html page is only about asm blocks. In an asm block, `align 64;` is correct. The documentation for the align attribute is here: https://dlang.org/spec/attribute.html#align Closing as invalid. --
Re: Multidimensional dynamic array of strings initialized with split()
On Thursday, 5 September 2013 at 16:22:46 UTC, Ali Çehreli wrote: Compiling with "DMD64 D Compiler v2.064-devel-52cc287" produces the following errors: * You had byLines in your original code as well. Shouldn't it be byLine? * You are missing the closing brace of the foreach loop as well. * "Error: cannot append type char[][] to type string[][]" I have to replace .dup with .idup Thank you for pointing out the errors, Ali. I have updated the example. The following version is lazy: import std.stdio; import std.array; import std.algorithm; auto readInData(File inputFile, string fieldSeparator) { return inputFile .byLine .map!(line => line .idup .split("\t")); } The caller can either use the result lazily: import std.range; void main() { auto file = File("deneme.txt"); writeln(readInData(file, "\t").take(2)); } Or call .array on the result to consume the range eagerly: auto table = readInData(file, "\t").array; Ali Thank you for the alternative approaches. This thread is linked from Credits section, if someone wants to find out more on the topic from the wiki.
Re: Finding class template instantiations via runtime reflection (for openmethods)
On 09/22/2017 05:16 AM, Steven Schveighoffer wrote: > On 9/21/17 4:32 PM, Jean-Louis Leroy wrote: >> it seems that classes that >> come from class template instantiations are not registered in >> ModuleInfo > I would say it's a bug. > > -Steve I think so too. I wanted to hear it from Steve first. :) Ali
Should we add `a * b` for vectors?
Should we add `a * b` to ndslice for 1d vectors? Discussion at https://github.com/libmir/mir-algorithm/issues/91
CTFE static array error: cannot modify read-only constant
Hi all, ``` auto foo(const int[3] x) { int[3] y = x; y[0] = 1; // line 4 return y; } immutable int[3] a = [0,1,2]; immutable int[3] b = foo(a); // line 8 ``` compiles with an error: ``` 4: Error: cannot modify read-only constant [0, 1, 2] 8:called from here: foo(a) ``` What am I doing wrong? Thanks, Johan
[Issue 17849] New: Documentation of align is incorrect
https://issues.dlang.org/show_bug.cgi?id=17849 Issue ID: 17849 Summary: Documentation of align is incorrect Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dlang.org Assignee: nob...@puremagic.com Reporter: he...@petervaro.com The documentation of the https://dlang.org/spec/iasm.html#align keyword is incorrect. It is suggesting here: https://github.com/dlang/dlang.org/blob/master/spec/iasm.dd#L74, that this should be the correct way of using it: ``` struct S { align 64 ubyte b; } ``` instead of the one, that can actually be compiled: ``` struct S { align(64) ubyte b; } ``` Therefore further action is required: - If the documented usage is the desired one, then this is a different issue, and that behaviour needs to be implemented. - If the keyword requires parenthesis, then the documentation should be updated according to that. --
Last post from me not displayed on web frontend?
This post is to try if it works now. But I got an answer from Adam... Thank you.
[Issue 17844] std.process.execute should allow not capturing stderr
https://issues.dlang.org/show_bug.cgi?id=17844 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/71adbeee85f4f97d5b3cf93bed28c0f4779e2d23 Fix Issue 17844 - std.process.execute should allow not capturing stderr https://github.com/dlang/phobos/commit/5b5bc615cdebca8b909e70b0e33cde6ffe594376 Merge pull request #5742 from CyberShadow/pull-20170920-102045 Fix Issue 17844 - std.process.execute should allow not capturing stderr merged-on-behalf-of: Steven Schveighoffer--
[Issue 17844] std.process.execute should allow not capturing stderr
https://issues.dlang.org/show_bug.cgi?id=17844 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan Well, it seems to be working now.
[Issue 17848] New: Example of floating point literals in the documentation is invalid
https://issues.dlang.org/show_bug.cgi?id=17848 Issue ID: 17848 Summary: Example of floating point literals in the documentation is invalid Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dlang.org Assignee: nob...@puremagic.com Reporter: he...@petervaro.com The documentation about the 'Floating Point Literals' (https://dlang.org/spec/lex.html#floatliteral) is not mentioning any kind of 'd' suffix for float literals, yet in the examples it is showing as both good and bad ones: the good: https://github.com/dlang/dlang.org/blob/master/spec/lex.dd#L918 the bad: https://github.com/dlang/dlang.org/blob/master/spec/lex.dd#L919 So further actions are required: - If the 'd' suffix should be supported, then it needs further explanation and at the same time, the compiler should accept it as valid float literal. (Which I believe is not a valid one, hence currently dmd is complaining about it.) - If the 'd' suffix is as invalid float literal, then it should be removed from the examples. --
Re: static array with inferred size
On Friday, September 22, 2017 08:19:32 Steven Schveighoffer via Digitalmars- d wrote: > On 9/22/17 3:55 AM, Dominikus Dittes Scherkl wrote: > > On Thursday, 21 September 2017 at 13:58:14 UTC, Timon Gehr wrote: > >> On 21.09.2017 12:33, Per Nordlöw wrote: > >>> On Wednesday, 20 September 2017 at 18:41:51 UTC, Timon Gehr wrote: > > Can that be done without breakages? -- Andrei > > No. > >>> > >>> Are thinking about > >>> > >>> typeof([1,2]) > >>> > >>> changing from > >>> > >>> int[] > >>> > >>> to > >>> int[2] > >>> > >>> ? > >> > >> Yes, and everything that entails, for example: > >> > >> auto x = [1,2]; > >> x ~= 3; // goes from ok to `error: cannot append int to int[2]`. > > > > Ok, breaks code, but I like it. Much better than the current behaviour. > > Don't fall in love with it. It's not going to happen, as this would be > too much breakage for almost no gain. > > Much as I want a way to statically infer a static array size, this is > not the answer. It would also interact horribly with range-based functions. I honestly don't see any benefit to making array literals be static arrays by default except for the fact that you'd then get size inference, and there are better ways to add that to the language if we want to do that. - Jonathan M Davis
Re: static array with inferred size
On 9/22/17 3:55 AM, Dominikus Dittes Scherkl wrote: On Thursday, 21 September 2017 at 13:58:14 UTC, Timon Gehr wrote: On 21.09.2017 12:33, Per Nordlöw wrote: On Wednesday, 20 September 2017 at 18:41:51 UTC, Timon Gehr wrote: Can that be done without breakages? -- Andrei No. Are thinking about typeof([1,2]) changing from int[] to int[2] ? Yes, and everything that entails, for example: auto x = [1,2]; x ~= 3; // goes from ok to `error: cannot append int to int[2]`. Ok, breaks code, but I like it. Much better than the current behaviour. Don't fall in love with it. It's not going to happen, as this would be too much breakage for almost no gain. Much as I want a way to statically infer a static array size, this is not the answer. -Steve
Re: Finding class template instantiations via runtime reflection (for openmethods)
On 9/21/17 4:32 PM, Jean-Louis Leroy wrote: It did not take long! Someone tried to create templatized open methods and it didn't work right of the box. I expected that, but in fact there may be a bit of hope. You cannot have virtual function templates in C++ or in D because the layout of the vtables have to be known at compile time - but openmethods creates its method tables at runtime so maybe it can be made to work. I stumbled upon a problem very quickly: it seems that classes that come from class template instantiations are not registered in ModuleInfo - see below, import std.stdio; class Foo {} class Bar(T) : Foo { int i; } alias BarInt = Bar!int; const barInt = new BarInt; void main() { foreach (mod; ModuleInfo) { foreach (c; mod.localClasses) { writeln(c); } } } output: modtemp.Foo core.exception.RangeError core.exception.AssertError etc... Neither 'Bar!int' nor 'BarInt' appear in 'localClasses'. Ideas? It used to be that classes were always in ModuleInfo (and that ModuleInfo was always generated). That's not so much the case any more, as there has been a push to reduce the runtime footprint and complexity (especially toward -betterC). This makes traditional runtime reflection more difficult and sporadic. However, I would expect that if ModuleInfo is generated for a file, and some classes are added, then ALL classes instantiated in the module should be added. I would say it's a bug. -Steve
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan Who is host code.dlang.org?
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan No, it's an ongoing process to make the registry more reliable. However, since a couple of months we run multiple mirrors. At the moment there is: https://code-mirror.dlang.io (EU) https://code-mirror2.dlang.io (US) http://code-mirror3.dlang.io (Heroku, US) - You can run one yourself with --mirror - The next DUB release will contain default fallbacks to these mirrors.
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan It works fine for me. Can you verify?
Re: Simple web server benchmark - vibe.d is slower than node.js and Go?
Am 21.09.2017 um 20:49 schrieb bitwise: Doesn't vibe-d use Fibers? I tried to build a simple web server with a fiber-based approach once - it was horribly slow. I hope C# (and soon C++) style stackless resumable functions will eventually come to D. It uses them and the overhead actually diminishes once the application does anything meaningful. To test this, I created two low-level tests for eventcore that mimic a minimal HTTP server. AFAIR, I got around 300kreq/s on a single core without fibers and around 290kreq/s with fibers, which amounts to an overhead of about 0.1µs per request. https://github.com/vibe-d/eventcore/tree/master/examples Stackless fibers would be really nice to have because of the merged stacks and the lower amount of reserved memory required (even though this is not a really big issue on 64-bit systems), but for pure performance I don't think they would be a critical addition.
Re: Simple web server benchmark - vibe.d is slower than node.js and Go?
Am 22.09.2017 um 09:45 schrieb Vadim Lopatin: On Thursday, 21 September 2017 at 19:40:48 UTC, bitwise wrote: On Thursday, 21 September 2017 at 18:55:04 UTC, Vadim Lopatin It does. But Golang uses them, too. Goroutines. Indeed. I'm reading about them right now, and they seem to be "multiplexed". I wonder if Vibe.d does something similar. The fact that you've observed lower CPU usage by the D version makes me think some kind of scheduling or thread-priority issue is the cause. Fibers are being switched by waiting for signals/events. Waiting blocks thread. Timer should affect only non-blocked threads switching IMHO. What's was the last status? Could you observe any meaningful thread scaling? I tested on a 32-core machine a while back and could observe the performance rising almost linearly when increasing the number of cores (as it should). The effect is obviously smaller on a dual-core system where the benchmark application runs on the same system, but even there it was well visible. If the multi-threaded version doesn't show 100% CPU usage, that would mean that some kind of thread-blocking is happening - GC collections or lock contention would be the likely candidates for that. The latter shouldn't happen anymore, as everything except for the logger should be thread-local in the latest version. BTW, I ran Daniel's version on my dual-core notebook against wrk (Linux) and got 75kreq/s when using runWorkerTask and ~56kreq/s when using just a single thread, which is about what I would expect, considering that wrk ran on the same machine.
Parsing mbox file to display with vibe.d
Hello, Parsing mbox file (/var/spool/mail/... on a Ubuntu machine) and splitting to a range or array of mail objects. Has anyone done this with D? please give me hint. (DUB, git, this forum?) Or should I start with formail (-s) as a subprocess? (At first step, I want to run a vibe.d server to display all Cron Messages which I will forward to one special account to view them in a browser. At first I thought about setting up Squirrel Mail or something similar for the job, but then by simply splitting the mbox and displaying the content in a html-table I might get what I need. ) Regards mt.
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan Works from here. Best, Nemanja
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan Works for me
Re: A potential danger to dub
On Saturday, 16 September 2017 at 17:09:34 UTC, David Gileadi wrote: Let me preface this by saying I love package managers and think dub is one of the best things with dlang. However they can also sometimes be dangerous, as this PyPI incident[1] shows: several Python packages were uploaded that contained names similar to the standard library, and had an extra semi-malicious payload. They are apparently now part of live software. You could of course expect developers to do due diligence with the things they download, but of course they don't. It's probably worth paying attention to what the PyPI devs do to help mitigate this, and perhaps repeat some of those things with dub. [1] https://arstechnica.com/information-technology/2017/09/devs-unknowingly-use-malicious-modules-put-into-official-python-repository/ maybe we should have an option to add a hash with the package version, to be able to check the integrity of the code that it's downloaded?
Re: code.dlang.org is offline?
On Friday, 22 September 2017 at 08:14:43 UTC, Szabo Bogdan wrote: Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan it looks like http://dlang.org/ is down too... ``` traceroute to dlang.org (162.217.114.56), 30 hops max, 60 byte packets 1 ... 0.434 ms 0.402 ms 0.382 ms 2 5.2.192.1 (5.2.192.1) 1.512 ms 2.454 ms 2.816 ms 3 10.220.131.53 (10.220.131.53) 5.856 ms 5.849 ms 5.834 ms 4 10.220.131.53 (10.220.131.53) 5.803 ms 5.785 ms 5.733 ms 5 10.220.131.49 (10.220.131.49) 6.083 ms 6.447 ms 6.046 ms 6 62.115.36.116 (62.115.36.116) 29.286 ms 83.217.233.9 (83.217.233.9) 25.977 ms 62.115.36.116 (62.115.36.116) 28.749 ms 7 ae-6.r02.frnkge04.de.bb.gin.ntt.net (129.250.3.62) 28.320 ms 62.115.122.226 (62.115.122.226) 28.019 ms 26.878 ms 8 * * 62.115.113.67 (62.115.113.67) 30.460 ms 9 * * * 10 * * * 11 * * * 12 * * * 13 * * * 14 * * * 15 * * * 16 * * * 17 * * * 18 * * * 19 * * * 20 * * * 21 * * * 22 * * * 23 * * * 24 * * * 25 * * * 26 * * * 27 * * * 28 * * * 29 * * * 30 * * * ```
code.dlang.org is offline?
Hi, Is there a reason why code.dlang.org is offline? Thanks, Bogdan
Re: static array with inferred size
On Thursday, 21 September 2017 at 13:58:14 UTC, Timon Gehr wrote: On 21.09.2017 12:33, Per Nordlöw wrote: On Wednesday, 20 September 2017 at 18:41:51 UTC, Timon Gehr wrote: Can that be done without breakages? -- Andrei No. Are thinking about typeof([1,2]) changing from int[] to int[2] ? Yes, and everything that entails, for example: auto x = [1,2]; x ~= 3; // goes from ok to `error: cannot append int to int[2]`. Ok, breaks code, but I like it. Much better than the current behaviour.
Re: How to check if string is available at compile time
On Thursday, 21 September 2017 at 11:42:36 UTC, David Bennett wrote: Hi Guys, Is there an easy way to check if the value of string passed to a template is available at compile time? Yeah , sure and I have such a template in my library: https://github.com/BBasile/iz/blob/master/import/iz/types.d#L627 see just above too, the template "isCompileTimeValue"
Re: Simple web server benchmark - vibe.d is slower than node.js and Go?
On Thursday, 21 September 2017 at 19:40:48 UTC, bitwise wrote: On Thursday, 21 September 2017 at 18:55:04 UTC, Vadim Lopatin It does. But Golang uses them, too. Goroutines. Indeed. I'm reading about them right now, and they seem to be "multiplexed". I wonder if Vibe.d does something similar. The fact that you've observed lower CPU usage by the D version makes me think some kind of scheduling or thread-priority issue is the cause. Fibers are being switched by waiting for signals/events. Waiting blocks thread. Timer should affect only non-blocked threads switching IMHO.
Re: Problems with function as parameter
On Friday, 22 September 2017 at 04:32:08 UTC, Josh wrote: As an aside, in that doc it says "The .funcptr property of a delegate will return the function pointer value as a function type". So I also tried Mix_ChannelFinished(().funcptr); and this compiled, but caused a segfault when the callback ran. What would have caused this? Is it because it's a C function? No it's because in this function are used variables that are specific to the class instance (the this). If there weren't this would work, even if it's not a good idea to do that: struct Foo { int a; void needThisYeahReally(){a = 0;} void needThisButWorkWithout(){} } void main() { Foo foo; { auto dg = dg.funcptr(); } { auto dg = // dg.funcptr(); // segfault because of access to this.a } } Using a pointer to a static member function was the right thing to do.
Re: Greetings, New IDE Development
On 2017-09-16 21:38, Answar Enchali wrote: Does dmd support outputting the full ast with symbol type information and full line mapping or will these features have to be added? If they are to be added, what would be a ball part man-hour cost to add these features? If we are able to integrate D support in to our IDE we will release the D portion of our IDE(removing the C++ side as it is proprietary) as a sign of good faith. DMD is not really designed to be used as a library. Although there's been some progress in that area lately. There's a student that works on restructuring the compiler as a library. We have the lexer and parser available in a DUB package [1] to be used as a library. I recommend getting in contact with Razvan Nitu [2] and Andrei about this. [1] http://code.dlang.org/packages/dmd [2] https://github.com/RazvanN7 -- /Jacob Carlborg