[Issue 16574] [REG 2.072.0-b1] Unexplained errors about functions that overridde anything
https://issues.dlang.org/show_bug.cgi?id=16574 --- Comment #14 from b2.t...@gmx.com --- (In reply to Martin Nowak from comment #13) > (In reply to b2.temp from comment #11) > > $ if [ -d kheops ]; then > > $ cd kheops > > $ git pull > > $ cd .. > > $ else > > $ git clone https://github.com/BBasile/kheops.git > > $ fi > > $ cd kheops/runnable > > $ dub default_alignment.d > > Mmh, apparently you don't see the problem w/ your test case, so I'm saying > this explicit. > The moment you add a new commit, or any of the your project's dependencies > gets updated, the bug might no longer be reproducible. $ if ! [ -d kheops ]; then $ git clone https://github.com/BBasile/kheops.git $ fi $ $ cd kheops $ git checkout a00f300c4281b2d4aaf95e7fabde48d3dc3816e9 $ cd runnable $ dub default_alignment.d > I've already spend a lot of time trying to reproduce this bug w/ your ever So do I. I've manually compiled DMD and phobos about a hundred of times to find where default_alignment.d started not to work anymore. Also the (unfortunately) wrong reduction didn't pop from the magician hat. > moving example. So please make sure that bug reports use "permalinks" > including the commit hash and dub.selections.json. > > > I think that you did not see it because the unittest config does nothing > > (it's a static library). > > I ran dub build, if I recall correctly. 'dub build --build=unittest' does nothing, you should have get "Target is a library. Skipping execution.here...anyway this is pointless because there's no unittest in this library. The only unittest were only used to make static checks related to manual memory management. > (In reply to b2.temp from comment #12) > > By the way Mr Nowak, I like to see how you're involved. But for this > > particular regression, maybe Kenji Hara could get in... > > Unlikely, he is hardly nowadays. He's the author of the feature. I don't even understand why this is you that handle all the dirty work with the many regressions of this pre-release. > > If at a certain point he's not able to fix the new compiler feature: > > > > https://dlang.org/changelog/2.072.0.html#deferred_alias > > > > Then let's revert this feature until he has the time to work on it. > > Well, your code involves a recursive template, and it's not clear whether > it's actually possible to be compiled. I have many others small applications like "default_alignment.d" that I run to track possible breakage. Once again I don't understand what you are trying to tell me. With DMD 2.071.2 they are all compiled, they run all. > Lazy alias analysis is a huge improvement for compile times, Certainly. > so we won't drop it light-hearted. So don't drop it and make your release but keep in mind that there's an issue. Soon or later it will show the tip of its nose again. --
[Issue 16627] [Reg 2.072] non-static structs with postblit/dtor fields are now nested
https://issues.dlang.org/show_bug.cgi?id=16627 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 16627] [Reg 2.072] non-static structs with postblit/dtor fields are now nested
https://issues.dlang.org/show_bug.cgi?id=16627 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/868ce84e30a3d4e1157e9e72bc3e308b0cd0b1db fix Issue 16627 - non-static structs with postblit/dtor fields now nested - Since dlang/dmd#5500 buildPostblit/Dtor/OpAssign are run before the struct size is finalized, thereby now making structs nested that previously were not. - Not sure if the old behavior was an intended feature. If not we might want to deprecate it. https://github.com/dlang/dmd/commit/8e8541a941bb8fdacf6c8b7a042a69cf77d4676c Merge pull request #6212 from MartinNowak/fix16627 fix Issue 16627 - non-static structs with postblit/dtor fields now nested --
State of issues.dlang.org
I sort of feel that issues.dlang.org is an unmaintained mess. Anyone has access to it every aspect of editing anyone else's issue, so anyone could be added really without any oversight. There's no editing one's comments so I often see people making multiple posts to themselves to add more information or to correct themselves. That's just a minor issue. There are 16k issues (I'm guessing every ID basically means a unique issue) for DMD alone. It has some issues where an individual made a comment, no tags or anything was set, and then 2-3 years later its remained like that til someone reserves it with a change or comment Only for there only to be that one additional comment then the issue gets buried for another year or so. There are so many like this and it is unclear what exactly the issue is or what needs to be done with it. Almost every issue is like this as well. There are some discussions in some of the issues but a lot of the times nothing seems to be done about them. Anyways for the site itself, it seems to be lacking features. When viewing issues as a list there isn't that much information about the issue, other than the summary. Things that are listed with an issue: The ID, it's alright I guess can be useful from the list, knowing the issue number to reference it in a pull request or other issue. The "Product", completely useless, is D for everything on the site essentially. The "Comp", that's fine for searching for errors across multiple but kind of useless when viewing the issue list for a single project. The "assignee", kind of useless and it's never used, only every seen it set to "nobody". The "Status", kind of useless don't need to know that information, just need to know if it is open or closed and that shouldn't really be part of the list ; if I search for issues I should just specify if I want them to be open or not. The "Resolution", only ever seen it as "---", maybe it means something for closed issues but I haven't seen any closed issues. So what is the point of the list if it doesn't display any useful information. There's no, "needs work", or "enhancement" or any other description that can add to what the issue is or what it needs to have done to it. When there are 16k+ issues, having better information in the list view is desired. To make searching for an issue easier, rather than having to click on each one individually item to get more information from it. There's no lack of space, especially when almost every column could be removed for something with more useful information. So now there are this many issues and it probably won't be an easy task to go through all of them and determine which ones are actually valid. To weed out all the issues that can simply be deleted. It would be nice to know what needs to be done for an issue, if it is a small enhancement and can simply get a PR to add the functionality. If it is a bit bigger of an enhancement and needs a DIP to add the functionality. Or whether an issue exists and how the issue needs to be handled. Is it a feature that was implemented incorrectly and needs to be reworked. Or was it possibly an oversight of a combination of features and a more thought out solution needs to be created, which might involve something more extreme as removing a previous feature. Well wrote more than I planned to, didn't re-read it though, probably should considering I won't be able to edit it. Oh well. TLDR; The issue system in place right now needs to be removed and a better system with oversight put in place. Rather than the wildwest it is now, with no oversight and issues existing for years before anyone looks at them. If anyone even ever looks at them. Some of them aren't even real issues and they just end up clogging the pipes, so to speak.
[Issue 16344] Real FP magic on windows
https://issues.dlang.org/show_bug.cgi?id=16344 Sprinkchanged: What|Removed |Added CC||sprink.nore...@gmail.com --- Comment #1 from Sprink --- Windows doesn't have a "real" type, or at least it's standard library doesn't. So if it is using C's write then it is probably using double and not "real" or long double. --
[Issue 16631] Program crash when a version activates a method defined in a static library
https://issues.dlang.org/show_bug.cgi?id=16631 b2.t...@gmx.com changed: What|Removed |Added Severity|enhancement |major --
Re: Namespace for a module defined by its import path
On Monday, 24 October 2016 at 21:06:18 UTC, Jeff Thompson wrote: Basically, I want the namespace of the identifiers in the library module to be defined by the path which is use to load them *without needing to put the path in the module file.* Is there some way to do this? That's not going to work... but why do you want this? If they are different versions of the file, editing the module definition should be no real problem. You can use renamed imports or a helper module with public import to keep user code more compatible. You can also do the opposite easily: have several files all with the same module name, but pick the specific path you want on the command line. Just make two files, v1.d and v2.d, both with `module myproject.myfile;` and import it as `import myproject.myfile;` When compiling, then just do `dmd yourcode.d v1.d` or `dmd yourcode.d v2.d` to pick the one you want.
Re: Namespace for a module defined by its import path
On Monday, 24 October 2016 at 23:26:09 UTC, bitwise wrote: Not sure if I understand you correctly, but you're allowed to omit the module declaration, if that helps: It doesn't help, I strongly recommend you ALWAYS use the explicit module definition. If you leave it out, you'll regret it sooner or later. The automatic module name never has a package component, it is just one word, and is thus highly likely to cause name conflicts later.
Re: Namespace for a module defined by its import path
On Monday, 24 October 2016 at 21:06:18 UTC, Jeff Thompson wrote: I have different versions of a library module in different folders. For example /version1/lib.d /version2/lib.d In my application I need to be able to update the names of the different folders without needing to change the module files. That means the file cannot contain "module version1.lib;" since I may need to change it to "versionA". Ideally, I want to omit the "module" declaration in the library file, but still import it with the desired file path as "import version1.lib;". And I would also want to "import version2.lib;" without conflict. Basically, I want the namespace of the identifiers in the library module to be defined by the path which is use to load them *without needing to put the path in the module file.* Is there some way to do this? Not sure if I understand you correctly, but you're allowed to omit the module declaration, if that helps: https://dlang.org/spec/module.html#module_declaration "The ModuleDeclaration sets the name of the module and what package it belongs to. If absent, the module name is taken to be the same name (stripped of path and extension) of the source file name."
[Issue 16574] [REG 2.072.0-b1] Unexplained errors about functions that overridde anything
https://issues.dlang.org/show_bug.cgi?id=16574 --- Comment #13 from Martin Nowak--- (In reply to b2.temp from comment #11) > $ if [ -d kheops ]; then > $ cd kheops > $ git pull > $ cd .. > $ else > $ git clone https://github.com/BBasile/kheops.git > $ fi > $ cd kheops/runnable > $ dub default_alignment.d Mmh, apparently you don't see the problem w/ your test case, so I'm saying this explicit. The moment you add a new commit, or any of the your project's dependencies gets updated, the bug might no longer be reproducible. I've already spend a lot of time trying to reproduce this bug w/ your ever moving example. So please make sure that bug reports use "permalinks" including the commit hash and dub.selections.json. > I think that you did not see it because the unittest config does nothing > (it's a static library). I ran dub build, if I recall correctly. (In reply to b2.temp from comment #12) > By the way Mr Nowak, I like to see how you're involved. But for this > particular regression, maybe Kenji Hara could get in... Unlikely, he is hardly nowadays. > If at a certain point he's not able to fix the new compiler feature: > > https://dlang.org/changelog/2.072.0.html#deferred_alias > > Then let's revert this feature until he has the time to work on it. Well, your code involves a recursive template, and it's not clear whether it's actually possible to be compiled. Lazy alias analysis is a huge improvement for compile times, so we won't drop it light-hearted. --
[Issue 16629] [Reg 2.072] scope is stripped from some parameters
https://issues.dlang.org/show_bug.cgi?id=16629 Martin Nowakchanged: What|Removed |Added Keywords||pull --- Comment #1 from Martin Nowak --- https://github.com/dlang/dlang.org/pull/1503 --
Namespace for a module defined by its import path
I have different versions of a library module in different folders. For example /version1/lib.d /version2/lib.d In my application I need to be able to update the names of the different folders without needing to change the module files. That means the file cannot contain "module version1.lib;" since I may need to change it to "versionA". Ideally, I want to omit the "module" declaration in the library file, but still import it with the desired file path as "import version1.lib;". And I would also want to "import version2.lib;" without conflict. Basically, I want the namespace of the identifiers in the library module to be defined by the path which is use to load them *without needing to put the path in the module file.* Is there some way to do this?
Re: Cannot link with libphobos2.a with GCC 6.2 on Ubuntu 16.10
On Monday, 17 October 2016 at 11:55:03 UTC, Martin Nowak wrote: Please update the bug report. https://issues.dlang.org/show_bug.cgi?id=5278 Updated, but do I seriously have to do everything? I'm not even an Ubuntu user.
[Issue 5278] gentoo's 'hardended' gcc doesn't work with dmd
https://issues.dlang.org/show_bug.cgi?id=5278 --- Comment #32 from Martin Nowak--- This also affects Ubuntu 16.10 to some degree. [Hardened system tutorial/patch](http://forum.dlang.org/post/paeiukmlqrmgwieab...@forum.dlang.org) [Cannot link with libphobos2.a with GCC 6.2 on Ubuntu 16.10](http://forum.dlang.org/post/tppsgztsbsdrtkpcb...@forum.dlang.org) Using -fPIC -defaultlib=libphobos2.so (the normal shared flags) was reported to be a workaround for the missing -fPIE support on Ubuntu 16.10. https://github.com/rejectedsoftware/ddox/issues/134 --
Re: install.sh: Signature error prevents installation
On Monday, 24 October 2016 at 19:30:05 UTC, ff2000 wrote: This post was meant to be a bug report. The dlang/installer repo doesn't have a dedicated issue tracker. All bugs are tracked on our Bugzilla instance: https://issues.dlang.org/ There is an "installer" component. This particular issue is known: https://github.com/dlang/installer/pull/201
Re: install.sh: Signature error prevents installation
On Monday, 24 October 2016 at 11:07:59 UTC, Jacob Carlborg wrote: On 2016-10-24 09:22, ff2000 wrote: Hi, I wanted to install dmd using the provided install.sh. With no success: $ curl -fsS https://dlang.org/install.sh | bash -s dmd Downloading and unpacking http://downloads.dlang.org/releases/2.x/2.071.2/dmd.2.071.2.linux.tar.xz 100,0% Invalid signature http://downloads.dlang.org/releases/2.x/2.071.2/dmd.2.071.2.linux.tar.xz.sig If I run gpg2 myself I get $ gpg2 -q --verify --keyring d-keyring.gpg --no-default-keyring dmd.2.071.2.linux.tar.xz.sig dmd.2.071.2.linux.tar.xz gpg: Signature made Mon Sep 19 11:49:56 2016 CEST gpg:using RSA key B273811612BB1939 gpg: Can't check signature: No public key You can use DVM [1] instead. Allows you to easily switch between multiple versions of DMD. [1] https://github.com/jacob-carlborg/dvm Thx, I will have a look if it helps. But Gentoo does a great job, I can install several dmd versions in parallel and switch via eselect. I tried the installer only to get an upstream build to check if it fixes my issue with dstep ;) This post was meant to be a bug report. The dlang/installer repo doesn't have a dedicated issue tracker.
[Issue 3827] Warn against and then deprecate implicit concatenation of adjacent string literals
https://issues.dlang.org/show_bug.cgi?id=3827 --- Comment #43 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/dlang/dlang.org https://github.com/dlang/dlang.org/commit/aed85471943baba2b003df341dacc7a185a33d53 Issue 3827: Document deprecation of implicit string concatenation See dlang/dmd#6155 --
Re: If you do something dumb enough, the test runner won't print out your test failures
On Monday, 24 October 2016 at 18:45:36 UTC, Jacob Carlborg wrote: On 2016-10-24 14:37, Andrei Alexandrescu wrote: Cool, mine is quite similar (I don't use mc so I use RPS1). One extra thing I found useful is to display the running time of the last command if longer than 1 second. -- Andrei What do you do if it takes longer than 1 second to build the prompt ;) Simply try to not take too long for prompt creation, e.g. by doing it async ;) Google for "zsh async prompt" or get inspired by pure (which I use): https://github.com/sindresorhus/pure
[Issue 16626] [Reg 2.073] recent dmd nightly runs out of memory building Higgs
https://issues.dlang.org/show_bug.cgi?id=16626 Dmitry Olshanskychanged: What|Removed |Added Keywords||pull CC||dmitry.o...@gmail.com --- Comment #3 from Dmitry Olshansky --- https://github.com/dlang/phobos/pull/4877 --
Re: [OT] fastest fibbonacci
On Monday, 24 October 2016 at 08:54:38 UTC, Andrea Fontana wrote: You can simply write it as: round(phi^n/sqrt(5)); Check my example above :) Ran your example and it's perfect for 32bit code. But 64bit, not so much. It's only good through 71 iterations (longs) then it starts having errors. Also for some odd reason the input is one off, so i had to add a -1 to the input for it to align. This makes it accurate to 41/64 bit results. for(int i = 1; i < 100; ++i) { auto cf = computeFib(i); auto cfm = computeFibMagic(i-1); //with magic numbers exampled writeln(i, ": ", cf, "\t", cfm, "\t", cf == cfm); } 64: 10610209857723 10610209857723 true 65: 17167680177565 17167680177565 true 66: 2890035288 2890035288 true 67: 44945570212853 44945570212853 true 68: 72723460248141 72723460248141 true 69: 117669030460994 117669030460994 true 70: 190392490709135 190392490709135 true 71: 308061521170129 308061521170129 true 72: 498454011879264 498454011879265 false 73: 806515533049393 806515533049395 false 74: 13049695449286571304969544928660false 75: 21114850779780502111485077978055false 76: 34164546229067073416454622906715false 77: 55279397008847575527939700884771false 78: 89443943237914648944394323791487false 79: 14472334024676221 14472334024676258 false 80: 23416728348467685 23416728348467746 false
Re: If you do something dumb enough, the test runner won't print out your test failures
On 2016-10-24 14:37, Andrei Alexandrescu wrote: Cool, mine is quite similar (I don't use mc so I use RPS1). One extra thing I found useful is to display the running time of the last command if longer than 1 second. -- Andrei What do you do if it takes longer than 1 second to build the prompt ;) I use iTerm on macOS [1]. With shell integration enabled it will put a small icon in front prompt to indicate if the last command was successful or not [2]. [1] http://iterm2.com/ [2] http://iterm2.com/img/screenshots/v3-screen-shots/iterm2-shell-integration-navigation-demo.mov -- /Jacob Carlborg
Re: Repeat and chunks
On Monday, 24 October 2016 at 16:17:03 UTC, ag0aep6g wrote: On 10/24/2016 05:59 PM, Meta wrote: repeat(8, 10).chunks(3).writeln(); This will throw an AssertError because 10 is not evenly divisible by 3. chunks doesn't require that the length of the range be evenly divisible by the chunk size. See https://dlang.org/phobos/std_range.html#.Chunks Huh, you're right. I must've misread. My mistake.
Statically linking libphobos
Hello, I am distributing a plugin written in D for another application. To make it easily distributable i would prefer to link libphobos statically. How would I do that and how would I do that with DUB? Thanks :)
Re: Repeat and chunks
On Monday, 24 October 2016 at 15:59:05 UTC, Meta wrote: On Monday, 24 October 2016 at 15:28:50 UTC, Saurabh Das wrote: [...] Yes, that's correct. This is the overload of `repeat` in question: https://dlang.org/phobos/std_range.html#.repeat.2 Take!(Repeat!T) repeat(T)(T value, size_t n); Repeats value exactly n times. Equivalent to take(repeat(value), n). Examples: import std.algorithm : equal; assert(equal(5.repeat(4), 5.repeat().take(4))); The variant of repeat that takes a second argument returns a range with a length; it is not an infinite range, unlike the first overload of repeat. So for the OP's code: repeat(8, 10).chunks(3).writeln(); This will throw an AssertError because 10 is not evenly divisible by 3. Sure, but: // This fails: repeat(8, 9).chunks(3).writeln(); // This works: repeat(8, 6).chunks(3).writeln(); Both are divisible by 3. Maybe it's a bug?
Re: Repeat and chunks
On 10/24/2016 05:59 PM, Meta wrote: repeat(8, 10).chunks(3).writeln(); This will throw an AssertError because 10 is not evenly divisible by 3. chunks doesn't require that the length of the range be evenly divisible by the chunk size. See https://dlang.org/phobos/std_range.html#.Chunks
Re: Repeat and chunks
On 10/24/2016 04:25 PM, Dorian Haglund wrote: The following code crashes with DMD64 D Compiler v2.071.2: import std.algorithm; import std.stdio; import std.range; int main() { repeat(8, 10).chunks(3).writeln(); return 0; } Looks like a bug. Doesn't happen with 2.072.0-b2, so it has apparently already been fixed.
Re: Repeat and chunks
On Monday, 24 October 2016 at 15:28:50 UTC, Saurabh Das wrote: The documentation of https://dlang.org/phobos/std_range.html#.chunks mentions something about evenly divisible by chunkSize – perhaps that is the cause of the assert fail. Not 100% sure why that's there though. Thanks, Saurabh Yes, that's correct. This is the overload of `repeat` in question: https://dlang.org/phobos/std_range.html#.repeat.2 Take!(Repeat!T) repeat(T)(T value, size_t n); Repeats value exactly n times. Equivalent to take(repeat(value), n). Examples: import std.algorithm : equal; assert(equal(5.repeat(4), 5.repeat().take(4))); The variant of repeat that takes a second argument returns a range with a length; it is not an infinite range, unlike the first overload of repeat. So for the OP's code: repeat(8, 10).chunks(3).writeln(); This will throw an AssertError because 10 is not evenly divisible by 3.
Re: Repeat and chunks
On Monday, 24 October 2016 at 15:28:50 UTC, Saurabh Das wrote: On Monday, 24 October 2016 at 14:25:46 UTC, Dorian Haglund wrote: Hey, The following code crashes with DMD64 D Compiler v2.071.2: import std.algorithm; import std.stdio; import std.range; int main() { repeat(8, 10).chunks(3).writeln(); return 0; } Error message: pure nothrow @nogc @safe std.range.Take!(std.range.Repeat!(int).Repeat).Take std.range.Repeat!(int).Repeat.opSlice(ulong, ulong) If I replace repeat with iota, or a literal range (like [1, 2 ,3, 4]), I don't get the crash. I don't see why I should not be able to use chunks with repeat. If some property of repeat's range is missing to use chunks, shouldn't I get an error message ? Am I missing something ? PS: the behavior has been reproduced on someone else computer. Cheers :) This works: repeat(8, 12).chunks(3).writeln; The documentation of https://dlang.org/phobos/std_range.html#.chunks mentions something about evenly divisible by chunkSize – perhaps that is the cause of the assert fail. Not 100% sure why that's there though. Thanks, Saurabh Some more cases, perhaps someone more knowledgeable can help: import std.algorithm; import std.stdio; import std.range; int main() { [8, 8, 8, 8, 8, 8].chunks(3).writeln; // prints [[8, 8, 8], [8, 8, 8]] repeat(8, 6).writeln; // prints [8, 8, 8, 8, 8, 8] repeat(8, 6).chunks(3).writeln; // prints [[8, 8, 8]]. Why? assert([8, 8, 8, 8, 8, 8] == repeat(8, 6).array); // Passes assert([8, 8, 8, 8, 8, 8].chunks(3).array == repeat(8, 6).array.chunks(3).array); // Passes assert([8, 8, 8, 8, 8, 8].chunks(3).array == repeat(8, 6).chunks(3).map!(a => a.array).array); // Fails return 0; }
Re: Repeat and chunks
On Monday, 24 October 2016 at 14:25:46 UTC, Dorian Haglund wrote: Hey, The following code crashes with DMD64 D Compiler v2.071.2: import std.algorithm; import std.stdio; import std.range; int main() { repeat(8, 10).chunks(3).writeln(); return 0; } Error message: pure nothrow @nogc @safe std.range.Take!(std.range.Repeat!(int).Repeat).Take std.range.Repeat!(int).Repeat.opSlice(ulong, ulong) If I replace repeat with iota, or a literal range (like [1, 2 ,3, 4]), I don't get the crash. I don't see why I should not be able to use chunks with repeat. If some property of repeat's range is missing to use chunks, shouldn't I get an error message ? Am I missing something ? PS: the behavior has been reproduced on someone else computer. Cheers :) This works: repeat(8, 12).chunks(3).writeln; The documentation of https://dlang.org/phobos/std_range.html#.chunks mentions something about evenly divisible by chunkSize – perhaps that is the cause of the assert fail. Not 100% sure why that's there though. Thanks, Saurabh
[Issue 16636] Memory corruption when using OSX pthread function in 32-bit with -g enabled
https://issues.dlang.org/show_bug.cgi?id=16636 --- Comment #1 from ponce--- > Many ways not to work-around the bug: Many ways *to* work-around the bug --
[Issue 16636] New: Memory corruption when using OSX pthread function in 32-bit with -g enabled
https://issues.dlang.org/show_bug.cgi?id=16636 Issue ID: 16636 Summary: Memory corruption when using OSX pthread function in 32-bit with -g enabled Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: alil...@gmail.com DMD version: DMD64 D Compiler v2.072.0-b2 OS: macOS Sierra 10.12 on x86 processor Build test case with comand: $ rdmd -m32 -g main.d What happens is that there is a deadlock instead of finishing. Many ways not to work-around the bug: - remove the _created bool from the structure (44-byte struct instead of 48) - change the size of this boolean to 8-bytes (52 byte struct) - compile for 64-bit - remove the -g flags Source: --- main.d - import core.sys.posix.pthread; UncheckedMutex makeMutex() nothrow @nogc { return UncheckedMutex(42); } struct UncheckedMutex { private this(int dummyArg) nothrow @nogc { pthread_mutex_init( _hndl, null ); } ~this() nothrow @nogc { pthread_mutex_destroy(_hndl); } @disable this(this); /// Lock mutex void lock() nothrow @nogc { int res = pthread_mutex_lock(_hndl); if (res != 0) assert(false); } // undocumented function for internal use void unlock() nothrow @nogc { int res = pthread_mutex_unlock(_hndl ); if (res != 0) assert(false); } private: pthread_mutex_t m_hndl = cast(pthread_mutex_t)0; // removing this fix the deadlock bool _created; } void main() { auto mutex = makeMutex(); foreach(i; 0..2) { mutex.lock(); // the second call will deadlock here mutex.unlock(); } mutex.destroy(); } --- main.d - --
Repeat and chunks
Hey, The following code crashes with DMD64 D Compiler v2.071.2: import std.algorithm; import std.stdio; import std.range; int main() { repeat(8, 10).chunks(3).writeln(); return 0; } Error message: pure nothrow @nogc @safe std.range.Take!(std.range.Repeat!(int).Repeat).Take std.range.Repeat!(int).Repeat.opSlice(ulong, ulong) If I replace repeat with iota, or a literal range (like [1, 2 ,3, 4]), I don't get the crash. I don't see why I should not be able to use chunks with repeat. If some property of repeat's range is missing to use chunks, shouldn't I get an error message ? Am I missing something ? PS: the behavior has been reproduced on someone else computer. Cheers :)
Re: If you do something dumb enough, the test runner won't print out your test failures
On 10/23/2016 05:58 PM, Vladimir Panteleev wrote: On Sunday, 23 October 2016 at 21:52:26 UTC, Jonathan M Davis wrote: LOL. This was too funny not to share. I had a unittest failure in a project that I'm working on, and dub ended up just printing out Nice story, thanks for sharing :) You can change your shell prompt so it displays the exit code of the last command. It's something frequently seen in people's custom prompts. (Here's mine: https://github.com/CyberShadow/cyberzshadow) Cool, mine is quite similar (I don't use mc so I use RPS1). One extra thing I found useful is to display the running time of the last command if longer than 1 second. -- Andrei
[Issue 16514] std.socket methods are const, and thus cannot be overriden for SSLSocket, for example
https://issues.dlang.org/show_bug.cgi?id=16514 Vladimir Panteleevchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
Re: install.sh: Signature error prevents installation
On 2016-10-24 09:22, ff2000 wrote: Hi, I wanted to install dmd using the provided install.sh. With no success: $ curl -fsS https://dlang.org/install.sh | bash -s dmd Downloading and unpacking http://downloads.dlang.org/releases/2.x/2.071.2/dmd.2.071.2.linux.tar.xz 100,0% Invalid signature http://downloads.dlang.org/releases/2.x/2.071.2/dmd.2.071.2.linux.tar.xz.sig If I run gpg2 myself I get $ gpg2 -q --verify --keyring d-keyring.gpg --no-default-keyring dmd.2.071.2.linux.tar.xz.sig dmd.2.071.2.linux.tar.xz gpg: Signature made Mon Sep 19 11:49:56 2016 CEST gpg:using RSA key B273811612BB1939 gpg: Can't check signature: No public key You can use DVM [1] instead. Allows you to easily switch between multiple versions of DMD. [1] https://github.com/jacob-carlborg/dvm -- /Jacob Carlborg
Re: [OT] fastest fibbonacci
On Monday, 24 October 2016 at 08:20:26 UTC, Matthias Bentrup wrote: PS: the exact formula is fib(n) = 1/sqrt(5) * (0.5 + 0.5sqrt(5))^n - 1/sqrt(5) * (0.5 - 0.5sqrt(5))^n. If you round to integer anyway, the second term can be ignored as it is always <= 0.5. You can simply write it as: round(phi^n/sqrt(5)); Check my example above :)
[Issue 16631] Program crash when a version activates a method defined in a static library
https://issues.dlang.org/show_bug.cgi?id=16631 anonymous4changed: What|Removed |Added Keywords||safe Status|RESOLVED|REOPENED Hardware|x86_64 |All Resolution|INVALID |--- OS|Linux |All Severity|critical|enhancement --- Comment #3 from anonymous4 --- Hmm, well, can be considered an accidental breach of safety. There's probably no easy way to fix this. One option can be augmentation of compiled code with metadata that would be checked if linking is done via the compiler. --
[Issue 16631] Program crash when a version activates a method defined in a static library
https://issues.dlang.org/show_bug.cgi?id=16631 anonymous4changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from anonymous4 --- Works by design. The compiler doesn't know you compiled lib.d with incompatible flags. How would it? --
Re: [OT] fastest fibbonacci
On Sunday, 23 October 2016 at 23:17:28 UTC, Stefam Koch wrote: On Sunday, 23 October 2016 at 19:59:16 UTC, Minas Mina wrote: On Sunday, 23 October 2016 at 13:04:30 UTC, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around. It's also more concise the code is : int computeFib(int n) { int t = 1; int result = 0; while(n--) { result = t - result; t = t + result; } return result; } You can even calculate Fibonacci in O(1). An approximation of it. The fibonacci sequence can be represented exactly as a linear combination of two exponential functions, but the two bases of the exponentials and the linear multipliers of them are irrational numbers, which cannot be represented exactly on a computer. However the rounding error is so small, that rounding to int will give you always the correct answer as long as you stay within the precision limit of the floating point type you use, e.g. a real should give you 64-bit fibonacci in O(1), if the exponential function is O(1). PS: the exact formula is fib(n) = 1/sqrt(5) * (0.5 + 0.5sqrt(5))^n - 1/sqrt(5) * (0.5 - 0.5sqrt(5))^n. If you round to integer anyway, the second term can be ignored as it is always <= 0.5.
Re: How to get sqlite3.lib x64?
On Monday, 24 October 2016 at 07:20:34 UTC, Vadim Lopatin wrote: In https://github.com/buggins/ddbc there are 32bit and 64bit windows libs and dlls for sqlite3: https://github.com/buggins/ddbc/tree/master/libs Thanks a lot John and Vadim. Kind regards André
Re: [OT] fastest fibbonacci
On Sunday, 23 October 2016 at 13:04:30 UTC, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around. It's also more concise the code is : int computeFib(int n) { int t = 1; int result = 0; while(n--) { result = t - result; t = t + result; } return result; } import std.stdio; import std.math: pow; int computeFib(int n) { if (n==0) return 1; // Magic :) enum magic_1 = 1.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475; enum magic_2 = 2.23606797749978969640917366873127623544061835961152572427089724541052092563780489941441440837878227; return cast(int)((0.5+pow(magic_1,n+1))/magic_2); } void main() { for(int i = 0; i < 10; ++i) writeln(computeFib(i)); }
Re: How to get sqlite3.lib x64?
On Monday, 24 October 2016 at 05:43:00 UTC, Andre Pany wrote: Hi, I try to get sqlite3.lib for 64 Bit windows os. I tried implib with the def file and the 64 Bit dll: implib sqlite3_implib.lib sqlite3.def /system -> App crash (Windows 10) With the dll file defined: implib sqlite3_implib.lib sqlite3.dll /system -> Error message: Error(10): Error: cannot read DLL input file I have the MS Build tools installed, but the example from the SQLite site only shows, how to build a X86 dll file from the C source code but not how to build the X86_64 lib file for windows: cl sqlite3.c -link -dll -out:sqlite3.dll I tried different combinations but without success. Could you give me some hints? Kind regards André In https://github.com/buggins/ddbc there are 32bit and 64bit windows libs and dlls for sqlite3: https://github.com/buggins/ddbc/tree/master/libs
install.sh: Signature error prevents installation
Hi, I wanted to install dmd using the provided install.sh. With no success: $ curl -fsS https://dlang.org/install.sh | bash -s dmd Downloading and unpacking http://downloads.dlang.org/releases/2.x/2.071.2/dmd.2.071.2.linux.tar.xz 100,0% Invalid signature http://downloads.dlang.org/releases/2.x/2.071.2/dmd.2.071.2.linux.tar.xz.sig If I run gpg2 myself I get $ gpg2 -q --verify --keyring d-keyring.gpg --no-default-keyring dmd.2.071.2.linux.tar.xz.sig dmd.2.071.2.linux.tar.xz gpg: Signature made Mon Sep 19 11:49:56 2016 CEST gpg:using RSA key B273811612BB1939 gpg: Can't check signature: No public key Thx Franz P.S.: PLEASE (!!) reorder the buttons in this post form, so that "send" is on the very right. I just pressed "discard draft"... Luckily firefox saved the form data, so nothing got lost. It's a similar issue on github where the very right button is "post and close issue", which get's pressed quite often even from experienced github users ;)
Re: How to get sqlite3.lib x64?
On Monday, 24 October 2016 at 05:43:00 UTC, Andre Pany wrote: Hi, I try to get sqlite3.lib for 64 Bit windows os. I tried implib with the def file and the 64 Bit dll: implib sqlite3_implib.lib sqlite3.def /system -> App crash (Windows 10) With the dll file defined: implib sqlite3_implib.lib sqlite3.dll /system -> Error message: Error(10): Error: cannot read DLL input file I have the MS Build tools installed, but the example from the SQLite site only shows, how to build a X86 dll file from the C source code but not how to build the X86_64 lib file for windows: cl sqlite3.c -link -dll -out:sqlite3.dll I tried different combinations but without success. Could you give me some hints? Kind regards André Do you have the Windows 10.0.10586 SDK installed? It includes a .lib file to link against the 64-bit DLL. It's called winsqlite3.lib.
[Issue 16514] std.socket methods are const, and thus cannot be overriden for SSLSocket, for example
https://issues.dlang.org/show_bug.cgi?id=16514 --- Comment #12 from github-bugzi...@puremagic.com --- Commit pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/448ddbe2e88d66feb0df3f679bc282840ac4bb26 std.socket: Add test for issue 16514 --
Re: Battle-plan for CTFE
On Mon, Oct 24, 2016 at 8:17 AM, Stefam Koch via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote: > On Monday, 24 October 2016 at 05:57:42 UTC, Stefam Koch wrote: > >> On Sunday, 16 October 2016 at 00:27:50 UTC, Uplink_Coder wrote: >> >>> >>> Little update here: >>> The LLVM backend is almost on feature parity. >>> Meaning that that soon the new CTFE engine is a real jit. >>> In the process I discoverd quite a few horrible bugs and inconsistency >>> in the API. >>> I am quite astonished that it ever ran before :) >>> >> >> Hey Guys, >> >> I am still dealing with the many bugs that have surfaced. >> It is really crazy how something so broken could have worked that well. >> > So true of computer programming. Particularly if the documentation for the API is awol. > >> Originally I planned adding a ton of features, but that can only happen >> If the fundamental issues are fixed. >> > > However at the D Meetup in Berlin, I have gotten some positive feedback > concerning my ByteCode-Layer. > Once the bugs are fixed and the edges are smoothed over I can see finding > it's way into other parts of the compiler. > > Cool, thanks for the feedback.
Re: Battle-plan for CTFE
On Monday, 24 October 2016 at 05:57:42 UTC, Stefam Koch wrote: On Sunday, 16 October 2016 at 00:27:50 UTC, Uplink_Coder wrote: Little update here: The LLVM backend is almost on feature parity. Meaning that that soon the new CTFE engine is a real jit. In the process I discoverd quite a few horrible bugs and inconsistency in the API. I am quite astonished that it ever ran before :) Hey Guys, I am still dealing with the many bugs that have surfaced. It is really crazy how something so broken could have worked that well. Originally I planned adding a ton of features, but that can only happen If the fundamental issues are fixed. However at the D Meetup in Berlin, I have gotten some positive feedback concerning my ByteCode-Layer. Once the bugs are fixed and the edges are smoothed over I can see finding it's way into other parts of the compiler.
Re: Battle-plan for CTFE
On Sunday, 16 October 2016 at 00:27:50 UTC, Uplink_Coder wrote: Little update here: The LLVM backend is almost on feature parity. Meaning that that soon the new CTFE engine is a real jit. In the process I discoverd quite a few horrible bugs and inconsistency in the API. I am quite astonished that it ever ran before :) Hey Guys, I am still dealing with the many bugs that have surfaced. It is really crazy how something so broken could have worked that well. Originally I planned adding a ton of features, but that can only happen If the fundamental issues are fixed.