[Issue 15628] New: Exceptions in fibers never caught with /SAFESEH
https://issues.dlang.org/show_bug.cgi?id=15628 Issue ID: 15628 Summary: Exceptions in fibers never caught with /SAFESEH Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: r.sagita...@gmx.de When a Win32 program is linked with /SAFESEH (not supported by DMD, but with LDC), a unittest in core.thread fails, i.e. the one with throwAndYield(). The exception is never caught because the OS considers the exception chain invalid. --
[Issue 15626] extern(C++) calling crash
https://issues.dlang.org/show_bug.cgi?id=15626 --- Comment #2 from Walter Bright--- Stripping away the unnecessary template and complex names: -- D - extern(C++) { class C { } interface I { void f(); } abstract class Base : I { int instance; } void test(Base b) { b.f(); } void mainx(); } int main() { mainx(); return 0; } - C++ #include class C { }; class I { virtual void f() = 0; }; class Base : public I { public: int pInstance; Base() { pInstance = 0xBAADF00D; } }; class Derived : public Base { public: void f() { printf("!!"); } }; void test(Base *b); void mainx() { Derived *d = new Derived; test(d); } --
Re: d plugin for Intelij Idea debuging support
On Friday, 29 January 2016 at 12:00:25 UTC, Pavel wrote: Hello! Is there any debuging support for Intelij Idea's D plugin? Thanks! Currently only XamarinStudio/MonoDevelop and DlangIDE allow debugging on Linux through GDB. On Windows VisaulD provides debugging support for Visual Studio.
Re: Why is it a memory ERRO.
On Saturday, 30 January 2016 at 05:50:33 UTC, Dsby wrote: Ok.Thank you. and i want to know how to know when the GC start runing? See also http://dlang.org/phobos/core_memory
[Issue 15627] @safe code generates access violation
https://issues.dlang.org/show_bug.cgi?id=15627 ZombineDevchanged: What|Removed |Added URL||wrong-code CC||petar.p.ki...@gmail.com Hardware|x86_64 |All OS|Windows |All Severity|normal |critical --
Re: Dub packages: Best practices for windows support
Am Sat, 30 Jan 2016 01:17:13 + schrieb Mike Parker: > On Friday, 29 January 2016 at 19:46:40 UTC, Johannes Pfau wrote: > > > Now on windows, things are more complicated. First of all, I > > can't seem > > to simply use "libs": ["foo"] as the linker won't find the C > > import .lib file. Then apparently there's no way to add a > > library search > > path with the MSVC linker? So I have to use the full path: > > "libs": [$PACKAGE_DIR\\path\\foo]. Without $PACKAGE_DIR paths > > are > > incorrect for applications using the library because of a dub > > problem. > > And then I'll have to use different import libraries and paths > > for -m32, > > -m64 and -m32mscoff. > > Now you know my motivation for creating Derelict. > > > > All this leads to the following questions: > > * Should cairoD copy the DLLs for all applications using > > cairoD? This > > way simply adding a dependency will work. However, if users > > want to > > use a self compiled cairo DLL with fewer dependencies there's > > no easy > > way to disable the file copying? > > * Should cairoD link in the .lib DLL import file? This might be > > useful > > even when not copying the DLLs. But if users want to link a > > custom > > import library that would be difficult. OTOH not copying DLLs > > and/or > > not linking the import library will make dub.json much more > > complicated for simple applications, especially if these > > applications > > want to support -m32, -m32mscoff and -m64. > > IMO, no to both of these (for now). Including all of these > dependencies is going to mean that all of your users, no matter > the platform, will pull the down with every new version of gtkd. > I recommend you provide all of the precompiled DLLs and import > libraries as a separate download and let the user do the > configuration needed to get it to link. Most Windows developers > are used to it. You can provide instructions for those who aren't. Thanks for the detailed answer. Thinking about this some more, copying the DLLs automatically is really a bad idea. The cairo dll depends on Freetype, so I'd have to ship a Freetype dll as well. But cairoD depends on DerelictFT and if DerelictFT then decided to also install DLLs automatically anything could happen. So even in this simple case installing DLLs for the user is not a good idea.
Re: `alias this` pointers and typeof(null)
On Saturday, 30 January 2016 at 17:49:41 UTC, Nick Treleaven wrote: I've heard (on This Week in D) that C++ implicit construction wouldn't be so bad if it only worked when a constructor was specially marked for that purpose, e.g.: struct FooPtr { ... @implicit this(typeof(null)) {ptr = null;} } Then null could be passed as a FooPtr. +1 on that!
Re: Better docs for D (WIP)
On Saturday, 30 January 2016 at 21:22:02 UTC, Chris Wright wrote: You probably know about this, but some of the source code formatting is a little off (and allowing javascript / cross-site requests doesn't help). Right, the contract formatter is something I started a while ago but not finished yet. And actually, a lot of the contracts are ugly anyway, even if nicely formatted (that is, the code is more implementation-focused than presentable as documentation), so I'm not sure trying to print them is actually a good idea. This is the original source of your picture: in { static if (hasLength!Range) { // TODO: core.checkedint supports mixed signedness yet? import core.checkedint : adds, addu; import std.conv : ConvException, to; alias LengthType = typeof(range.length); bool overflow; static if(isSigned!Enumerator && isSigned!LengthType) auto result = adds(start, range.length, overflow); else static if(isSigned!Enumerator) { Largest!(Enumerator, Signed!LengthType) signedLength; try signedLength = to!(typeof(signedLength))(range.length); catch(ConvException) overflow = true; catch(Exception) assert(false); auto result = adds(start, signedLength, overflow); } else { static if(isSigned!LengthType) assert(range.length >= 0); auto result = addu(start, range.length, overflow); } assert(!overflow && result <= Enumerator.max); } } It is certainly nicer when correctly formatted... but still, what is that actually saying? The initial part is more readable than the original source code, but the in contract is a bit messy. aye, that's where I spent all the time. Even with that, this is a lot easier and more approachable than the dlang.org docs. Thanks! awesome
[Issue 15628] Exceptions in fibers never caught with /SAFESEH
https://issues.dlang.org/show_bug.cgi?id=15628 --- Comment #2 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/44285e90d946f677273e9d8365af7862c2ff1c9b Merge pull request #1489 from rainers/safeseh_fibers Fix issue 15628: exception handling in fibers with /SAFESEH --
How do you initialize a class instance which has static storage within another class?
class A { static B b; } class B {} doing b = new B() does NOT work. Nor could I create a this() {} at module level
Re: D vs Rust
Laeeth Isharc: On Saturday, 30 January 2016 at 16:51:09 UTC, Laeeth Isharc wrote: I haven't used Ocaml, but was intrigued by it after seeing Yaron Minsky's talks. To what extent can pattern matching, strong types with invariants and other things Ocaml features be implemented idiomatically in D? Eg I know D has invariants, but that seems to be more a debug mode thing, and I am not sure if they are doing the same as what Minsky described in his talk. Rust allows you to write very OCaML-like code, the main difference is that you need to memory manage manually (and Rust doesn't have a GIL). D Algebraic isn't very good, and the D/Phobos pattern matching is minimal, so to write compiler-like code in D you need a style quite different from the OcaML/F#/SML/Haskell code. On the other hand Rust is less flexible, sometimes even C-like for loops are not handy to do in Rust. The Servo browser and the Rustc compiler are two of the main projects written in Rust, so sometimes Rust looks like a browswer-driven language, and this means Rust developers sometimes seem to not understand or not care that lot of people have other different needs. There are several kinds of code that D allows you to write quite better than Rust (generic application code, script-like code, explorative scientific numerical code (like ndslice), medium-integrity code, metaprogramming, compile-time computations, template-level computations and specializations, higher order template magic, and so on. In general Rust seems a more specialized language). How productive do you find coding in Ada ? In Ada you can be productive if you use it for the purposes it was invented for, but most times you don't write that kind of code. I miss some Ada features, and I've missed the strictness of the Ada compiler that catches lot of bugs, but for most things today I prefer a more modern languages. In Ada you need more time to write the code and make it run, but later you save some debugging time, even compared to D. I like languages that avoid me most common bugs, even if I need more time to write it. To write Ada code you need to remember lot of times, because Ada is a quite large language, but most things are quite logical and straightforward, so learning Ada is just a matter of having elephant's memory, you don't need to be smart. Rust is a much smaller language, but you need to think more about your code, otherwise it will never compile :-) D is more like Python, you don't need lot of memory to use it, and the garbage collector saves you lot of thinking (if you are writing small programs). I think D should relax and keep improving its strengths (like C++ interoperability), fix some of its holes (safety, GC-less programming, fixing its contract-driven programming experience, etc), improve its medium-integrity coding, and keep going on as usual, slowly getting better. The Rust and D niches are sufficiently different, there's minimal overlapping in their purposes and niches. Bye, bearophile
Re: extern(C++, ns)
On Thursday, 7 January 2016 at 18:17:24 UTC, Walter Bright wrote: On 1/7/2016 9:02 AM, Carl Sturtivant wrote: I should have noticed this too; so in fact the current design can be used ignoring the scope modeling the C++ namespace. If the details of using such an external name in that fashion are identical to any other name at module scope in every context, then I therefore concede that the design is OK, because it may be treated as the alternative suggested in various ways in this thread by simply ignoring the new scope by not using its name. The idea is most definitely that it follows the usual D scoping and name lookup rules. Note that 'alias' works much like symbolic links do in the Linux filesystem, in that it can make names appear in multiple scopes without needing qualification. So what do you make of Manu's last post? http://forum.dlang.org/post/mailman.3421.1452230079.22025.digitalmar...@puremagic.com Specifically, he gives examples of name collisions and scope problems that apparently could be avoided simply only if there is no named scope modeling a C++ namespace.
Re: Better docs for D (WIP)
On Sat, 30 Jan 2016 20:58:44 +, Adam D. Ruppe wrote: > Just want to update y'all that my better docs continue to improve with > each passing week. > > I just did a style facelift on the members section: > > http://dpldocs.info/experimental-docs/std.algorithm.setops.html Oh god, that's lovely. It works even with outrageously strict security policies in the browser. You probably know about this, but some of the source code formatting is a little off (and allowing javascript / cross-site requests doesn't help). Example: http://ikeran.org/images/std.range.enumerate.png The initial part is more readable than the original source code, but the in contract is a bit messy. Even with that, this is a lot easier and more approachable than the dlang.org docs. Thanks!
[Issue 15628] Exceptions in fibers never caught with /SAFESEH
https://issues.dlang.org/show_bug.cgi?id=15628 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
Re: reduce -> fold?
On 01/29/2016 02:56 PM, Dragos Carp wrote: On Friday, 29 January 2016 at 13:11:34 UTC, Luís Marques wrote: Just to bikeshed a little, I remember that when I first started using std.algorithm I was ctrl-F'ing for "accumulate" and not finding it quite often. D competes with C++ directly, so do consider that name :-) But not in python, where "accumulate"[1] is the generic equivalent of C++ "partial_sum"[2]. I like "fold" more. BTW this week, a colleague of mine implemented a python "accumulate" in D. Is there any interest to contribute it to Phobos? How should this be named? [1] https://docs.python.org/3/library/itertools.html#itertools.accumulate [2] http://en.cppreference.com/w/cpp/algorithm/partial_sum "scan" http://hackage.haskell.org/package/base-4.8.2.0/docs/Prelude.html#v:scanl
Re: Access Violation in @safe Code
On Saturday, 30 January 2016 at 13:37:43 UTC, Kagamin wrote: Alias templates require stack pointer, init probably has it set to null. Try this: FooType foo = FooType(); Yes, that fixed it. Interesting.
Re: extern(C++, ns)
On Saturday, 30 January 2016 at 21:06:22 UTC, Carl Sturtivant wrote: So what do you make of Manu's last post? http://forum.dlang.org/post/mailman.3421.1452230079.22025.digitalmar...@puremagic.com Specifically, he gives examples of name collisions and scope problems that apparently could be avoided simply only if there is no named scope modeling a C++ namespace. Apologies, I somehow posted while unaware of all the intervening discussion.
Re: extern(C++, ns)
On Friday, 22 January 2016 at 17:04:00 UTC, Jacob Carlborg wrote: Unfortunately that's not how it works with D. If Andrei or Walter have a proposal it's up to the community to provide compelling evidence why it _should not_ be added. If the community has a proposal it's up to the community to provide compelling evidence why is _should_ be added. Just to make sure there are no misunderstandings: This is not at all the point I was trying to make. My arguments apply just as well to just a single person deliberating the design: Adding a new feature requires justification, especially if the language is quite large already. Not adding one does not to the same extent, because it is the natural, less risky choice. — David
Re: New D book available for pre-order: D Web Development
On Saturday, 30 January 2016 at 12:40:55 UTC, Daniel Kozak wrote: On Sunday, 24 January 2016 at 14:35:53 UTC, Kai Nacke wrote: On Sunday, 24 January 2016 at 13:03:42 UTC, notna wrote: Any news? Just some days left until "January 2016" is over ;) I am checking the pre-final PDFs of the last chapters right now. Publishing date will be very soon Regards, Kai It is available now :) I expected them to send an email notification. I can access it, but wouldn't have known without your post.
Re: reduce -> fold?
On Saturday, 30 January 2016 at 17:40:38 UTC, Andrei Alexandrescu wrote: On 1/30/16 12:25 PM, Xinok wrote: I forgot the distinction between currying and partial application. Can we also define currying in current D? -- Andrei I'm sure others can give an informed answer on the distinction, but a curried function takes only one argument, and I am unaware of a practical reason to add currying to D if we already have partial application.
Re: New D book available for pre-order: D Web Development
On Saturday, 30 January 2016 at 17:58:23 UTC, Jacob Carlborg wrote: On 2016-01-30 18:33, barberian wrote: Yes, in fact the ebook it's expensive in this case, and where I live we "unfortunately" need to convert the pound multiplying by 6, ouch! How can two things be cheaper than one? It doesn't add up. Is there a mistake? Just noticed that it's the same for Learning D. Combo is 50% off, ebook is full price.
Re: Pipe one shell command into another
On Saturday, 30 January 2016 at 15:12:26 UTC, Andrew wrote: foreach(line; pipesLs.stdout.byLine) pipesSort.stdin.writeln(line); Because you write sort's input first and read its output later, it might end up blocking if ls generates too much data. The output pipe of sort will fill up, causing sort to block and not read data from its input pipe anymore, resulting in your program blocking when the input pipe has filled up. I have a piece of code using poll to write to two input pipes and read from one output pipe, but it's a bit more complex than what you need. However, it also uses pipeShell to specify multiple commands at once. Since your program only needs to read the output (and not generate input), you may find pipeShell useful. https://github.com/Griffon26/tdiff3/blob/87709dd51c279e9896f37ba1cef477a525e44562/source/gnudiff.d Disclaimer: I'm not an experienced D programmer. My D code may not be pretty =)
Re: Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop?
On Sat, 30 Jan 2016 14:41:18 +, Dsby wrote: > Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) > run. will not my program stop? The GC will stop every thread it knows about. If you have a C++ thread that you want to run while the GC is running, you can get that by not telling the D runtime about it. This will limit your ability to interact with D from that thread somewhat -- and it will interfere more with your ability to *safely* interact with D even more. If you never allocate GC memory, of course, the GC will never run.
Re: D vs Rust
On Friday, 29 January 2016 at 15:39:53 UTC, bearophile wrote: qznc: On Friday, 29 January 2016 at 09:00:52 UTC, qznc wrote: D is a broader language and is applicable in more situations. In many cases you don't care and don't want to care about memory management. Learning to manage memory in Rust takes lot of time and practice, it's a bit painful. I am sometimes able to write working D code almost as quickly as Python code, but writing similar code in Rust takes me much more time. So I think for both small script-like programs, and general application code (where code safety is not the most important thing), D wins over Rust. D is also more flexible (higher order templates, better CTFE, unrestricted UFCS, etc), and you can port Python or C code to D faster than to Rust. So I think Rust targets a smaller number of coding purposes compared to D. Rust could also replace the code you want to write in OcaML, like compiler-like programs (thanks to Rust enums and pattern matching). Safety and correctness of the code are very important for me. Regarding safety & correctness I think there's this ordering: Rust > D > C++14 > C If you talk about correctness you think about Ada too. Rust code seems usually more succinct compared to Ada code. Ada is more mature and it has lot of small features missing from Rust/D, that help make the code more correct (like integer subsets, static invariants, stronger typing for array indexing, SPARK annotations to manage global mutables safely, and so on). I don't know if such safety features will be added to Rust, I am dubious. In the C/Ada world you have language subsets like MISRA/SPARK that people use in high integrity system. I think Rust still lacks something like that. Bye, bearophile Hi bearophile. Welcome back. I haven't used Ocaml, but was intrigued by it after seeing Yaron Minsky's talks. To what extent can pattern matching, strong types with invariants and other things Ocaml features be implemented idiomatically in D? Eg I know D has invariants, but that seems to be more a debug mode thing, and I am not sure if they are doing the same as what Minsky described in his talk. Bloomberg seem to use it for front end stuff as they open sourced a Javascript back end for the Ocaml compiler (and that's not the only such back end). How productive do you find coding in Ada ?
Re: What are the real advantages that D offers in multithreading?
On Wednesday, 27 January 2016 at 09:33:16 UTC, Kagamin wrote: On Tuesday, 26 January 2016 at 20:33:34 UTC, Chris Wright wrote: You can use fibers in C++ if you find a library to do it (boost might?). You might be able to find a Java library for it, but it's difficult and might require bytecode rewriting. The java approach is Netty and NIO. Netty and NIO are an event dispatching mechanism (think libebevent) backed by a ForkJoinPool. No fibers there. Java /does/ have fibers in Quasar, though the implementation is a bit weird because the Java instruction set doesn't support continuations. Message passing via std.concurrency is important to note. The scheduler is pluggable and can seamlessly multiplex fibers on top of a thread pool (the Erlang "millions of threads" approach). Thread local by default is notable as well, though fibers throw a wrench in this. The "synchronized" keyword is inadvisable in modern concurrent programming. I think it remains largely to ease porting code from Java.
Re: `alias this` pointers and typeof(null)
On Friday, 29 January 2016 at 15:38:26 UTC, Benjamin Thaut wrote: On Friday, 29 January 2016 at 13:38:20 UTC, Tomer Filiba wrote: I can change all such invocations into ``func(FooPtr(null))`` but it's tedious and basically requires me to compile tens of times before I'd cover everything. Is there some workaround to make null implicitly convertible to my alias-this type? I mean, it's Foo* would accept `typeof(null)` so why can't FooPtr with an alias-this to Foo* do so too? Unfortunately D is strictly against implict conversion, so there is no way to do this. I also hit this issue a couple of times already. But implicitly calling a constructor in C++ is considered error prone and therefor not supported in D. I've heard (on This Week in D) that C++ implicit construction wouldn't be so bad if it only worked when a constructor was specially marked for that purpose, e.g.: struct FooPtr { ... @implicit this(typeof(null)) {ptr = null;} } Then null could be passed as a FooPtr.
Re: Pipe one shell command into another
On Saturday, 30 January 2016 at 15:57:49 UTC, Griffon26 wrote: On Saturday, 30 January 2016 at 15:12:26 UTC, Andrew wrote: foreach(line; pipesLs.stdout.byLine) pipesSort.stdin.writeln(line); Because you write sort's input first and read its output later, it might end up blocking if ls generates too much data. The output pipe of sort will fill up, causing sort to block and not read data from its input pipe anymore, resulting in your program blocking when the input pipe has filled up. I have a piece of code using poll to write to two input pipes and read from one output pipe, but it's a bit more complex than what you need. However, it also uses pipeShell to specify multiple commands at once. Since your program only needs to read the output (and not generate input), you may find pipeShell useful. https://github.com/Griffon26/tdiff3/blob/87709dd51c279e9896f37ba1cef477a525e44562/source/gnudiff.d Disclaimer: I'm not an experienced D programmer. My D code may not be pretty =) pipeShell did the trick. Thank you very much! Andrew
Re: reduce -> fold?
On Saturday, 30 January 2016 at 12:11:37 UTC, Ola Fosheim Grøstad wrote: Currying is pointless, I believe Swift is removing it. ... It might be fairly useless in D but it's definitely not useless in general. It' a different design pattern and functional languages make great use of it. OTOH, D substitutes it with other design patterns like UFCS and template arguments, e.g. arr.sort!"a > b". Phobos even has a function which mimics currying via std.functional.partial: https://dlang.org/phobos/std_functional.html#partial
Re: Pre-alpha D language online tour
On Monday, 25 January 2016 at 21:18:45 UTC, rsw0x wrote: On Monday, 25 January 2016 at 21:12:14 UTC, André wrote: [...] might be worth noting that Rust uses playpen for sandboxing their online compiler https://github.com/thestinger/playpen Thank you for the link and the information! Unfortunately playpen doesn't work inside a Docker container because it basically uses the same technologies and has dependencies just available on systemd based base systems. I know decided to go the Docker way. I just pushed a change which lets the source be compiled and run within a Docker container that contains RDMD. This is working quite well so far and should be a quite safe sandbox. The started Docker containers are restricted in memory usage and could be restricted in terms of CPU usage. And this is online as of now. So the source code editor is now ready for compiling D online in the tour :-) Cheers, André
Re: GCAllocator goodAllocSize?
On 1/29/16 9:52 PM, Steven Schveighoffer wrote: import std.experimental.allocator.gc_allocator; void main() { //GCAllocator.instance.goodAllocSize(3000); // error writeln(theAllocator.goodAllocSize(3000)); // 3008, should be 4096 } This is known info, why is it not available? Is there a reason this needs to be inaccurate? I can create a PR if desired. There's no need, I just put in reasonable conservative defaults. Please do follow up - thanks! -- Andrei
Re: reduce -> fold?
On 1/30/16 12:25 PM, Xinok wrote: On Saturday, 30 January 2016 at 12:11:37 UTC, Ola Fosheim Grøstad wrote: Currying is pointless, I believe Swift is removing it. ... It might be fairly useless in D but it's definitely not useless in general. It' a different design pattern and functional languages make great use of it. OTOH, D substitutes it with other design patterns like UFCS and template arguments, e.g. arr.sort!"a > b". Phobos even has a function which mimics currying via std.functional.partial: https://dlang.org/phobos/std_functional.html#partial I forgot the distinction between currying and partial application. Can we also define currying in current D? -- Andrei
Re: New D book available for pre-order: D Web Development
On Saturday, 30 January 2016 at 17:58:23 UTC, Jacob Carlborg wrote: On 2016-01-30 18:33, barberian wrote: Yes, in fact the ebook it's expensive in this case, and where I live we "unfortunately" need to convert the pound multiplying by 6, ouch! How can two things be cheaper than one? It doesn't add up. Is there a mistake? I don't know what you're seeing there, but here: Ebook = 25,18 (pounds) Ebook + Physical = 25,99 (pounds) So for what I understand if you by the Physical copy you win the ebook.
Re: reduce -> fold?
On Saturday, 30 January 2016 at 17:40:38 UTC, Andrei Alexandrescu wrote: I forgot the distinction between currying and partial application. Can we also define currying in current D? -- Andrei Currying is turning (A, B, C) -> D into A -> (B -> (C -> D)), i.e. a function with multiple arguments into a sequence of functions that each take a single argument to apply each. I think I've implemented something like that for fun once, but never really found much use for it. In the few places where I could have used it (mostly binary functions), just using a lambda and partial application seemed to be much more idiomatic. I guess D lacks any idioms that would make its use come naturally. - David
Re: New D book available for pre-order: D Web Development
On Saturday, 30 January 2016 at 18:09:37 UTC, barberian wrote: On Saturday, 30 January 2016 at 17:58:23 UTC, Jacob Carlborg wrote: On 2016-01-30 18:33, barberian wrote: Yes, in fact the ebook it's expensive in this case, and where I live we "unfortunately" need to convert the pound multiplying by 6, ouch! How can two things be cheaper than one? It doesn't add up. Is there a mistake? I don't know what you're seeing there, but here: Ebook = 25,18 (pounds) Ebook + Physical = 25,99 (pounds) So for what I understand if you by the Physical copy you win the ebook. Here (US) the ebook is $39.99. The combo is on sale for $20. It seems odd, but I've seen it before.
[Issue 15604] std.array.array of structs with template opAssign and default initialised "new"ed class member.
https://issues.dlang.org/show_bug.cgi?id=15604 --- Comment #3 from John Colvin--- (In reply to David Nadlinger from comment #2) > As I pointed out in the GitHub issue, I'm not convinced that this is a > regression. Isn't it just an accepts-invalid bug in the compiler that the > struct declaration is considered valid in the first place? > > From looking at the codegen, I find it hard to imagine that the current > behavior (a single implicitly-shared object instance) would be what the user > would expect. I agree and have since deleted all such things from the codebase I was working on. I also hit some weird linker errors with them that I was unable to minimise examples for, so good riddance. On the topic of static initialisers with mutable indirections, what about these: struct A { int[] arr = [1, 2, 3]; } or this: Object globalSingleton; struct B { Object o = globalSingleton; } --
Re: D vs Rust
On Friday, 29 January 2016 at 17:50:04 UTC, jmh530 wrote: My understanding is that D has a lot of options for behavior similar to RAII, but it does not have the full capability. What would be the most important thing for D to change to improve the experience of binding to C++? Support RAII: constructors, destructors and value semantics.
Re: is(some template instantiation) is true, but the actual instantiation fails
On Friday, 29 January 2016 at 23:44:56 UTC, Basile B. wrote: Haven't you seen my answer about constraint ? If you put a constraint on your function template then invalid instantiations are rejected. I mean... this language feature is not just ornamental... What do you think constraints are used for otherwise ^^ Yes, I've seen it, thanks. Requiring the user to write the constraint might indeed enforce a better style, but I want to be able to test it even if the user forgets the constraint. Otherwise she'll get cryptic error messages from some other code assuming that CallsFoo!NoFoo is a valid type.
Re: is(some template instantiation) is true, but the actual instantiation fails
On Saturday, 30 January 2016 at 00:16:21 UTC, Ali Çehreli wrote: > https://issues.dlang.org/show_bug.cgi?id=15623 As I noted on the bug report, they are work when moved from module scope to inside a function (e.g. main()). At least there's that workaround... Ali Thanks a lot! Now I can continue my work. :)
Re: New D book available for pre-order: D Web Development
On Sunday, 24 January 2016 at 14:35:53 UTC, Kai Nacke wrote: On Sunday, 24 January 2016 at 13:03:42 UTC, notna wrote: Any news? Just some days left until "January 2016" is over ;) I am checking the pre-final PDFs of the last chapters right now. Publishing date will be very soon Regards, Kai It is available now :)
Re: Dub packages: Best practices for windows support
On Saturday, 30 January 2016 at 01:17:13 UTC, Mike Parker wrote: On Friday, 29 January 2016 at 19:46:40 UTC, Johannes Pfau wrote: Now on windows, things are more complicated. First of all, I can't seem to simply use "libs": ["foo"] as the linker won't find the C import .lib file. Then apparently there's no way to add a library search path with the MSVC linker? So I have to use the full path: "libs": [$PACKAGE_DIR\\path\\foo]. Without $PACKAGE_DIR paths are incorrect for applications using the library because of a dub problem. And then I'll have to use different import libraries and paths for -m32, -m64 and -m32mscoff. Now you know my motivation for creating Derelict. +1, make a Derelict-style binding and never deal with import library ever again.
Re: reduce -> fold?
On Saturday, 30 January 2016 at 01:34:48 UTC, deadalnix wrote: On Friday, 29 January 2016 at 23:45:04 UTC, Ola Fosheim Grøstad wrote: So D is adding currying and builtin tuples? :^) Yes. Come back in 10 years it'll be ready for you. Currying is pointless, I believe Swift is removing it. I was joking, Haskell's naming scheme isn't particularly suited for an imperative language. Look: nub fst snd chr intercalate unwords inits ??
Re: Access Violation in @safe Code
Alias templates require stack pointer, init probably has it set to null. Try this: FooType foo = FooType();
Re: Trouble complinig DMD 2.070 on windows
There might be not enough manpower to keep the code at the bleeding edge of C++ technologies, so update is likely to be meaningless.
[Issue 13821] fiber + exception + win server 2012 failures
https://issues.dlang.org/show_bug.cgi?id=13821 Rainer Schuetzechanged: What|Removed |Added CC||r.sagita...@gmx.de --- Comment #1 from Rainer Schuetze --- likely to be related: https://issues.dlang.org/show_bug.cgi?id=15628 --
[Issue 15623] is(M!N) evaluates to true for M!N that fails to instantiate.
https://issues.dlang.org/show_bug.cgi?id=15623 --- Comment #2 from Adrian Matoga--- It's not only module scope - it's broken also inside templates, e.g.: --- template canBeInstantiated(alias StructTemplate, Parameters...) { static if (is(StructTemplate!Parameters)) enum canBeInstantiated = true; else enum canBeInstantiated = false; } static assert( canBeInstantiated!(CallsFoo, HasFoo)); //static assert(!canBeInstantiated!(CallsFoo, NoFoo)); //fails --- or: --- template canBeInstantiated(alias StructTemplate, Parameters...) { enum canBeInstantiated = is(StructTemplate!Parameters); } static assert( canBeInstantiated!(CallsFoo, HasFoo)); //static assert(!canBeInstantiated!(CallsFoo, NoFoo)); //fails --- However, the function trick indeed works: --- bool canBeInstantiated(alias StructTemplate, Parameters...)() { return is(StructTemplate!Parameters); } static assert( canBeInstantiated!(CallsFoo, HasFoo)); static assert(!canBeInstantiated!(CallsFoo, NoFoo)); // hooray! --- --
Re: My LLVM talk @ FOSDEM'16
Live streaming is index here: https://fosdem.org/2016/schedule/streaming/ Room is K.3.201. Regards, Kai On Thursday, 7 January 2016 at 23:38:07 UTC, Kai Nacke wrote: Hi everybody! Like the last 2 years I am a speaker in the LLVM toolchain devroom @ FOSDEM'16. My talk is not D related but more about LLVM internals. (For sure, it is related to my work on LDC!) Read the announcement at https://fosdem.org/2016/schedule/event/llvm_to_new_os/. FOSDEM is a two-day event organised by volunteers to promote the widespread use of open source software. Taking place in the beautiful city of Brussels (Belgium), FOSDEM is widely recognised as "the best open source conference in Europe". FOSDEM 2016 will take place at ULB Campus Solbosch on Saturday 30 and Sunday 31 January 2016. Read more about the event at https://fosdem.org/2016/. Regards, Kai
[Issue 15629] [REG] wrong code with "-O -inline" but correct with "-O"
https://issues.dlang.org/show_bug.cgi?id=15629 --- Comment #2 from Ivan Kazmenko--- Turned out that array b is also not necessary. A bit less code (testmodule2.d): - import std.math; import std.stdio; void main () { int [] a = [3]; int value = abs (a[0]); if (a[0] != 3) { writeln (value, " ", a); assert (false); } } - Disassembly: - __Dmain PROC NEAR ; COMDEF __Dmain sub esp, 36 ; _ 83. EC, 24 mov eax, 3 ; 0003 _ B8, 0003 mov ecx, 1 ; 0008 _ B9, 0001 mov dword ptr [esp+0CH], ebx; 000D _ 89. 5C 24, 0C mov dword ptr [esp+10H], esi; 0011 _ 89. 74 24, 10 mov dword ptr [esp+18H], eax; 0015 _ 89. 44 24, 18 mov dword ptr [esp+4H], ecx ; 0019 _ 89. 4C 24, 04 mov dword ptr [esp], offset FLAT:_D11TypeInfo_Ai6__initZ; 001D _ C7. 04 24, (segrel) call__d_arrayliteralTX ; 0024 _ E8, (rel) mov edx, eax; 0029 _ 89. C2 mov eax, dword ptr [esp+18H]; 002B _ 8B. 44 24, 18 mov dword ptr [esp+20H], edx; 002F _ 89. 54 24, 20 mov ebx, dword ptr [esp+20H]; 0033 _ 8B. 5C 24, 20 mov ecx, dword ptr [esp+14H]; 0037 _ 8B. 4C 24, 14 mov dword ptr [edx], eax; 003B _ 89. 02 mov esi, dword ptr [ebx]; 003D _ 8B. 33 mov eax, esi; 003F _ 89. F0 sar eax, 31 ; 0041 _ C1. F8, 1F xor esi, eax; 0044 _ 33. F0 sub esi, eax; 0046 _ 2B. F0 mov dword ptr [esp+1CH], 1 ; 0048 _ C7. 44 24, 1C, 0001 cmp ecx, 3 ; 0050 _ 83. F9, 03 jz ?_0056 ; 0053 _ 74, 24 pushesi ; 0055 _ 56 mov edx, offset FLAT:?_0001 ; 0056 _ BA, (segrel) mov ebx, 1 ; 005B _ BB, 0001 pushedx ; 0060 _ 52 pushebx ; 0061 _ 53 pushdword ptr [esp+2CH] ; 0062 _ FF. 74 24, 2C pushdword ptr [esp+2CH] ; 0066 _ FF. 74 24, 2C call_D3std5stdio21__T7writelnTiTAyaTAiZ7writelnFNfiAyaAiZv; 006A _ E8, (rel) mov eax, 11 ; 006F _ B8, 000B call_D11testmodule28__assertFiZv; 0074 _ E8, (rel) ?_0056: mov ebx, dword ptr [esp+0CH]; 0079 _ 8B. 5C 24, 0C mov esi, dword ptr [esp+10H]; 007D _ 8B. 74 24, 10 add esp, 36 ; 0081 _ 83. C4, 24 xor eax, eax; 0084 _ 31. C0 ret ; 0086 _ C3 __Dmain ENDP - Now the lines supposed to carry the "3" seem to be - mov eax, 3 ; 0003 _ B8, 0003 mov dword ptr [esp+18H], eax; 0015 _ 89. 44 24, 18 mov eax, dword ptr [esp+18H]; 002B _ 8B. 44 24, 18 mov dword ptr [edx], eax; 003B _ 89. 02 - and then for some reason - mov ecx, dword ptr [esp+14H]; 0037 _ 8B. 4C 24, 14 cmp ecx, 3 ; 0050 _ 83. F9, 03 jz ?_0056 ; 0053 _ 74, 24 - --
Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop?
Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop? My lib.so is writed in D, and I use the GC.and then I am used the dll in my program that is writed in C++. I want to know when the GC(in lib.so's runtime) start runing, will my program be stoped,until the GC stop? sorry , my english is bad. I will use chinese to describe this question: 我用D语言写了一个的动态库,其中里面的内存分配和回收用的是GC。现在我的C++程序去调用这个动态库。我想知道,当动态库所依赖的的D的运行时中GC运行的时候,是不是我的整个程序都会暂停住,知道GC回收完毕再次唤醒?
[Issue 15629] New: [REG] wrong code with "-O -inline" but correct with "-O"
https://issues.dlang.org/show_bug.cgi?id=15629 Issue ID: 15629 Summary: [REG] wrong code with "-O -inline" but correct with "-O" Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: wrong-code Severity: regression Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: ga...@mail.ru Here is the reduced test case. testmodule.d: - import std.math; import std.stdio; void main () { int [] a = [3]; int [] b = [9]; int value = abs (a[0]); if (a[0] != 3) { writeln (value, " ", a, " ", b); assert (false); } } - DMD 2.066.1 through the latest DMD 2.070.0: - "dmd -O testmodule.d" works, - "dmd -O -inline testmodule.d" writes "3 [3] [9]" and runs into assert (false). DMD 2.063.2: - both work as expected. So, technically, this is a regression somewhere between 2.063.2 and 2.066.1. --
[Issue 15629] [REG] wrong code with "-O -inline" but correct with "-O"
https://issues.dlang.org/show_bug.cgi?id=15629 --- Comment #1 from Ivan Kazmenko--- Here is the relevant disassembly of the object file produced 2.070.0: - __Dmain PROC NEAR ; COMDEF __Dmain sub esp, 44 ; _ 83. EC, 2C mov eax, 3 ; 0003 _ B8, 0003 mov ecx, 1 ; 0008 _ B9, 0001 mov dword ptr [esp+0CH], ebx; 000D _ 89. 5C 24, 0C mov edx, offset FLAT:_D11TypeInfo_Ai6__initZ; 0011 _ BA, (segrel) mov dword ptr [esp+10H], esi; 0016 _ 89. 74 24, 10 mov dword ptr [esp+18H], eax; 001A _ 89. 44 24, 18 mov dword ptr [esp+4H], ecx ; 001E _ 89. 4C 24, 04 mov dword ptr [esp], edx; 0022 _ 89. 14 24 call__d_arrayliteralTX ; 0025 _ E8, (rel) mov ebx, eax; 002A _ 89. C3 mov eax, dword ptr [esp+18H]; 002C _ 8B. 44 24, 18 mov dword ptr [ebx], eax; 0030 _ 89. 03 mov dword ptr [esp+20H], ebx; 0032 _ 89. 5C 24, 20 mov dword ptr [esp+1CH], 1 ; 0036 _ C7. 44 24, 1C, 0001 mov dword ptr [esp+4H], 1 ; 003E _ C7. 44 24, 04, 0001 mov dword ptr [esp], offset FLAT:_D11TypeInfo_Ai6__initZ; 0046 _ C7. 04 24, (segrel) call__d_arrayliteralTX ; 004D _ E8, (rel) mov esi, dword ptr [esp+20H]; 0052 _ 8B. 74 24, 20 mov edx, dword ptr [esp+14H]; 0056 _ 8B. 54 24, 14 mov dword ptr [eax], 9 ; 005A _ C7. 00, 0009 mov dword ptr [esp+28H], eax; 0060 _ 89. 44 24, 28 mov eax, dword ptr [esi]; 0064 _ 8B. 06 mov ecx, eax; 0066 _ 89. C1 sar ecx, 31 ; 0068 _ C1. F9, 1F xor eax, ecx; 006B _ 33. C1 sub eax, ecx; 006D _ 2B. C1 mov dword ptr [esp+24H], 1 ; 006F _ C7. 44 24, 24, 0001 cmp edx, 3 ; 0077 _ 83. FA, 03 jz ?_0056 ; 007A _ 74, 2E pusheax ; 007C _ 50 mov ecx, offset FLAT:?_0001 ; 007D _ B9, (segrel) mov ebx, 1 ; 0082 _ BB, 0001 pushecx ; 0087 _ 51 pushebx ; 0088 _ 53 pushdword ptr [esp+2CH] ; 0089 _ FF. 74 24, 2C pushdword ptr [esp+2CH] ; 008D _ FF. 74 24, 2C pushecx ; 0091 _ 51 pushebx ; 0092 _ 53 pushdword ptr [esp+44H] ; 0093 _ FF. 74 24, 44 pushdword ptr [esp+44H] ; 0097 _ FF. 74 24, 44 call _D3std5stdio28__T7writelnTiTAyaTAiTAyaTAiZ7writelnFNfiAyaAiAyaAiZv; 009B _ E8, (rel) mov eax, 12 ; 00A0 _ B8, 000C call_D10testmodule8__assertFiZv ; 00A5 _ E8, (rel) ?_0056: mov ebx, dword ptr [esp+0CH]; 00AA _ 8B. 5C 24, 0C mov esi, dword ptr [esp+10H]; 00AE _ 8B. 74 24, 10 add esp, 44 ; 00B2 _ 83. C4, 2C xor eax, eax; 00B5 _ 31. C0 ret ; 00B7 _ C3 __Dmain ENDP - Looks like these lines are responsible: - mov dword ptr [esp+18H], eax; 001A ... mov edx, dword ptr [esp+14H]; 0056 ... cmp edx, 3 ; 0077 jz ?_0056 ; 007A - I don't understand why the line at 0056 uses "dword ptr [esp+14H]" and not "dword ptr [esp+18H]". (Disclaimer: I'm not fluent in asm.) --
Pipe one shell command into another
Hi, I'd like to run a shell command which involves piping one thing into another and then processes the output line by line, i.e. something like "ls -l | sort -k5,5n" What I've come up so far with is: import std.process; import std.stdio; void main(){ auto pipesLs = pipeProcess(["ls", "-l"], Redirect.stdout); auto pipesSort = pipeProcess(["sort", "-k5,5n"], Redirect.all); scope (exit) wait(pipesSort.pid); foreach(line; pipesLs.stdout.byLine) pipesSort.stdin.writeln(line); pipesSort.stdin.close; foreach(line; pipesSort.stdout.byLine) writeln(line); } This seems to work on this simple example, but is there a better way to do it, and if not, is this reliable? Also, could someone explain to me the necessity of the wait command? Thanks very much Andrew
Literate programming tool (written in D) on Reddit
Just noticed this on the /r/programming front page: https://www.reddit.com/r/programming/comments/43fvbv/literate_programming_tool_made_with_d/ — David
Re: How do you initialize a class instance which has static storage within another class?
On 30.01.2016 22:52, Enjoys Math wrote: class A { static B b; } class B {} doing b = new B() does NOT work. Nor could I create a this() {} at module level It works when you make b const/immutable: class A {static immutable B b = new B;} class B {} If you want/need b to be mutable, you can use a static constructor (`static this`), either in the class or the module: class A {static B b; static this() {b = new B;}} class B {} class A {static B b;} static this() {A.b = new B;} class B {} You could also set it in `main` or another function that runs before b is used, of course.
[Issue 15630] New: gdb: for enums values
https://issues.dlang.org/show_bug.cgi?id=15630 Issue ID: 15630 Summary: gdb: for enums values Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: pro.mathias.l...@gmail.com CC: ibuc...@gdcproject.org Tested with 'GNU gdb (GDB) 7.10.1' (latest release) + DMD 2.069-but-really-2.070. The following code, compiler with '-g': ``` enum Foo { Bar, Bar2, Bar3 } void main () { openBar(Foo.Bar3); } void openBar (Foo f) { asm { int 3; } } ``` Will produce the following when debugging: ``` Program received signal SIGTRAP, Trace/breakpoint trap. test.openBar(test.Foo) (f=) at test.d:13 13void openBar (Foo f) { asm { int 3; } } ``` Notice the "". It seems gdb is not able to read enums produced by DMD. --
Re: Release D 2.070.0
On Wednesday, 27 January 2016 at 21:08:54 UTC, Martin Nowak wrote: Glad to announce D 2.070.0 http://dlang.org/download.html This release comes with the new std.experimental.ndslice, heavily expanded Windows bindings, and native exception handling on 64-bit linux. See the changelog for more details. http://dlang.org/changelog/2.070.0.html -Martin NB: tagged commit has 2.069 in VERSION file resulting in built compiler reporting wrong version. I have added a workaround in packaging script for now but would be nice to fix that in 2.070.1
[Issue 314] [module] Static, renamed, and selective imports are always public
https://issues.dlang.org/show_bug.cgi?id=314 --- Comment #51 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/03ec7f38bd29d1c6eb851e4516b74370345e9e49 Don't use top-level selective import in std.math because of DMD issue 314. https://github.com/D-Programming-Language/phobos/commit/33dbfa819fafd4d78378b9ca0e5086ffe824d485 Merge pull request #3961 from tsbockman/math_import_fix Don't use selective import in std.math due to DMD issue 314. --
Re: extern(C++, ns)
On Thursday, 21 January 2016 at 00:43:13 UTC, David Nadlinger wrote: If you want to split up the interface to a C++ namespace among different modules, then the different symbols will *always* reside in different fully qualified scopes – with or without additional scopes being introduced by extern(C++)! This is the nub of the problem, and it's been stated by several people in several different ways in this thread. It means that a C++ namespace which is a single scope, is mapped into one scope per module in D. The C++ namespace scope has been fragmented to make it consistent with D's module philosophy. The result is natural neither for C++ nor for D.
[Issue 15610] extern(C++) multiple inheritance - calling with wrong 'this' ptr
https://issues.dlang.org/show_bug.cgi?id=15610 --- Comment #8 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f46f2197f458b4f242484b486302a383e70ceac4 fix Issue 15610 - extern(C++) multiple inheritance - calling with wrong 'this' ptr https://github.com/D-Programming-Language/dmd/commit/84f6aaf592c6b4526a24f43d1bbdca77b4943b74 Merge pull request #5372 from WalterBright/fix15610 fix Issue 15610 - extern(C++) multiple inheritance - calling with wro… --
Re: Can someone give me simple instructions on how to build 64-bit DMD using Visual Studio?
Clone DMD, make sure you have the *latest* VisualD installed (https://github.com/D-Programming-Language/visuald/releases), open src\vcbuild\dmd.sln, build. I use VS2015. YMMV ;) On 31 January 2016 at 08:59, Akira1364 via Digitalmars-dwrote: > I've read through the available documentation, but it's all incredibly brief > and vague. What file specifically do I need to edit to point to my Visual > Studio instance? Should I use Win32.mak, or the "VCBUILD" solution? > E.t.c.
[Issue 15631] gdb: Parent's scope not considered for symbol lookup
https://issues.dlang.org/show_bug.cgi?id=15631 --- Comment #1 from Iain Buclaw--- :-D --
[Issue 15631] New: gdb: Parent's scope not considered for symbol lookup
https://issues.dlang.org/show_bug.cgi?id=15631 Issue ID: 15631 Summary: gdb: Parent's scope not considered for symbol lookup Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: pro.mathias.l...@gmail.com CC: ibuc...@gdcproject.org Tested with 'GNU gdb (GDB) 7.10.1' (latest release) + DMD 2.069-but-really-2.070. Using the following code: ``` class Base { int value; } class Derivative : Base { int derived_value; void foo () { assert(value == 0); assert(derived_value == 0); } } void main () { auto d = new Derivative(); d.foo; } ``` and compiling with DMD: ``` Breakpoint 1, gdb_scope.Derivative.foo() (this=0x77ec3000) at gdb_scope.d:5 5void foo () { assert(value == 0); assert(derived_value == 0); } (gdb) p value No symbol "value" in current context. (gdb) p *this $1 = {derived_value = 0} ``` This issue makes it quite complex to trace DMD using gdb, unless DMD is compiled with GDC. --
Can someone give me simple instructions on how to build 64-bit DMD using Visual Studio?
I've read through the available documentation, but it's all incredibly brief and vague. What file specifically do I need to edit to point to my Visual Studio instance? Should I use Win32.mak, or the "VCBUILD" solution? E.t.c.
Re: UTF-16 endianess
On Fri, 29 Jan 2016 18:58:17 -0500, Steven Schveighoffer wrote: >>> Note the version identifiers BigEndian and LittleEndian can be used to >>> compile the correct code. >> >> This solution is of no use to me as I don't want to change the endianess in >> general. > > What I mean is that you can annotate your code with version statements like: > > version(LittleEndian) > { > // perform the byteswap > ... > } > > so your code is portable to BigEndian systems (where you would not want > to byte swap). That's a good point, thanks. -- Marek Janukowicz
Re: How do you initialize a class instance which has static storage within another class?
On Saturday, 30 January 2016 at 21:52:20 UTC, Enjoys Math wrote: class A { static B b; } class B {} doing b = new B() does NOT work. Nor could I create a this() {} at module level More info: B : A so I can't do class A { this () { if (b is null) { b = new B(); } } } Since it OVERFLOWS THE STACK!!
Re: How do you initialize a class instance which has static storage within another class?
On Sat, 30 Jan 2016 22:02:10 +, Enjoys Math wrote: > On Saturday, 30 January 2016 at 21:52:20 UTC, Enjoys Math wrote: >> >> class A { static B b; } class B {} >> >> doing b = new B() does NOT work. >> >> Nor could I create a this() {} at module level > > More info: > > B : A > > so I can't do > > class A { >this () { > if (b is null) { > b = new B(); > } > } > } You should use a static constructor: class A { static B b; static this() { b = new B(); } }
Re: Better docs for D (WIP)
On Saturday, 30 January 2016 at 22:37:18 UTC, Adam D. Ruppe wrote: I know quite a few css tricks... but I don't think I can actually do this without adding a script or something, so I just put an arbitrary fixed width on hover for now. Meh, I just did it with JavaScript, so if you enable script, you should be free of that now (and if not, the fixed width fallback is still there.) (specifically, the script just edits the html of a special dynamic
Re: D vs Rust
On 1/30/2016 12:48 PM, bearophile wrote: [...] Thanks for writing this, you make a lot of points I wasn't aware of.
Re: Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop?
On Sunday, 31 January 2016 at 03:45:01 UTC, Dsby wrote: Thanks, if I use the D dylib,I should run " rt_init(); " in every thread which i used the D dylib? No. rt_init only needs to be called once for the process. You need to call core.thread.attach_this [1] so that runtime is aware of your external thread. Note that this does not apply to the thread that calls rt_init. [1] http://dlang.org/phobos/core_thread.html#.thread_attachThis
Re: Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop?
On Sunday, 31 January 2016 at 05:28:02 UTC, Mike Parker wrote: need to call core.thread.attach_this [1] so that runtime is Sorry, that's core.thread.thread_attachThis
Re: Better docs for D (WIP)
On Saturday, 30 January 2016 at 22:37:18 UTC, Adam D. Ruppe wrote: I know quite a few css tricks... but I don't think I can actually do this without adding a script or something, so I just put an arbitrary fixed width on hover for now. One trick is to set the width and clipping on "dt > *" instead of "dt", and use "calc(...)" for dynamic sizes.
Re: extern(C++, ns)
On Sunday, 31 January 2016 at 01:12:11 UTC, Carl Sturtivant wrote: This is the nub of the problem, and it's been stated by several people in several different ways in this thread. It means that a C++ namespace which is a single scope, is mapped into one scope per module in D. The C++ namespace scope has been fragmented to make it consistent with D's module philosophy. The result is natural neither for C++ nor for D. In fact, if you're going to bring in a scope to represent a namespace, that's what it needs to be a (singular) scope. Not to bring in many identical but distinct scopes. The present design is falling between two stools. They are to do the above or to just link mangled according to the namespace with no scope special C++ derived scope(s).
Re: Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop?
On Saturday, 30 January 2016 at 16:06:37 UTC, Chris Wright wrote: On Sat, 30 Jan 2016 14:41:18 +, Dsby wrote: Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop? The GC will stop every thread it knows about. If you have a C++ thread that you want to run while the GC is running, you can get that by not telling the D runtime about it. This will limit your ability to interact with D from that thread somewhat -- and it will interfere more with your ability to *safely* interact with D even more. If you never allocate GC memory, of course, the GC will never run. Thanks, if I use the D dylib,I should run " rt_init(); " in every thread which i used the D dylib?
Re: D vs Rust
BTW, your email server is rejecting my emails to you!
Re: D vs Rust
On 1/29/2016 12:26 AM, John Colvin wrote: It depends what you mean by templated. I believe the interoperability work is for the results of instantiated templates, not on the templates themselves. That's right. D can link to instantiated templates, and will duplicate the layout. But D will not implement C++ semantics, such as how C++ does overload resolution on templates.
Re: Use the D dylib in my C++ program,when the D's GC(in the dylib runtime) run. will not my program stop?
On Sunday, 31 January 2016 at 05:29:06 UTC, Mike Parker wrote: On Sunday, 31 January 2016 at 05:28:02 UTC, Mike Parker wrote: need to call core.thread.attach_this [1] so that runtime is Sorry, that's core.thread.thread_attachThis ok。thanks.
Dwarf Exception Handling now on FreeBSD!
32/64 support now on Linux and FreeBSD. https://github.com/D-Programming-Language/dmd/pull/5376 Turns out that FreeBSD is close enough to Linux that it "just worked". Recently, there was a long thread entitled "C++17" where people are asking for better C++ interoperability. Well, here's a ripe plum for anyone wanting valuable compiler street cred! Make the Dwarf EH support work on OSX 32 and 64. I bet that nearly all the work will be in changing the ELF fixups to MACH-O fixups in the gcc_except_table and eh_frame sections. Use an object dumper to see what g++ uses for fixups in those sections, and do the same. As for me, I'll be implementing C++ multiple inheritance class layout, because Manu's problems have made it clear we have to do that.
Re: C Macro deeper meaning?
On Sunday, 31 January 2016 at 02:58:28 UTC, Andrew Edwards wrote: But it cannot be that simple, so what am I missing? I'm guessing the macro was there in C to silence compiler warnings about not using a return value. So I think your translation is ok: NOTUSED(somefunction()); still calls the function, so the behavior is the same. If I'm right, the macro was just about discarding the return value in such a way as to tell the compiler warning / lint program that you intentionally wanted to ignore it.
Re: D vs Rust
On Thursday, 28 January 2016 at 22:30:51 UTC, nbro wrote: [...] I retransmission this post in rust's user-forum. It is url: https://users.rust-lang.org/t/rust-vs-dlang-i-want-more-experienced/4472 there have more point.
Re: C Macro deeper meaning?
On Sunday, 31 January 2016 at 03:13:46 UTC, Adam D. Ruppe wrote: On Sunday, 31 January 2016 at 02:58:28 UTC, Andrew Edwards wrote: But it cannot be that simple, so what am I missing? I'm guessing the macro was there in C to silence compiler warnings about not using a return value. So I think your translation is ok: NOTUSED(somefunction()); still calls the function, so the behavior is the same. If I'm right, the macro was just about discarding the return value in such a way as to tell the compiler warning / lint program that you intentionally wanted to ignore it. Okay, got it. Much appreciated.
Re: D vs Rust
On 31/01/16 6:00 PM, Walter Bright wrote: BTW, your email server is rejecting my emails to you! Worse case scenario for Laeeth contact via LinkedIn.
C Macro deeper meaning?
If I understand correctly, this piece of code: enum NOTUSED(v) do { (void)(1 ? (void)0 : ( (void)(v) ) ); } while(0) can be converted to the following in D: void notUsed(T)(T v) { return cast(void)0; }; since it always returns cast(void)0 regardless of the input. But it cannot be that simple, so what am I missing? Thanks, Andrew Edwards
[Issue 14895] ICE on array operation when its result is concatenated
https://issues.dlang.org/show_bug.cgi?id=14895 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/67392afd2bb489e48a8234d96077f4579e05b511 fix Issue 14895 - ICE on array operation when its result is concatenated https://github.com/D-Programming-Language/dmd/commit/ed197e17dd1736f1f608267339162c22c2b4fb57 Merge pull request #4873 from 9rnsr/fix14895 Issue 14895 - ICE on array operation when its result is concatenated --