Re: Implementing typestate
On Wednesday, 16 September 2015 at 06:25:59 UTC, Ola Fosheim Grostad wrote: On Wednesday, 16 September 2015 at 05:51:50 UTC, Tobias Müller wrote: Ola Fosheim Grøstadwrote: But you need non-copyable move-only types for it to work. Yes... But will it prevent you from doing two open() in a row at compiletime? Nevermind, it needs linear typing, not only move semantics...
Re: Implementing typestate
On Wednesday, 16 September 2015 at 05:51:50 UTC, Tobias Müller wrote: Ola Fosheim Grøstadwrote: On Tuesday, 15 September 2015 at 20:34:43 UTC, Tobias Müller wrote: There's a Blog post somewhere but I can't find it atm. Ok found it: > http://pcwalton.github.io/blog/2012/12/26/typestate-is-dead/ But that is for runtime detection, not compile time? Not as far as I understand it. The marker is a type, not a value. And it's used as template param. But you need non-copyable move-only types for it to work. Yes... But will it prevent you from doing two open() in a row at compiletime?
Why do abstract class functions require definitions?
Every so often I'll get a compiler error that isn't particularly clear on what's wrong and eventually I'll figure out that what's causing it is having a function in an abstract class somewhere that isn't defined: abstract class SomeClass { int someVariable; void someFunction(); } the solution is usually: void someFunction(){} Usually the abstract class is a converted interface, but it turned out that I needed to include a variable for it to work out and I just wasn't keen on remembering to put a mixin in each derived class. I'm just wondering why I can't have an undefined function in an abstract class? I'd the compiler to say, "Hey, you forgot to put 'someFunction()' in 'SomeDerrivedClass', go do something about that." when I end a function with a semi-colon in the base class and don't have it in the derrived. Everything just seems to break in cryptic ways unless I curly brace the function ending.
[Issue 15069] nonsense struct template instantiations still compile
https://issues.dlang.org/show_bug.cgi?id=15069 Sobirari Muhomorichanged: What|Removed |Added CC||dfj1es...@sneakemail.com --- Comment #1 from Sobirari Muhomori --- *** Issue 15070 has been marked as a duplicate of this issue. *** --
[Issue 15060] Can't load a D shared library first, then load a C shared library
https://issues.dlang.org/show_bug.cgi?id=15060 --- Comment #1 from ponce--- Suggestion from David Nadlinger " This is OS X only, right? In this case, it is hard to judge where exactly it sits and what needs to be done to fix it, as no work has been done on dylib support recently in either compiler. A wild guess is that there might still be an image change handler, etc. registered that dyld tries to call when loading the new library, but which no longer exists in the program. Searching druntime for "_dyld" might reveal something of this sort." --
Re: Why do abstract class functions require definitions?
On 2015-09-16 10:49, FiveNights wrote: Every so often I'll get a compiler error that isn't particularly clear on what's wrong and eventually I'll figure out that what's causing it is having a function in an abstract class somewhere that isn't defined: abstract class SomeClass { int someVariable; void someFunction(); } the solution is usually: void someFunction(){} Usually the abstract class is a converted interface, but it turned out that I needed to include a variable for it to work out and I just wasn't keen on remembering to put a mixin in each derived class. I'm just wondering why I can't have an undefined function in an abstract class? I'd the compiler to say, "Hey, you forgot to put 'someFunction()' in 'SomeDerrivedClass', go do something about that." when I end a function with a semi-colon in the base class and don't have it in the derrived. Everything just seems to break in cryptic ways unless I curly brace the function ending. I'm guessing you see a link error. The reason you see that instead of a compile error is because D supports separate compilation. Meaning that the method could be implemented in a different library that are resolved during link time. As already answered in another post, the solution is to prefix the method declaration with "abstract". -- /Jacob Carlborg
Re: running code on the homepage
On Wednesday, 16 September 2015 at 06:44:30 UTC, nazriel wrote: On Wednesday, 16 September 2015 at 05:54:03 UTC, Andrei Amatuni wrote: maybe I'm doing something wrong...but the output of running the default code snippet on the dlang.org homepage is: "unable to fork: Cannot allocate memory" not a good look Thank you for letting us know, This issue will be fixed very soon. Best regards, Damian Ziemba Would it be possible to set things up so ones that fail are retired until they can be fixed? Non-working examples look awful for the language.
Re: Initalizing complex array types or some other problem ;/
On Wednesday, 16 September 2015 at 01:46:09 UTC, Prudence wrote: In any case, Maybe you are not as smart as you think you are if you can't understand it? Maybe next time you shouldn't assume you are the oracle of all knowledge and if you can't understand it then it's bad/wrong. In fact, it's quite simple to understand for anyone with half a brain. Seriously. Don't guess. It's not that complex and it would take you 5 mins to understand if you wanted. No reason to try and through your ego in it. "Prudence" seems not to fit well as nickname.
[Issue 15069] New: nonsense struct template instantiations still compile
https://issues.dlang.org/show_bug.cgi?id=15069 Issue ID: 15069 Summary: nonsense struct template instantiations still compile Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: john.loughran.col...@gmail.com void main() { Stuff!(Thing!float) s; } struct Stuff(T) { T!int var; } struct Thing(T) { T varling; } This compiles and makes no sense. --
Re: running code on the homepage
On Wednesday, 16 September 2015 at 05:54:03 UTC, Andrei Amatuni wrote: maybe I'm doing something wrong...but the output of running the default code snippet on the dlang.org homepage is: "unable to fork: Cannot allocate memory" not a good look Thank you for letting us know, This issue will be fixed very soon. Best regards, Damian Ziemba
Re: dpaste web site
How about just using a single click recaptcha: https://www.google.com/recaptcha/intro/index.html
Re: Implement the "unum" representation in D ?
On Tuesday, 15 September 2015 at 11:13:59 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 15 September 2015 at 10:38:23 UTC, ponce wrote: On Tuesday, 15 September 2015 at 09:35:36 UTC, Ola Fosheim Grøstad wrote: http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf That's a pretty convincing case. Who does it :)? I'm not convinced. I think they are downplaying the hardware difficulties. Slide 34: Disadvantages of the Unum Format * Non-power-of-two alignment. Needs packing and unpacking, garbage collection. I think that disadvantage is so enormous that it negates most of the advantages. Note that in the x86 world, unaligned memory loads of SSE values still take longer than aligned loads. And that's a trivial case! The energy savings are achieved by using a primitive form of compression. Sure, you can reduce the memory bandwidth required by compressing the data. You could do that for *any* form of data, not just floating point. But I don't think anyone thinks that's worthwhile. The energy comparisons are plain dishonest. The power required for accessing from DRAM is the energy consumption of a *cache miss* !! What's the energy consumption of a load from cache? That would show you what the real gains are, and my guess is they are tiny. So: * I don't believe the energy savings are real. * There is no guarantee that it would be possible to implement it in hardware without a speed penalty, regardless of how many transistors you throw at it (hardware analogue of Amdahl's Law) * but the error bound stuff is cool.
[Issue 15068] New: wrong error message on attempting to use type as template
https://issues.dlang.org/show_bug.cgi?id=15068 Issue ID: 15068 Summary: wrong error message on attempting to use type as template Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: john.loughran.col...@gmail.com void main() { Stuff!int s; } struct Stuff(T) { T!int var; } leads to the error: test.d(8): Error: template instance T!int T is not a template declaration, it is a alias T is not an alias, it's a type. --
[Issue 15071] New: filenames and module names with case-insensitive HFS+
https://issues.dlang.org/show_bug.cgi?id=15071 Issue ID: 15071 Summary: filenames and module names with case-insensitive HFS+ Product: D Version: D2 Hardware: All OS: Mac OS X Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: john.loughran.col...@gmail.com by default, OS X uses case-insensitive-but-case-preserving HFS+ and this is what almost all OS X users will have. consider the following (incorrect) code: % cat chirplet.d import mathutil; auto chirplet() { exp(0); } % cat mathUtil.d auto expi(double ) { } auto exp(T)(T c) { expi(c); } % dmd chirplet.d mathUtil.d -main Undefined symbols for architecture x86_64: "_D8mathutil4expiFNaNbNiNfdZv", referenced from: _D8mathutil10__T3expTiZ3expFNaNbNiNfiZv in chirplet.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) --- errorlevel 1 What I think is happening: While compiling chirplet.d, dmd sees `import mathutil;` and asks the filesystem for a file called `mathutil.d` in the current directory. HFS+ provides `mathUtil.d` because it doesn't know any better. dmd continues compiling and emits references to `mathutil` symbols. dmd compiles `mathUtil.d` and emits `mathUtil` symbols. Linker sees the case mismatch and fails. --
[Issue 15070] New: Template is silently extracted from type and reinstantiated
https://issues.dlang.org/show_bug.cgi?id=15070 Issue ID: 15070 Summary: Template is silently extracted from type and reinstantiated Product: D Version: D2 Hardware: All URL: http://forum.dlang.org/post/puelgpxgijdxvejsxwzy@forum .dlang.org OS: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dfj1es...@sneakemail.com import std.stdio; void main() { Stuff!(Thing!float) s; writeln(typeid(s.var)); writeln(typeid(s.var.varling)); writeln(typeid(s)); alias F=Thing!float; //F!int i; //doesn't compile } struct Stuff(T) { T!int var; } struct Thing(T) { T varling; } --
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 08:17:59 UTC, Don wrote: I'm not convinced. I think they are downplaying the hardware difficulties. Slide 34: I don't think he is downplaying it. He has said that it will probably take at least 10 years before it is available in hardware. There is also a company called Rex Computing that are looking at unum: http://www.theplatform.net/2015/07/22/supercomputer-chip-startup-scores-funding-darpa-contract/ He assumes that you use a scratchpad (a big register file), not caching, for intermediate calculations. His basic reasoning is that brute force ubox methods makes for highly parallel calculations. It might be possible to design ALUs that can work with various unum bit widths efficiently (many small or a few large)... who knows. You'll have to try first. Let's not forget that there is a _lot_ of legacy constraints and architectural assumptions in both x86 architecture. The energy comparisons are plain dishonest. The power required for accessing from DRAM is the energy consumption of a *cache miss* !! What's the energy consumption of a load from cache? I think this argument is aiming at HPC where you can find funding for ASICs. They push a lot of data over the memory bus.
[Issue 15070] Template is silently extracted from type and reinstantiated
https://issues.dlang.org/show_bug.cgi?id=15070 Sobirari Muhomorichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Sobirari Muhomori --- *** This issue has been marked as a duplicate of issue 15069 *** --
[Issue 15069] nonsense struct template instantiations still compile
https://issues.dlang.org/show_bug.cgi?id=15069 Sobirari Muhomorichanged: What|Removed |Added CC|dfj1es...@sneakemail.com| --
Re: Re-named & Selective Imports
Well, arguably disjunctive combination doesn't make much sense here, because renamed import disambiguates it all enough, but makes it impossible to merge arbitrary namespaces ad hoc, a feature I missed several times.
What kind of sorcery is that?
import std.stdio; void main() { Stuff!(Thing!float) s; writeln(typeid(s.var)); writeln(typeid(s.var.varling)); writeln(typeid(s)); } class Stuff(T) { T!int var; } class Thing(T) { T varling; }
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 08:17:59 UTC, Don wrote: On Tuesday, 15 September 2015 at 11:13:59 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 15 September 2015 at 10:38:23 UTC, ponce wrote: On Tuesday, 15 September 2015 at 09:35:36 UTC, Ola Fosheim Grøstad wrote: http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf That's a pretty convincing case. Who does it :)? I'm not convinced. I think they are downplaying the hardware difficulties. Slide 34: Disadvantages of the Unum Format * Non-power-of-two alignment. Needs packing and unpacking, garbage collection. I think that disadvantage is so enormous that it negates most of the advantages. Note that in the x86 world, unaligned memory loads of SSE values still take longer than aligned loads. And that's a trivial case! The energy savings are achieved by using a primitive form of compression. Sure, you can reduce the memory bandwidth required by compressing the data. You could do that for *any* form of data, not just floating point. But I don't think anyone thinks that's worthwhile. GPU do it a lot. Especially, but not exclusively on mobile. Not to reduce the misses (a miss is pretty much guaranteed, you load 32 thread at once in a shader core, each of them will require at least 8 pixel for a bilinear texture with mipmap, that's the bare minimum. That means 256 memory access at once. One of these pixel WILL miss, and it is going to stall the 32 threads). It is not a latency issue, but a bandwidth and energy one. But yeah, in the general case, random access is preferable, memory alignment, and the fact you don't need to do as much bookeeping are very significants. Also, predictable size mean you can split your dataset and process it in parallel, which is impossible if sizes are random. The energy comparisons are plain dishonest. The power required for accessing from DRAM is the energy consumption of a *cache miss* !! What's the energy consumption of a load from cache? That would show you what the real gains are, and my guess is they are tiny. The energy comparison is bullshit. As long as you haven't loaded the data, you don't know how wide they are. Meaning you need either to go pessimistic and load for the worst case scenario or do 2 round trip to memory. The author also use a lot the wire vs transistor cost, and how it evolved? He is right. Except that you won't cram more wire at runtime into the CPU. The CPU need the wiring for the worst case scenario, always. The hardware is likely to be slower as you'll need way more wiring than for regular floats, and wire is not only cost, but also time. That being said, even a hit in L1 is very energy hungry. Think about it, you need to go a 8 - way fetch (so you'll end up loading 4k of data from the cache) in parallel with address translation (usually 16 ways) in parallel with snooping into the load and the store buffer. If the load is not aligned, you pretty much have to multiply this by 2 if it cross a cache line boundary. I'm not sure what his number represent, but hitting L1 is quite power hungry. He is right on that one. So: * I don't believe the energy savings are real. * There is no guarantee that it would be possible to implement it in hardware without a speed penalty, regardless of how many transistors you throw at it (hardware analogue of Amdahl's Law) * but the error bound stuff is cool. Yup, that's pretty much what I get out of it as well.
Re: What kind of sorcery is that?
On Wednesday, 16 September 2015 at 08:28:24 UTC, NX wrote: import std.stdio; void main() { Stuff!(Thing!float) s; writeln(typeid(s.var)); writeln(typeid(s.var.varling)); writeln(typeid(s)); } class Stuff(T) { T!int var; } class Thing(T) { T varling; } Filed a bug: https://issues.dlang.org/show_bug.cgi?id=15069
Re: Implement the "unum" representation in D ?
On Saturday, 11 July 2015 at 18:16:22 UTC, Timon Gehr wrote: On 07/11/2015 05:07 PM, Andrei Alexandrescu wrote: On 7/10/15 11:02 PM, Nick B wrote: John Gustafson book is now out: It can be found here: http://www.amazon.com/End-Error-Computing-Chapman-Computational/dp/1482239868/ref=sr_1_1?s=books=UTF8=1436582956=1-1=John+Gustafson=1436583212284=093TDC82KFP9Y4S5PXPY Very interesting, I'll read it. Thanks! -- Andrei I think Walter should read chapter 5. What is this chapter about ?
Re: Best Direction on Spawning Process Async
On 09/15/2015 09:21 PM, Mike McKee wrote: What's the best direction from... http://dlang.org/phobos/std_process.html ...on spawning an async process and then peeking at it occasionally as it runs, and then get notified when it finishes? In other words, what std.process functions would you recommend I use? What I want to avoid is a blocking state where the GUI freezes because it's waiting for the process to complete. For instance, imagine you are building a front end GUI (like GtkD) to a command-line based antivirus scanner. You'll want to spawn the process, show a progress bar, and as the command line returns status information, you peek at it asynchronously and then update the progress bar (or perhaps store virus detected info in a table), and then stop the progress bar at 100% when the command process has finished. Sounds like an easy task for std.concurrency: import std.stdio; import std.concurrency; import core.thread; struct Progress { int percent; } struct Done { } void doWork() { foreach (percent; 0 .. 100) { Thread.sleep(100.msecs); if (!(percent % 10)) { ownerTid.send(Progress(percent)); } } ownerTid.send(Done()); } void main() { auto worker = spawn(); bool done = false; while (!done) { bool received = false; while (!received) { received = receiveTimeout( // Zero timeout is a non-blocking message check 0.msecs, (Progress message) { writefln("%s%%", message.percent); }, (Done message) { writeln("Woohoo!"); done = true; }); if (!received) { // This is where we can do more work Thread.sleep(42.msecs); write(". "); stdout.flush(); } } } } Ali
Re: Runtime error when calling a callback in a parallel Task
On Tuesday, 15 September 2015 at 23:49:23 UTC, BBasile wrote: Under Windows this works fine but under Linux I got a runtime error. this could be reduced to : [...] If it can help to understand the problem, here is the unreducted case: https://github.com/BBasile/Coedit/blob/master/cedast/src/ast.d#L343
Re: Why do abstract class functions require definitions?
declare as abstract void someFunction();
Re: Implementing typestate
On Wednesday, 16 September 2015 at 06:25:59 UTC, Ola Fosheim Grostad wrote: On Wednesday, 16 September 2015 at 05:51:50 UTC, Tobias Müller wrote: Ola Fosheim Grøstadwrote: On Tuesday, 15 September 2015 at 20:34:43 UTC, Tobias Müller wrote: There's a Blog post somewhere but I can't find it atm. Ok found it: > http://pcwalton.github.io/blog/2012/12/26/typestate-is-dead/ But that is for runtime detection, not compile time? Not as far as I understand it. The marker is a type, not a value. And it's used as template param. But you need non-copyable move-only types for it to work. Yes... But will it prevent you from doing two open() in a row at compiletime? What's wrong with two `open()`s in a row? Each will return a new file handle.
How do I change debug mode with dub?
Hey all! I'm just wondering how to run dub with different debug versions, or running it with different versions generally? Is there also a way to have code behind multiple debug versions, or run more than one debug version at once? Thanks!
Re: Why do abstract class functions require definitions?
On Wednesday, 16 September 2015 at 09:31:25 UTC, Jacob Carlborg wrote: On 2015-09-16 10:49, FiveNights wrote: Every so often I'll get a compiler error that isn't particularly clear on what's wrong and eventually I'll figure out that what's causing it is having a function in an abstract class somewhere that isn't defined: abstract class SomeClass { int someVariable; void someFunction(); } the solution is usually: void someFunction(){} Usually the abstract class is a converted interface, but it turned out that I needed to include a variable for it to work out and I just wasn't keen on remembering to put a mixin in each derived class. I'm just wondering why I can't have an undefined function in an abstract class? I'd the compiler to say, "Hey, you forgot to put 'someFunction()' in 'SomeDerrivedClass', go do something about that." when I end a function with a semi-colon in the base class and don't have it in the derrived. Everything just seems to break in cryptic ways unless I curly brace the function ending. I'm guessing you see a link error. The reason you see that instead of a compile error is because D supports separate compilation. Meaning that the method could be implemented in a different library that are resolved during link time. As already answered in another post, the solution is to prefix the method declaration with "abstract". Wouldn't the following behaviour be more useful as a default? abstract class Foo { void bar1() { } // non-abstract, obviously void bar2();// abstract, because it's in an abstract class // (different from now) extern void bar3(); // non-abstract, but defined externally }
Re: Type helpers instead of UFCS
On Saturday, 12 September 2015 at 20:37:37 UTC, BBasile wrote: UFCS is good but there are two huge problems: - code completion in IDE. It'will never work. Is is possible. DCD plans to support it: https://github.com/Hackerpilot/DCD/issues/13 I agree that this is a big issue, though, and is one of the most important things to work on.
[Issue 15072] New: [REG2.069-devel] Re-introducing codegen performance regression 14805
https://issues.dlang.org/show_bug.cgi?id=15072 Issue ID: 15072 Summary: [REG2.069-devel] Re-introducing codegen performance regression 14805 Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: performance Severity: regression Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: k.hara...@gmail.com Code snippet from test/runnable/todt.d in dmd test suite: module test; struct S14805 { ushort one; } auto a14805 = new S14805[513*513]; void main() {} Command line: dmd -c test.d Will consume cpu time. Introduced in: https://github.com/D-Programming-Language/dmd/pull/5050 --
Re: How do I change debug mode with dub?
On Wednesday, 16 September 2015 at 10:42:13 UTC, Alex_Freeman wrote: Hey all! I'm just wondering how to run dub with different debug versions, or running it with different versions generally? Is there also a way to have code behind multiple debug versions, or run more than one debug version at once? Thanks! There's lots of useful information here: http://code.dlang.org/package-format?lang=json
Re: FancyPars
On Thursday, 2 July 2015 at 14:25:09 UTC, Stefan Koch wrote: I hope that it will be suitable to beginners. Sounds like you want to share this, but I can't find a licence. In case this turns out to be useful, we would need one :-) If you want I can prepare a PR for that, just let me know which licence to pick. Best, Bastiaan.
Re: Final templated interface method not found
Thanks, it works like a charme. Kind regards André
Re: running code on the homepage
On 16-Sep-2015 09:44, nazriel wrote: On Wednesday, 16 September 2015 at 05:54:03 UTC, Andrei Amatuni wrote: maybe I'm doing something wrong...but the output of running the default code snippet on the dlang.org homepage is: "unable to fork: Cannot allocate memory" not a good look Thank you for letting us know, This issue will be fixed very soon. Best regards, Damian Ziemba May I suggest you to record such conditions with automatic notification e.g. by e-mail. Only 1 in 10 of visitors will consider reporting an issue, of these only 1 in 10 will get to dlang forum to post a message. -- Dmitry Olshansky
Re: Another, is it a bug?
On Wednesday, 16 September 2015 at 03:48:59 UTC, Random D user wrote: Yeah... I guess I was expecting it to overload across class boundaries. I mean there's already a member eat in base class and sub class can't override that since it's got different parameters, and it's a function (can't be variable), so the reasonable thing would be to overload it (which is why I tried override to see if it forces/hints overriding/overloading). Instead it creates two ambiguous names of which only one has to be disambiguated to use which seems super error prone. IMO it should just be error/warning. Given that, normally properties are just overloaded methods in D, it's pretty sad classes break this behavior/convention. It's the exact same as in Java, and probably C# as well. I don't know if there's any OOP language that overloads methods between the base and super class. https://ideone.com/En5JEc
[Issue 15073] New: SIGRTMIN is an alias to a private function
https://issues.dlang.org/show_bug.cgi?id=15073 Issue ID: 15073 Summary: SIGRTMIN is an alias to a private function Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: tomerfil...@gmail.com a simple program such as import core.sys.posix.signal; void main() { int rtmin = SIGRTMIN; } fails to compile with Error: function core.sys.posix.signal.__libc_current_sigrtmin is not accessible from module main Due to the functions being marked private in core.sys.posix.signal --
[Issue 15072] [REG2.069-devel] Re-introducing codegen performance regression 14805
https://issues.dlang.org/show_bug.cgi?id=15072 Kenji Harachanged: What|Removed |Added Keywords||pull --- Comment #1 from Kenji Hara --- https://github.com/D-Programming-Language/dmd/pull/5083 --
Re: Release D 2.068.1
Am Tue, 15 Sep 2015 08:39:41 + schrieb John Colvin: > On Monday, 14 September 2015 at 23:53:16 UTC, Martin Nowak wrote: > > On Monday, 14 September 2015 at 20:14:45 UTC, Jack Stouffer > > wrote: > >> On Monday, 14 September 2015 at 17:51:59 UTC, Martin Nowak > >> wrote: > >>> What platform are you on? > >> > >> I'm on OS X, using the homebrew version of DMD. And homebrew > >> is telling me that I have 2.068.1 installed > > > > Well I guess it's a bug in the homebrew script then. > > Nobody is setting the VERSION file and there is no git repo to > > query. > > https://github.com/Homebrew/homebrew/blob/f8b0ff3ef63e60a1da17ec8d8e68d949b1cebc27/Library/Formula/dmd.rb#L50 > > Where is the VERSION file documented? Why does it need manual > intervention only for patch releases and pre-releases? I noticed this as well. There are different VERSION files depending on where you download DMD source code from: The releases on GitHub have 2.068 while the releases on dlang.org have 2.068.1 in VERSION. That's easy to miss when you build from source. (Also the dlang.org downloads add to the DMD download statistics, which is why I use those even though they include extra binaries for all OSs.) -- Marco
[Issue 15071] filenames and module names with case-insensitive HFS+
https://issues.dlang.org/show_bug.cgi?id=15071 --- Comment #1 from Sobirari Muhomori--- >From spec: --- By convention, package and module names are all lower case. This is because those names can have a one-to-one correspondence with the operating system's directory and file names, and many file systems are not case sensitive. All lower case package and module names will minimize problems moving projects between dissimilar file systems. --- Also D is case sensitive, so you can't change identifier case and expect it to work. --
Re: "if sting in string"
A lot of thanks... i choose the (line.canFind(term)). No is not my first language, Python was my first, but i dont coding a long time...
Re: "if sting in string"
On Wednesday, 16 September 2015 at 12:55:13 UTC, smadus wrote: Hello Searching after hours, i give up and here is the question. ;) I will make a programm, this searching all txt files on the system or the path from user and searching a user tiped term in this file. http://dpaste.dzfl.pl/dec09a0f849c The Problem is in the if() "line 17" i searching in std.algorithm, but i dont find a solution for my problem. i hope, someone can help me. I'm new on D and sorry for my bad english. Happy Greetings Shorty line 17 should probably be: if(canFind(line, term)){ you had your first closing bracket in the wrong place. Also, canFind looks for the second argument inside the first argument. Other notes: There is no need to pass the arguments by ref, the data is not copied. File has a member function called byLine that can be used like this: foreach(line; actually_file.byLine()) //do something with the line see http://dlang.org/phobos/std_stdio.html#.File.byLine No need to chomp a line before using canFind on it. What are you trying to write on line 18? datei isn't defined anywhere
Re: running code on the homepage
On Wednesday, 16 September 2015 at 10:17:21 UTC, Dmitry Olshansky wrote: On 16-Sep-2015 09:44, nazriel wrote: On Wednesday, 16 September 2015 at 05:54:03 UTC, Andrei Amatuni wrote: maybe I'm doing something wrong...but the output of running the default code snippet on the dlang.org homepage is: "unable to fork: Cannot allocate memory" not a good look Thank you for letting us know, This issue will be fixed very soon. Best regards, Damian Ziemba May I suggest you to record such conditions with automatic notification e.g. by e-mail. Only 1 in 10 of visitors will consider reporting an issue, of these only 1 in 10 will get to dlang forum to post a message. well now I feel special :)
Re: running code on the homepage
On Wednesday, 16 September 2015 at 10:17:21 UTC, Dmitry Olshansky wrote: On 16-Sep-2015 09:44, nazriel wrote: On Wednesday, 16 September 2015 at 05:54:03 UTC, Andrei Amatuni wrote: maybe I'm doing something wrong...but the output of running the default code snippet on the dlang.org homepage is: "unable to fork: Cannot allocate memory" not a good look Thank you for letting us know, This issue will be fixed very soon. Best regards, Damian Ziemba May I suggest you to record such conditions with automatic notification e.g. by e-mail. Only 1 in 10 of visitors will consider reporting an issue, of these only 1 in 10 will get to dlang forum to post a message. It is know for me issue. At the time I was working on runable examples, samples on the main page were way simpler. Not we are hitting some limitations of Container Dpaste's backend is running in. I am working on new version of backend (and new container) as we speak so it will be solved once and for all. 1-2 days more and we will be done with it so IMHO no need take any additionals steps for it right now.
Re: Another, is it a bug?
On Wednesday, 16 September 2015 at 13:18:51 UTC, Meta wrote: It's the exact same as in Java, and probably C# as well. I don't know if there's any OOP language that overloads methods between the base and super class. https://ideone.com/En5JEc https://ideone.com/aIIrKM No, there's nothing like that in Java and C#.
reggae v0.5.0: new features in the D meta-build system
http://code.dlang.org/my_packages/reggae What's new: . API changes: main high-level rules are now called objectFiles, link, and scriptlike . Optional top-level targets: aren't built by default but can be built on request . Phony targets . staticLibrary rule that does what it says . unityBuild rule for C/C++ projects that builds a binary as one translation unit to speed up compilation . Support for writing build descriptions in Python, Ruby, Lua and JavaScript That last one might cause scratchy head syndrome. Why would I want to enable writing builds in a language other than D? Here's why: 1. Interpreting a build description is faster than compiling, linking and running it. Not a big deal since the build description isn't read often, but it's true 2. No confusion about when to use `enum` and when to use `alias`. Again, probably wasn't catching anybody unawares but also true 3. Not having to install a D compiler in order to generate builds - I ran into this issue at work the other day trying to use reggae on a weird VM with no root access 4. More importantly... to not limit reggae to only D developers There are quite a few build systems / tools out there in which different languages are used. Almost all of them are only used by developers of their language niche: Ruby/Rake, Python/SCons/Waf, Groovy/Java/Gradle, Haskell/Shake, etc. This is my attempt to make reggae appeal to a wider audience. I wanted to add a Lisp too but then I'd have to pick a dialect and an implemetation, only to annoy fans of other dialects. I might just do Emacs Lisp to annoy everyone equally! Also, for the lulz. Atila
"if sting in string"
Hello Searching after hours, i give up and here is the question. ;) I will make a programm, this searching all txt files on the system or the path from user and searching a user tiped term in this file. http://dpaste.dzfl.pl/dec09a0f849c The Problem is in the if() "line 17" i searching in std.algorithm, but i dont find a solution for my problem. i hope, someone can help me. I'm new on D and sorry for my bad english. Happy Greetings Shorty
Re: "if sting in string"
On 17/09/15 12:55 AM, smadus wrote: Hello Searching after hours, i give up and here is the question. ;) I will make a programm, this searching all txt files on the system or the path from user and searching a user tiped term in this file. http://dpaste.dzfl.pl/dec09a0f849c The Problem is in the if() "line 17" i searching in std.algorithm, but i dont find a solution for my problem. i hope, someone can help me. I'm new on D and sorry for my bad english. Happy Greetings Shorty Highly inefficient design in code, but lets ignore that. You want std.string : indexOf. if (line.indexOf(term) >= 0) { If I remember correctly.
[Issue 15071] filenames and module names with case-insensitive HFS+
https://issues.dlang.org/show_bug.cgi?id=15071 --- Comment #2 from John Colvin--- (In reply to Sobirari Muhomori from comment #1) > From spec: > --- > By convention, package and module names are all lower case. This is because > those names can have a one-to-one correspondence with the operating system's > directory and file names, and many file systems are not case sensitive. All > lower case package and module names will minimize problems moving projects > between dissimilar file systems. > --- > > Also D is case sensitive, so you can't change identifier case and expect it > to work. I don't expect it to work, but I do expect it to fail with a clear error message before link-time. --
Re: "if sting in string"
On Wednesday, 16 September 2015 at 12:55:13 UTC, smadus wrote: Hello Searching after hours, i give up and here is the question. ;) I will make a programm, this searching all txt files on the system or the path from user and searching a user tiped term in this file. http://dpaste.dzfl.pl/dec09a0f849c The Problem is in the if() "line 17" i searching in std.algorithm, but i dont find a solution for my problem. i hope, someone can help me. I'm new on D and sorry for my bad english. Happy Greetings Shorty Turn it into either: if (canFind(line, term)) {... or if (line.canFind(term)) {... (they are equivalent) This mistake seems odd, is D your first programming language?
[Issue 15073] SIGRTMIN is an alias to a private function
https://issues.dlang.org/show_bug.cgi?id=15073 --- Comment #1 from Tomer Filiba--- Sent a pull request: https://github.com/D-Programming-Language/druntime/pull/1386 --
Re: dpaste web site
On Wednesday, 16 September 2015 at 06:52:57 UTC, Ola Fosheim Grøstad wrote: How about just using a single click recaptcha: https://www.google.com/recaptcha/intro/index.html Used that before - still was getting spam. As Vladimir mentioned - it costs 0.001$ to get Captcha solved :)
Re: dpaste web site
On Wednesday, 16 September 2015 at 13:46:07 UTC, nazriel wrote: On Wednesday, 16 September 2015 at 06:52:57 UTC, Ola Fosheim Grøstad wrote: How about just using a single click recaptcha: https://www.google.com/recaptcha/intro/index.html Used that before - still was getting spam. As Vladimir mentioned - it costs 0.001$ to get Captcha solved :) Why don't you try to check some stats over post? I mean: to check some frequencies of common d keywords/combo like "class", "struct", "int", "float", "if(" "while(", "(int ", "(float ", etc that are not common in plain english used by spammers...
Re: dmd codegen improvements
On 28/08/2015 22:59, Walter Bright wrote: People told me I couldn't write a C compiler, then told me I couldn't write a C++ compiler. I'm still the only person who has ever implemented a complete C++ compiler (C++98). Then they all (100%) laughed at me for starting D, saying nobody would ever use it. My whole career is built on stepping over people who told me I couldn't do anything and wouldn't amount to anything. So your whole career is fundamentally based not on bringing value to the software world, but rather merely proving people wrong? That amounts to living your professional life in thrall of other people's validation, and it's not commendable at all. It's a waste of your potential. It is only worthwhile to prove people wrong when it brings you a considerable amount of either monetary resources or clout - and more so than you would have got doing something else with your time. It's not clear to me that was always the case throughout your career... was it? -- Bruno Medeiros https://twitter.com/brunodomedeiros
Re: Implementing typestate
On Wednesday, 16 September 2015 at 10:31:58 UTC, Idan Arye wrote: What's wrong with two `open()`s in a row? Each will return a new file handle. Yes, but if you do it by mistake then you don't get the compiler to check that you call close() on both. I should have written "what if you forget close()". Will the compiler then complain at compile time? You can't make that happen with just move semantics, you need linear typing so that every resource created are consumed exactly once.
Re: any way to initialize an array of structs to void?
On Wednesday, 16 September 2015 at 14:51:51 UTC, ref2401 wrote: On Wednesday, 16 September 2015 at 14:48:59 UTC, Meta wrote: Don't do this with a dynamic array, though, as they work a bit differently from static arrays. Unfortunately I have to deal with dynamic arrays. In that case, you can use std.array.uninitializedArray or std.array.minimallyInitializedArray as needed. http://dlang.org/phobos/std_array.html#uninitializedArray http://dlang.org/phobos/std_array.html#.minimallyInitializedArray
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 08:38:25 UTC, deadalnix wrote: The energy comparison is bullshit. As long as you haven't loaded the data, you don't know how wide they are. Meaning you need either to go pessimistic and load for the worst case scenario or do 2 round trip to memory. That really depends on memory layout and algorithm. A likely implementation would be a co-processor that would take a unum stream and then pipe it through a network of cores (tile based co-processor). The internal busses between cores are very very fast and with 256+ cores you get tremendous throughput. But you need a good compiler/libraries and software support. The hardware is likely to be slower as you'll need way more wiring than for regular floats, and wire is not only cost, but also time. You need more transistors per ALU, but slower does not matter if the algorithm needs bounded accuracy or if it converge more quickly with unums. The key challenge for him is to create a market, meaning getting the semantics into scientific software and getting initial workable implementations out to scientists. If there is a market demand, then there will be products. But you need to create the market first. Hence he wrote an easy to read book on the topic and support people who want to implement it.
Re: any way to initialize an array of structs to void?
On Wednesday, 16 September 2015 at 14:48:59 UTC, Meta wrote: Don't do this with a dynamic array, though, as they work a bit differently from static arrays. Unfortunately I have to deal with dynamic arrays.
Re: dmd codegen improvements
On 02/09/2015 19:58, Walter Bright wrote: On 8/29/2015 12:37 PM, Laeeth Isharc wrote: In my experience you can deliver everything people say they want, and then find it isn't that at all. That's so true. My favorite anecdote on that was back in the 1990's. A friend of mine said that what he and the world really needs was a Java native compiler. It'd be worth a fortune! I told him that I had that idea a while back, and had implemented one for Symantec. I could get him a copy that day. He changed the subject. I have many, many similar stories. I also have many complementary stories - implementing things that people laugh at me for doing, that turn out to be crucial. We can start with the laundry list of D features that C++ is rushing to adopt :-) Yes, and this I think is demonstrative of a very important consideration: if someone says they want X (and they are not paying upfront for it), then it is crucial for *you* to be able to figure out if that person or group actually wants X or not. If someone spends time building a product or feature that turns out people don't want... the failure is on that someone. And on this aspect I think the development of D does very poorly. Often people clamored for a feature or change (whether people in the D community, or the C++ one), and Walter you went ahead and did it, regardless of whether it will actually increase D usage in the long run. You are prone to this, given your nature to please people who ask for things, or to prove people wrong (as you yourself admitted). I apologize for not remembering any example at the moment, but I know there was quite a few, especially many years back. It usually went like this: C++ community guy: "D is crap, it's not gonna be used without X" *some time later* Walter: "Ok, I've now implemented X in D!" the same C++ community guy: either finds another feature or change to complain about (repeat), or goes silent, or goes "meh, D is still not good" Me and other people from D community: "ok... now we have a new half-baked functionality in D, adding complexity for little value, and put here only to please people that are extremely unlikely to ever be using D whatever any case"... -- Bruno Medeiros https://twitter.com/brunodomedeiros
any way to initialize an array of structs to void?
struct MyStruct { @disable this(); this(int a, string b) { this.a = a; this.b = b; } int a; string b; } I know there is a way to create one instance of `MyStruct` and initialize it to void. MyStruct s = void; s = MyStruct(5, "abcdef"); How can initialize an array of `MyStruct` instances to void? auto arr = new MyStruct[10]; // compile-time Error: default construction is disabled for type MyStruct.
Re: any way to initialize an array of structs to void?
On Wednesday, 16 September 2015 at 14:57:49 UTC, Meta wrote: In that case, you can use std.array.uninitializedArray or std.array.minimallyInitializedArray as needed. http://dlang.org/phobos/std_array.html#uninitializedArray http://dlang.org/phobos/std_array.html#.minimallyInitializedArray Thanks)
Weird "circular initialization of isInputRange" error
This piece of code (which I reduced with dustmite) gives me the following error when I try to compile it: $ rdmd -main parser.d parser.d(28): Error: circular initialization of isInputRange parser.d(31): Error: template instance std.meta.staticMap!(handler, ArrayReader*) error instantiating parser.d(36):instantiated from here: unpacker!(RefRange!(immutable(ubyte)[])) parser.d(40): Error: template instance std.range.primitives.isInputRange!(ArrayReader*) error instantiating /usr/include/dmd/phobos/std/meta.d(546):instantiated from here: F!(ArrayReader*) parser.d(43):instantiated from here: staticMap!(toTD, ArrayReader*) Failed: ["dmd", "-main", "-v", "-o-", "parser.d", "-I."] I'm not really sure what's causing the error; I'm not declaring `isInputRange` in my code. Commenting out the definition of `TD` (the very last line) removes the error. Am I doing something wrong here, or is this a compiler bug? Tested with dmd v2.068.1 on Linux x64 Code: - import std.range; import std.variant; import std.typetuple; /// template unpacker(Range) { /// Element data types. See `unpack` for usage. alias MsgPackData = Algebraic!( ArrayReader*, ); /// Reader range for arrays. struct ArrayReader { MsgPackData _front; void update() { _front.drain; } void popFront() { update; } } void drain(MsgPackData d) { static handler(T)(T t) { static if(isInputRange!T) data; } d.visit!(staticMap!(handler, MsgPackData.AllowedTypes)); } } alias TestUnpacker = unpacker!(RefRange!(immutable(ubyte)[])); alias D = TestUnpacker.MsgPackData; template toTD(T) { static if(isInputRange!T) alias toTD = This; } alias TD = Algebraic!(staticMap!(toTD, D.AllowedTypes)); // test data type
[Issue 15074] New: std.path.globMatch and escaping [/]/{/}
https://issues.dlang.org/show_bug.cgi?id=15074 Issue ID: 15074 Summary: std.path.globMatch and escaping [/]/{/} Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: thecybersha...@gmail.com CC: bugzi...@kyllingen.net The documentation for std.path.globMatch says: > Some characters of pattern have a special meaning (they are meta-characters) > and *can't be escaped*. In practice, this appears to be almost false. For * and ?, this can be done by "escaping" them using [*] and [?]. '[' should be escape-able as "[[]", and ']' shouldn't need to be escaped at all, except when in a [...] group, in which it could be escaped as "{[...],]}". The only case where I don't see a solution is escaping ']' in a [!...] group. Anyway, attempting to escape either [/]/{/} results in: core.exception.AssertError@std\path.d(3002): Assertion failure The source of the unexplained assert is the function's contract: in { // Verify that pattern[] is valid import std.algorithm : balancedParens; assert(balancedParens(pattern, '[', ']', 0)); assert(balancedParens(pattern, '{', '}', 0)); } Two ways about this: 1) Remove this restriction, and instead improve the implementation to treat unterminated groups during actual parsing as either an error, or implicitly closed at the end of the pattern. Perhaps also add the above escaping tricks to the documentation. 2) Declare that any use case complicated enough that you need to escape meta-characters is a use case for std.regex, not std.path, and simply improve the assert statement to produce a meaningful error message. --
Re: Another, is it a bug?
On Wednesday, 16 September 2015 at 14:08:11 UTC, Kagamin wrote: On Wednesday, 16 September 2015 at 13:18:51 UTC, Meta wrote: It's the exact same as in Java, and probably C# as well. I don't know if there's any OOP language that overloads methods between the base and super class. https://ideone.com/En5JEc https://ideone.com/aIIrKM No, there's nothing like that in Java and C#. Oh, whoops, you're right; I forgot to extend Test. My mistake.
Re: any way to initialize an array of structs to void?
On Wednesday, 16 September 2015 at 14:45:06 UTC, ref2401 wrote: struct MyStruct { @disable this(); this(int a, string b) { this.a = a; this.b = b; } int a; string b; } I know there is a way to create one instance of `MyStruct` and initialize it to void. MyStruct s = void; s = MyStruct(5, "abcdef"); How can initialize an array of `MyStruct` instances to void? auto arr = new MyStruct[10]; // compile-time Error: default construction is disabled for type MyStruct. MyStruct[10] arr = void; Don't do this with a dynamic array, though, as they work a bit differently from static arrays.
Re: No -v or -deps for gdc?
On Tuesday, 15 September 2015 at 18:12:56 UTC, Johannes Pfau wrote: Am Tue, 15 Sep 2015 12:19:34 + schrieb Atila Neves: gdmd supports those options but gdc doesn't. Is that likely to always be the case? Atila gdmd is just a wrapper around gdc. If something is supported by gdmd it must also be supported by gdc (the exact switch names might differ). See: https://github.com/D-Programming-GDC/GDMD/blob/master/dmd-script Seems like -v maps to -fd-verbose and -deps to -fdeps. Ah cool, thanks! Atila
Re: reggae v0.5.0: new features in the D meta-build system
This link should work for everyone: http://code.dlang.org/packages/reggae (I never tried reggae. Maybe I should, it looks good.) LMB On Wed, Sep 16, 2015 at 11:07 AM, Atila Neves via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote: > http://code.dlang.org/my_packages/reggae > > What's new: > . API changes: main high-level rules are now called objectFiles, link, and > scriptlike > . Optional top-level targets: aren't built by default but can be built on > request > . Phony targets > . staticLibrary rule that does what it says > . unityBuild rule for C/C++ projects that builds a binary as one > translation unit to speed up compilation > . Support for writing build descriptions in Python, Ruby, Lua and > JavaScript > > That last one might cause scratchy head syndrome. Why would I want to > enable writing builds in a language other than D? Here's why: > > 1. Interpreting a build description is faster than compiling, linking and > running it. Not a big deal since the build description isn't read often, > but it's true > 2. No confusion about when to use `enum` and when to use `alias`. Again, > probably wasn't catching anybody unawares but also true > 3. Not having to install a D compiler in order to generate builds - I ran > into this issue at work the other day trying to use reggae on a weird VM > with no root access > 4. More importantly... to not limit reggae to only D developers > > There are quite a few build systems / tools out there in which different > languages are used. Almost all of them are only used by developers of their > language niche: Ruby/Rake, Python/SCons/Waf, Groovy/Java/Gradle, > Haskell/Shake, etc. This is my attempt to make reggae appeal to a wider > audience. > > I wanted to add a Lisp too but then I'd have to pick a dialect and an > implemetation, only to annoy fans of other dialects. I might just do Emacs > Lisp to annoy everyone equally! Also, for the lulz. > > Atila >
Re: dmd codegen improvements
On Wednesday, 16 September 2015 at 14:40:26 UTC, Bruno Medeiros wrote: Me and other people from D community: "ok... now we have a new half-baked functionality in D, adding complexity for little value, and put here only to please people that are extremely unlikely to ever be using D whatever any case"... D is fun for prototyping ideas, so yes half-baked and not stable, but still useful. I'm waiting for Rust to head down the same lane of adding features and obfuscating the syntax (and their starting point is even more complex than D's was)...
Re: Implementing typestate
On Wednesday, 16 September 2015 at 14:34:05 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 16 September 2015 at 10:31:58 UTC, Idan Arye wrote: What's wrong with two `open()`s in a row? Each will return a new file handle. Yes, but if you do it by mistake then you don't get the compiler to check that you call close() on both. I should have written "what if you forget close()". Will the compiler then complain at compile time? You can't make that happen with just move semantics, you need linear typing so that every resource created are consumed exactly once. Move semantics should be enough. We can declare the destructor private, and then any code outside the module that implicitly calls the d'tor when the variable goes out of scope will raise a compilation error. In order to "get rid" of the variable, you'll have to pass ownership to the `close` function, so your code won't try to implicitly call the d'tor.
Re: How do I change debug mode with dub?
On Wednesday, 16 September 2015 at 12:04:38 UTC, Gary Willoughby wrote: On Wednesday, 16 September 2015 at 10:42:13 UTC, Alex_Freeman wrote: Hey all! I'm just wondering how to run dub with different debug versions, or running it with different versions generally? Is there also a way to have code behind multiple debug versions, or run more than one debug version at once? Thanks! There's lots of useful information here: http://code.dlang.org/package-format?lang=json Thanks for the link! I got it working with adding "debugVersions": ["whatever","I","want"] to my dub.json file :)
Thrift
Looking for a RPC library, thrift looked promising, but i can't even compile the simple example given here https://thrift.apache.org/tutorial/d to compile i've 1. copied the thrift/lib/d/src/thrift folder to my source directory 2. copied the generated sources ( tutorial and share folder ) into my source directory 3. compiling with dub and dmd 66 ( ive also tried 68 before with the same result ) dub.json: http://pastebin.com/pQSsCUAd compiling errors: http://pastebin.com/qp02S1EW please help if you know how to get a simple example with d & thrift running thx, dominik
Re: GC performance: collection frequency
On Tue, Sep 15, 2015 at 07:08:01AM +0200, Daniel Kozák via Digitalmars-d wrote: > > http://dlang.org/changelog/2.067.0.html#gc-options [...] Wow that is obscure. This really needs to go into the main docs so that it can actually be found... T -- People demand freedom of speech to make up for the freedom of thought which they avoid. -- Soren Aabye Kierkegaard (1813-1855)
Re: Implementing typestate
On Tuesday, 15 September 2015 at 21:44:25 UTC, Freddy wrote: On Tuesday, 15 September 2015 at 17:45:45 UTC, Freddy wrote: Rust style memory management in a library Wait nevermind about that part, it's harder than I thought. Yeah, I thought about type-states as a way of implementing borrowing, too. I think the biggest difficulty is that the state of one object (the owner) can be affected by what happens in other objects (i.e., it becomes mutable again when those are destroyed).
Re: Implementing typestate
On Wednesday, 16 September 2015 at 15:34:40 UTC, Idan Arye wrote: Move semantics should be enough. We can declare the destructor private, and then any code outside the module that implicitly calls the d'tor when the variable goes out of scope will raise a compilation error. In order to "get rid" of the variable, you'll have to pass ownership to the `close` function, so your code won't try to implicitly call the d'tor. Sounds plausible, but does this work in C++ and D? I assume you mean that you "reinterpret_cast" to a different type in the close() function, which is cheating, but ok :).
Re: reggae v0.5.0: new features in the D meta-build system
Ruby link points to reggae-python.
Re: Creating a DLL with a ActiveX interface.
On Monday, 14 September 2015 at 16:59:20 UTC, Adam D. Ruppe wrote: On Monday, 14 September 2015 at 15:44:36 UTC, Taylor Hillegeist wrote: So, Actually I am using NI LabVIEW to interact with my DLL. I imagine even getting hold of of that would troublesome or expensive. Ah, all right. Here's a SO thing (followed up by email then Fortunately I am working with Win7, And the below function seems to work beautifully. export extern (Windows) void SayHello(Variant *Input_Variant) { string A = "HELLO WORLD!"; Input_Variant.CA_VariantSetCString(A.ptr); } My goal was to store variants in an associative array Variant[string] and use this as a portable interpreter returning the resulting Variant. but that runs into some memory questions that I am not as savvy with. 1. Memory: I need to manage memory from the dll. I can give the caller a pointer to manage, but I don't think that is visible from gc. There should be different associtive arrays for different objects in the caller. How do I manage this? 2. Threads: I would like this to be as parallel as possible one objects call to its data should not hinder anothers. I have seen on the Memory managment page http://wiki.dlang.org/Win32_DLLs_in_D but I would like to know more.
Re: dpaste web site
On Wednesday, 16 September 2015 at 16:12:03 UTC, Kagamin wrote: On Wednesday, 16 September 2015 at 13:54:36 UTC, Andrea Fontana wrote: I mean: to check some frequencies of common d keywords/combo like "class", "struct", "int", "float", "if(" "while(", "(int ", "(float ", etc that are not common in plain english used by spammers... Solving dcaptcha costs maybe 1$, so it should solve the problem of human spammers (too expensive). I dunno, I reckon I could solve them in ~5 seconds each, especially with practice... At $1/solve it'd be one hell of an hourly rate!
Re: Implementing typestate
On Wednesday, 16 September 2015 at 16:24:49 UTC, Idan Arye wrote: No need for `reinterpret_cast`. The `close` function is declared in the same module as the `File` struct, so it has access to it's private d'tor. True, so it might work for D. Interesting.
Re: dpaste web site
On Wednesday, 16 September 2015 at 13:54:36 UTC, Andrea Fontana wrote: I mean: to check some frequencies of common d keywords/combo like "class", "struct", "int", "float", "if(" "while(", "(int ", "(float ", etc that are not common in plain english used by spammers... Solving dcaptcha costs maybe 1$, so it should solve the problem of human spammers (too expensive).
Re: Implementing typestate
On Wednesday, 16 September 2015 at 15:57:14 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 16 September 2015 at 15:34:40 UTC, Idan Arye wrote: Move semantics should be enough. We can declare the destructor private, and then any code outside the module that implicitly calls the d'tor when the variable goes out of scope will raise a compilation error. In order to "get rid" of the variable, you'll have to pass ownership to the `close` function, so your code won't try to implicitly call the d'tor. Sounds plausible, but does this work in C++ and D? I assume you mean that you "reinterpret_cast" to a different type in the close() function, which is cheating, but ok :). No need for `reinterpret_cast`. The `close` function is declared in the same module as the `File` struct, so it has access to it's private d'tor.
Re: Best Direction on Spawning Process Async
Beautiful, Ali. Took me a bit to read here... http://dlang.org/phobos/std_concurrency.html ...but I realized that receiveTimeout() was a std.concurrency class method.
Re: Best Direction on Spawning Process Async
This really shows the beauty and simplicity of the D language compared to C++. Check this out in Qt/C++: http://stackoverflow.com/questions/32593463/spawn-async-qprocess-from-dynamic-library-peek-output-until-done ...see how much nicer the D version is here that Ali did, versus the Qt/C++ technique.
Re: Implement the "unum" representation in D ?
On 09/16/2015 10:17 AM, Don wrote: So: ... * There is no guarantee that it would be possible to implement it in hardware without a speed penalty, regardless of how many transistors you throw at it (hardware analogue of Amdahl's Law) https://en.wikipedia.org/wiki/Gustafson's_law :o)
Re: Overview of D User Groups?
On 09/16/2015 11:56 AM, qznc wrote: Is there an overview of D user groups somewhere? There is one in Berlin and one in the Valley, apparently. Walter participates in the Cpp group in Seattle or something, if I remember correctly. If a Meetup group happens to list the right keywords (topics?) then it shows up on this map: http://dpl.meetup.com/ Ali
Re: Runtime error when calling a callback in a parallel Task
On 09/15/2015 04:49 PM, BBasile wrote: Under Windows this works fine but under Linux I got a runtime error. Can it be because 'param' is invalid at the time clbck is called? The following program works under Linux. However, removing thread_joinAll() is a bug: import std.parallelism; import std.stdio; alias CallBack = void function(void*); class Foo { CallBack clbck; void* param; void dotask() { // some heavy processing // tells the caller that some fresh data are available if(clbck) clbck(param); // debugger breaks HERE } void call() { task().executeInNewThread; // returns directly but the caller will get a notif when finished } } void handler(void* p) { writefln("Finishing with %s at %s", *(cast(int*)p), p); } void main() { auto foo = new Foo(); foo.clbck = int i = 42; foo.param = foo.call(); import core.thread; thread_joinAll(); } Ali
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 14:11:04 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 16 September 2015 at 08:38:25 UTC, deadalnix wrote: The energy comparison is bullshit. As long as you haven't loaded the data, you don't know how wide they are. Meaning you need either to go pessimistic and load for the worst case scenario or do 2 round trip to memory. That really depends on memory layout and algorithm. A likely implementation would be a co-processor that would take a unum stream and then pipe it through a network of cores (tile based co-processor). The internal busses between cores are very very fast and with 256+ cores you get tremendous throughput. But you need a good compiler/libraries and software support. No you don't. Because the streamer still need to load the unum one by one. Maybe 2 by 2 with a fair amount of hardware speculation (which means you are already trading energy for performances, so the energy argument is weak). There is no way you can feed 256+ cores that way. To gives you a similar example, x86 decoding is often the bottleneck on an x86 CPU. The number of ALUs in x86 over the past decade decreased rather than increased, because you simply can't decode fast enough to feed them. Yet, x86 CPUs have a 64 ways speculative decoding as a first stage. The hardware is likely to be slower as you'll need way more wiring than for regular floats, and wire is not only cost, but also time. You need more transistors per ALU, but slower does not matter if the algorithm needs bounded accuracy or if it converge more quickly with unums. The key challenge for him is to create a market, meaning getting the semantics into scientific software and getting initial workable implementations out to scientists. If there is a market demand, then there will be products. But you need to create the market first. Hence he wrote an easy to read book on the topic and support people who want to implement it. The problem is not transistor it is wire. Because the damn thing is variadic in every ways, pretty much every bit as input can end up anywhere in the functional unit. That is a LOT of wire.
LDC 0.16.0 alpha3 is out! Get it, test it, give feedback!
Hi everyone, LDC 0.16.0 alpha3, the LLVM-based D compiler, is available for download! This release is based on the 2.067.1 frontend and standard library and supports LLVM 3.1-3.7 (OS X: no support for 3.3). Don't miss to check if your preferred system is supported by this release. There is even an alpha-quality Win64 version available! As usual, you can find links to the changelog and the binary packages over at digitalmars.D.ldc: http://forum.dlang.org/post/numjnaginhfmocbqg...@forum.dlang.org Regards, Kai
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 19:40:49 UTC, Ola Fosheim Grøstad wrote: You can load continuously 64 bytes in a stream, decode to your internal format and push them into the scratchpad of other cores. You could even do this in hardware. 1/ If you load the worst case scenario, then your power advantage is gone. 2/ If you load these one by one, how do you expect to feed 256+ cores ? Obviously you can make this in hardware. And obviously this is not going to be able to feed 256+ cores. Even with a chip at low frequency, let's say 800MHz or so, you have about 80 cycles to access memory. That mean you need to have 20 000+ cycles of work to do per core per unum. That simple back of the envelope calculation. Your proposal is simply ludicrous. It's a complete non starter. You can make this in hardware. Sure you can, no problem. But you won't because it is a stupid idea. To gives you a similar example, x86 decoding is often the bottleneck on an x86 CPU. The number of ALUs in x86 over the past decade decreased rather than increased, because you simply can't decode fast enough to feed them. Yet, x86 CPUs have a 64 ways speculative decoding as a first stage. That's because we use a dumb compiler that does not prefetch intelligently. You know, when you have no idea what you are talking about, you can just move on to something you understand. Prefetching would not change anything here. The problem come from variable size encoding, and the challenge it causes for hardware. You can have 100% L1 hit and still have the same problem. No sufficiently smart compiler can fix that. If you are writing for a tile based VLIW CPU you preload. These calculations are highly iterative so I'd rather think of it as a co-processor solving a single equation repeatedly than running the whole program. You can run the larger program on a regular CPU or a few cores. That's irrelevant. The problem is not the kind of CPU, it is how do you feed it at a fast enough rate. The problem is not transistor it is wire. Because the damn thing is variadic in every ways, pretty much every bit as input can end up anywhere in the functional unit. That is a LOT of wire. I haven't seen a design, so I cannot comment. But keep in mind that the CPU does not have to work with the format, it can use a different format internally. We'll probably see FPGA implementations that can be run on FPGU cards for PCs within a few years. I read somewhere that a group in Singapore was working on it. That's hardware 101. When you have a floating point unit, you get your 32 bits you get 23 bits that go into the mantissa FU and 8 in the exponent FU. For instance, if you multiply floats, you send the 2 exponent into a adder, you send the 2 mantissa into a 24bits multiplier (you add a leading 1), you xor the bit signs. You get the carry from the adder, and emit a multiply, or you count the leading 0 of the 48bit multiply result, shift by that amount and add the shit to the exponent. If you get a carry in the exponent adder, you saturate and emit an inifinity. Each bit goes into a given functional unit. That mean you need on wire from the input to the functional unit is goes to. Sale for these result. Now, if the format is variadic, you need to wire all bits to all functional units, because they can potentially end up there. That's a lot of wire, in fact the number of wire is growing quadratically with that joke. The author keep repeating that wire became the expensive thing and he is right. Meaning a solution with quadratic wiring is not going to cut it.
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 08:38:25 UTC, deadalnix wrote: Also, predictable size mean you can split your dataset and process it in parallel, which is impossible if sizes are random. I don't recall how he would deal with something similar to cache misses when you have to promote or demote a unum. However, my recollection of the book is that there was quite a bit of focus on a unum representation that has the same size as a double. If you only did the computations with this format, I would expect the sizes would be more-or-less fixed. Promotion would be pretty rare, but still possible, I would think. Compared to calculations with doubles there might not be a strong case for energy efficiency (but I don't really know for sure). My understanding was that the benefit for energy efficiency is only when you use a smaller sized unum instead of a float. I don't recall how he would resolve your point about cache misses. Anyway, while I can see a benefit from using unum numbers (accuracy, avoiding overflow, etc.) rather than floating point numbers, I think that performance or energy efficiency would have to be within range of floating point numbers for it to have any meaningful adoption.
Silicon Valley D Meetup September 2015
"Introducing ultraviolet-d, a web framework for REST-ful services" http://www.meetup.com/D-Lang-Silicon-Valley/events/224948581/ Ali
Re: Release D 2.068.1
On Tuesday, 15 September 2015 at 08:39:43 UTC, John Colvin wrote: Where is the VERSION file documented? Why does it need manual intervention only for patch releases and pre-releases? We should prolly remove the manually updated VERSION file. The other build scripts update the file or pass VERSION=bla to make.
Overview of D User Groups?
Is there an overview of D user groups somewhere? There is one in Berlin and one in the Valley, apparently. Walter participates in the Cpp group in Seattle or something, if I remember correctly.
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 19:21:59 UTC, deadalnix wrote: No you don't. Because the streamer still need to load the unum one by one. Maybe 2 by 2 with a fair amount of hardware speculation (which means you are already trading energy for performances, so the energy argument is weak). There is no way you can feed 256+ cores that way. You can load continuously 64 bytes in a stream, decode to your internal format and push them into the scratchpad of other cores. You could even do this in hardware. If you look at the ubox brute forcing method you compute many calculations over the same data, because you solve spatially, not by timesteps. So you can run many many parallell computations over the same data. To gives you a similar example, x86 decoding is often the bottleneck on an x86 CPU. The number of ALUs in x86 over the past decade decreased rather than increased, because you simply can't decode fast enough to feed them. Yet, x86 CPUs have a 64 ways speculative decoding as a first stage. That's because we use a dumb compiler that does not prefetch intelligently. If you are writing for a tile based VLIW CPU you preload. These calculations are highly iterative so I'd rather think of it as a co-processor solving a single equation repeatedly than running the whole program. You can run the larger program on a regular CPU or a few cores. The problem is not transistor it is wire. Because the damn thing is variadic in every ways, pretty much every bit as input can end up anywhere in the functional unit. That is a LOT of wire. I haven't seen a design, so I cannot comment. But keep in mind that the CPU does not have to work with the format, it can use a different format internally. We'll probably see FPGA implementations that can be run on FPGU cards for PCs within a few years. I read somewhere that a group in Singapore was working on it.
Re: Implement the "unum" representation in D ?
On 09/16/2015 10:46 AM, deadalnix wrote: On Saturday, 11 July 2015 at 18:16:22 UTC, Timon Gehr wrote: On 07/11/2015 05:07 PM, Andrei Alexandrescu wrote: On 7/10/15 11:02 PM, Nick B wrote: John Gustafson book is now out: It can be found here: http://www.amazon.com/End-Error-Computing-Chapman-Computational/dp/1482239868/ref=sr_1_1?s=books=UTF8=1436582956=1-1=John+Gustafson=1436583212284=093TDC82KFP9Y4S5PXPY Very interesting, I'll read it. Thanks! -- Andrei I think Walter should read chapter 5. What is this chapter about ? Relevant quote: "Programmers and users were never given visibility or control of when a value was promoted to “double extended precision” (80-bit or higher) format, unless they wrote assembly language; it just happened automatically, opportunistically, and unpredictably. Confusion caused by different results outweighed the advantage of reduced rounding-overflow-underflow problems, and now coprocessors must dumb down their results to mimic systems that have no such extra scratchpad capability."
Re: Implementing typestate
On Wednesday, 16 September 2015 at 18:01:29 UTC, Marc Schütz wrote: typestate(alias owner) { this.owner := owner; // re-alias operator this.owner.refcount++; } I don't think this is possible to establish in the general case. Wouldn't this require a full theorem prover? I think the only way for that to work is to fully unroll all loops and hope that a theorem prover can deal with it. Either that or painstakingly construct a proof manually (Hoare logic). Like, how can you statically determine if borrowed references stuffed into a queue are all released? To do that you must prove when the queue is empty for borrowed references from a specific object, but it could be interleaved with references to other objects.
Re: Implementing typestate
On Wednesday, 16 September 2015 at 18:41:33 UTC, Ola Fosheim Grøstad wrote: I don't think this is possible to establish in the general case. Wouldn't this require a full theorem prover? I think the only way for that to work is to fully unroll all loops and hope that a theorem prover can deal with it. For example: Object obj = create(); for ... { (Objectobj, Ref
Re: Load Qt UI XML File as GUI
On 09/15/2015 09:36 PM, Steven Schveighoffer wrote: On 9/16/15 12:03 AM, Mike McKee wrote: Unfortunately, the http://dsource.org/forums/ doesn't appear to be active -- I can't login after I registered. This is where the QtD project has their forum. So, I'm asking this here. Seems to have moved here, but it doesn't look fresh: https://bitbucket.org/qtd/ dsource is dead (only there for archive reasons), don't use it. -Steve I wonder why this older one exists: https://github.com/qtd-developers/qtd Ali
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 21:12:11 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 16 September 2015 at 20:53:37 UTC, deadalnix wrote: On Wednesday, 16 September 2015 at 20:30:36 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 16 September 2015 at 20:06:43 UTC, deadalnix wrote: You know, when you have no idea what you are talking about, you can just move on to something you understand. Ah, nice move. Back to your usual habits? Stop OK. I stop. You are beyond reason. True, how blind I was. It is fairly obvious now, thinking about it, that you can get 3 order of magnitude increase in sequential decoding in hardware by having a compiler with a vectorized SSA and a scratchpad ! Or maybe you have number to present us that show I'm wrong ?
Desperately looking for a work-around to load and unload D shared libraries from C on OSX
Context: On OSX, a C program can load a D shared library but once unloaded the next dlopen will crash, jumping into a callback that doesn't exist anymore. I've filed it here: https://issues.dlang.org/show_bug.cgi?id=15060 It looks like this was known and discussed several times already: http://forum.dlang.org/post/vixoqmidlbizawbxm...@forum.dlang.org (2015) https://github.com/D-Programming-Language/druntime/pull/228 (2012) Any idea to work-around this problem would be awesome. I'm not looking for something correct, future-proof, or pretty. Any shit that still stick to the wall will do. Anything! The only case I need to support is: C host, D shared library, with runtime statically linked. Please help!
Re: Implement the "unum" representation in D ?
On Wednesday, 16 September 2015 at 08:53:24 UTC, Ola Fosheim Grøstad wrote: I don't think he is downplaying it. He has said that it will probably take at least 10 years before it is available in hardware. There is also a company called Rex Computing that are looking at unum: Oh hey, I remember these jokers. They were trying to blow some smoke about moving 288 GB/s at 4W. They're looking at unum? Of course they are; care to guess who's advising them? Yep. I'll be shocked if they ever even get to tape out. -Wyatt