[Issue 12543] Class.sizeof requires the Class' definition
https://issues.dlang.org/show_bug.cgi?id=12543 --- Comment #3 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a080c8b3242c27efe07325b1c5ddfacb998d4e99 Move issue 12543 14010 test case to compilable/testfwdref.d --
[Issue 14010] Support mangleof property for opaque enum and struct type
https://issues.dlang.org/show_bug.cgi?id=14010 --- Comment #4 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a080c8b3242c27efe07325b1c5ddfacb998d4e99 Move issue 12543 14010 test case to compilable/testfwdref.d --
[Issue 6766] Forward reference error for default struct/class arguments
https://issues.dlang.org/show_bug.cgi?id=6766 --- Comment #6 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7d3e1fb463f71b6332512ffb094f2285e2b07825 Move issue 6766 test case to compilable/testfwdref.d --
[Issue 8698] Forward reference error with interfaces
https://issues.dlang.org/show_bug.cgi?id=8698 --- Comment #3 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/fdbfd70aa1a3a991ba620a5855f9aa0b489f2905 Move issue 8698 test case to compilable/testfwdref.d --
Re: std.reflection prototype
On 2015-03-30 04:09, Rikki Cattermole wrote: We also need some form of RTInfo for modules. I made a pull request for that but unfortunately it hasn't been accepted yet. The reason seems to be that we need to come up with a way to do custom RTInfo without modifying druntime, that can also be used for this template. -- /Jacob Carlborg
Re: std.reflection prototype
On 2015-03-30 09:06, Rikki Cattermole wrote: You, me and Walter should have a chat then. I could pretty easily come up with a way to add data into RTInfo. I've already come up with a way, any template with the @rtInfo UDA is treated the same way as RTInfo is now. The problem is then how to store the data in TypeInfo. Since it would be possible to have multiple data generated for a given type I was thinking it could be stored in an associative array. The keys would be the name of the module which generated the data and the the values would be the data. Something like this: module foo.bar; @rtInfo template Foo (T) { enum Foo = bar; } assert(typeid(T).rtInfo[foo.bar] == bar); If I recall correctly Martin Nowak didn't like this approach. The associate array would need to be built at load time of the application due to separate compilation. BTW, here [1] is the pull request and the reason why it was closed. [1] https://github.com/D-Programming-Language/dmd/pull/2271#issuecomment-59621060 -- /Jacob Carlborg
[Issue 9023] CTFE: cannot use ~= on an empty AA.
https://issues.dlang.org/show_bug.cgi?id=9023 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 9023] CTFE: cannot use ~= on an empty AA.
https://issues.dlang.org/show_bug.cgi?id=9023 --- 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/1e25862da6b588794165ced4b89f72870fa660d7 fix Issue 9023 - CTFE: cannot use ~= on an empty AA. https://github.com/D-Programming-Language/dmd/commit/7d9a3e2e7ebdfd1ec09ebfb5cfbd2e850c70040d Merge pull request #4331 from 9rnsr/fix9023 Issue 9023 - CTFE: cannot use ~= on an empty AA. --
Re: dsq-1: open-source software synthesizer
On 30/03/2015 7:14 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:54:42 +1300, Rikki Cattermole wrote: On 30/03/2015 6:35 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:23:11 +1300, Rikki Cattermole wrote: Although I'm a little concerned because dub is meant to validate and tell you conflicts in licenses. O_O Hey hey hey, context matters! i'm speechless 'cause it's a great idea (let machine do it work!), but i'm not sure how this can be done with wide broad of licenses out here. and i definetely want to see std.license.compare in Phobos! ;-) I agree, I'm concerned about this as well. But hey, its one of the features the dub developers want to have.
Re: [OT]: Congrats Andrei!
On Saturday, 28 March 2015 at 01:51:39 UTC, Rikki Cattermole wrote: Lets all give it up for Andrei and his wife Sanda. Who had their second son today (Dan)! Please congratulate them both. Ok now down to business, who wants to step up in place of Andrei hmm? But seriously we should all recognize that he will be busier then he already was, and will need to push jobs on to others more so. Congratulations!
Re: dsq-1: open-source software synthesizer
On Mon, 30 Mar 2015 19:17:35 +1300, Rikki Cattermole wrote: On 30/03/2015 7:14 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:54:42 +1300, Rikki Cattermole wrote: On 30/03/2015 6:35 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:23:11 +1300, Rikki Cattermole wrote: Although I'm a little concerned because dub is meant to validate and tell you conflicts in licenses. O_O Hey hey hey, context matters! i'm speechless 'cause it's a great idea (let machine do it work!), but i'm not sure how this can be done with wide broad of licenses out here. and i definetely want to see std.license.compare in Phobos! ;-) I agree, I'm concerned about this as well. But hey, its one of the features the dub developers want to have. what i really want to have is libdub. i.e. turning dub to library, so it can be easily integrated in any D project (rdmd comes to mind first). i don't want D building abilities, for example, but i really like to use it's package management part (and get list of files and compiler flags for that packages). sure, i can do this by parsing dub jsons and execing dub itself to do package management work, but libdub is better... maybe someday i'll wrote such thing. ;-) signature.asc Description: PGP signature
They wrote the fastest parallelized BAM parser in D
http://bioinformatics.oxfordjournals.org/content/early/2015/02/18/bioinformatics.btv098.full.pdf+html and a feature http://google-opensource.blogspot.nl/2015/03/gsoc-project-sambamba-published-in.html?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+GoogleOpenSourceBlog+(Google+Open+Source+Blog) D may hold a sweet spot in bioinformatics where you often require quick turnaround (productivity) , raw speed and agility.
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Saturday, March 28, 2015 14:19:46 Walter Bright via Digitalmars-d-announce wrote: Thank you. I need to learn std.algorithm better. Don't we all. Part of the problem with std.algorithm is its power. It's frequently the case that you think that something isn't there when it's either there under a different name, or you just have to look at one of its functions from a different angle to use it for what you're trying to do. It wouldn't surprise me at all if folks who know it quite well get surprised by what it can do at least from time to time. - Jonathan M Davis
Re: The D Language: A sweet-spot between Python and C
On 30/03/2015 6:43 p.m., Laeeth Isharc wrote: On Monday, 30 March 2015 at 05:04:57 UTC, Rikki Cattermole wrote: On 30/03/2015 5:48 p.m., weaselcat wrote: On Monday, 30 March 2015 at 04:35:44 UTC, Rikki Cattermole wrote: On 30/03/2015 5:25 p.m., Laeeth Isharc wrote: On Monday, 30 March 2015 at 04:16:38 UTC, weaselcat wrote: On Monday, 30 March 2015 at 00:57:06 UTC, Walter Bright wrote: http://blog.experimentalworks.net/2015/01/the-d-language-a-sweet-spot-between-python-and-c/ Reddit: https://www.reddit.com/r/programming/comments/30qqck/the_d_language_a_sweetspot_between_python_and_c/ a lot of the people in the thread are unaware that D even has RAII like C++, and think it's just a GC language like java/etc. Maybe this is something worth mentioning more on the introduction? Also, there is a perception that you can't use the standard library and nicer language features if you do your own allocation and don't depend on the GC. A guy worrying about hygiene problems mixing GC and Raii libraries. Whereas most garbage is small and fine to use GC for in some applications - only a subset of real time applications suffer from generating gazillions of tiny objects. It would be good to set out somewhere what you lose as regards std library by insisting on using nogc. The point about std.algorithm should be made more prominent. I'm currently working on the forcing GC cleanup mechanism for my web server. I would like to add, that post GC disabled it can be forced to do a cleanup. But I would go a step further, do a force minimize of memory back to the OS and reserve e.g. 32mb. Really what would be nice is a, reserveMax function that and anything else is free'd back to the OS. The reserve, means that even if you are sloppy and end up using the GC in critical code, it won't matter. The memory is already allocated. Cleaning up can happen during non critical times. After all, if you are using more then e.g. 32mb in critical code, you are doing something wrong. I actually use D for a pet project of mine(a game! ;) ) and this is what I do. I leave the GC disabled and essentially just use it as a free store(while not haphazardly abusing it,) and just manually clean it during opportune times. It's also better to have a single pause for a large cleanup than many small pauses, the overhead of actually scanning the memory will kill you. Atleast with web servers, a whole bunch of pauses can't be dealt with. But one large one, can easily be via load balances. How about we (ie you, the language expert!) jot down a few more points to later turn into a short but useful article on how to deal with the GC in practical situations? I'm by far not a language expert, especially with manual memory management. I can only discuss what I've dealt with my own projects. I have yet to get to the part where I have to actually try to be @nogc or pre allocate + buffers. But there will be an article at some point. But only when it is ready to go public. I am sure there will be a lot of interest in an Apache equivalent web server in D. With shared library support.
[Issue 12271] Undefined reference linker error with __traits(compiles) that returns false.
https://issues.dlang.org/show_bug.cgi?id=12271 Kapps opantm2+db...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Kapps opantm2+db...@gmail.com --- This appears to be fixed in git master. --
[Issue 12531] forward reference with nested struct
https://issues.dlang.org/show_bug.cgi?id=12531 --- Comment #3 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d178c0490b9db7f9b4c3cbc0a89f98cb79fa358b Move issue 12531 test case to compilable/testfwdref.d --
[Issue 9514] template instance … is not an alias
https://issues.dlang.org/show_bug.cgi?id=9514 --- Comment #12 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/53f165ea15c8317d8a331214d5be3d22d9aacbfc Move issue 9514 test case to compilable/testfwdref.d --
Re: dsq-1: open-source software synthesizer
On 30/03/2015 7:26 p.m., ketmar wrote: On Mon, 30 Mar 2015 19:17:35 +1300, Rikki Cattermole wrote: On 30/03/2015 7:14 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:54:42 +1300, Rikki Cattermole wrote: On 30/03/2015 6:35 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:23:11 +1300, Rikki Cattermole wrote: Although I'm a little concerned because dub is meant to validate and tell you conflicts in licenses. O_O Hey hey hey, context matters! i'm speechless 'cause it's a great idea (let machine do it work!), but i'm not sure how this can be done with wide broad of licenses out here. and i definetely want to see std.license.compare in Phobos! ;-) I agree, I'm concerned about this as well. But hey, its one of the features the dub developers want to have. what i really want to have is libdub. i.e. turning dub to library, so it can be easily integrated in any D project (rdmd comes to mind first). i don't want D building abilities, for example, but i really like to use it's package management part (and get list of files and compiler flags for that packages). sure, i can do this by parsing dub jsons and execing dub itself to do package management work, but libdub is better... maybe someday i'll wrote such thing. ;-) Yeah, the vibe.d/dub guys are amazing at getting stuff working. But horrible at abstraction's especially with library code.
Re: std.reflection prototype
On 30/03/2015 7:59 p.m., Jacob Carlborg wrote: On 2015-03-30 04:09, Rikki Cattermole wrote: We also need some form of RTInfo for modules. I made a pull request for that but unfortunately it hasn't been accepted yet. The reason seems to be that we need to come up with a way to do custom RTInfo without modifying druntime, that can also be used for this template. You, me and Walter should have a chat then. I could pretty easily come up with a way to add data into RTInfo.
Re: readln() doesn't stop to read the input.
I see... thanks to everyone for helping me out!
[Issue 14330] Wrong DWARF type of dynamic array variable
https://issues.dlang.org/show_bug.cgi?id=14330 --- 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/614c756180296550be45e4f3f81223f16ede8eb1 Fix Issue 14330 - Wrong DWARF type of dynamic array variable https://github.com/D-Programming-Language/dmd/commit/afd746b8623fd5d9322f89af7b5c40d11758607c Merge pull request #4526 from tramker/bug14330 Fix Issue 14330 - Wrong DWARF type of dynamic array variable --
Re: dsq-1: open-source software synthesizer
On Mon, 30 Mar 2015 18:54:42 +1300, Rikki Cattermole wrote: On 30/03/2015 6:35 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:23:11 +1300, Rikki Cattermole wrote: Although I'm a little concerned because dub is meant to validate and tell you conflicts in licenses. O_O Hey hey hey, context matters! i'm speechless 'cause it's a great idea (let machine do it work!), but i'm not sure how this can be done with wide broad of licenses out here. and i definetely want to see std.license.compare in Phobos! ;-) signature.asc Description: PGP signature
[Issue 14330] Wrong DWARF type of dynamic array variable
https://issues.dlang.org/show_bug.cgi?id=14330 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 12201] Crash on forward reference import within mixed in template
https://issues.dlang.org/show_bug.cgi?id=12201 --- Comment #5 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e1db093d7373076379c65702c9218ed950c0ecca Move issue 12201 test case to compilable/testfwdref.d --
Re: Format double in decimal notation without trailing zeros after the decimal point
Thank you. Actually, I'm doing this: format(%.4f, d).stripRight('0').stripRight('.') (not so elegant, but it works.) But I thinking that do not know much about the format string. On Sunday, 29 March 2015 at 03:29:26 UTC, Baz wrote: On Friday, 27 March 2015 at 15:02:19 UTC, akaDemik wrote: The task seemed very simple. But I'm stuck. I want to: 1234567890123.0 to 1234567890123 1.23 to 1.23 1.234567 to 1.2346. With format string %.4f i get 1.2300 for 1.23. With %g i get 1.23456789e+12 for 1234567890123.0. I can not believe that it is not implemented. What did I miss? such a format specifier does not exist. [.number] means the minimal digits to display, so there is always at least `number` digits. In your three examples, there is no common way to format them, you have to write you own helper: struct YourExoticFormater { private float _value; alias _value this; string toString() { // here you test the number and you choose how to diplay it. // for example if frac() returns 0 you return the string repr // esentation of the the integral part, etc... // this will work with to!string(), probably format %s (?), and the // write() functions family. } }
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Sunday, 29 March 2015 at 22:07:40 UTC, Laeeth Isharc wrote: should we add a link to the wiki and ask author if we could mirror there ? This section on wiki looks like it could with a bit of fleshing out! http://wiki.dlang.org/Coming_From/Python I just seen what you did in the wiki, that's great! I don't have much time to invest tonight but I'll definitely do my part of the job in a day or two. Thank you for noticing. It's not very inspired, but I don't have much energy at the moment, and it is the best I can do with what I have. Better an acceptable start than trying to be perfect. The Ruby / Java / Eiffel / C# / and Basic sections also need starting. While not forgetting that Java, Eiffel, C#, Basic have options to compile straight to native code, just like D, so the focus should be on other features and not on native vs VM. -- Paulo
[Issue 8609] A forward reference error with static arrays
https://issues.dlang.org/show_bug.cgi?id=8609 --- Comment #3 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/34dd113d61f9fdd537a5591986732961790c07c6 Move issue 8609 test case to compilable/testfwdref.d --
[Issue 11166] Forward reference error when alias of template instance is private
https://issues.dlang.org/show_bug.cgi?id=11166 --- Comment #4 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d7a356e71c7df01b54677d49d532741b2ea792e4 Move issue 11166 test case to compilable/testfwdref.d --
[Issue 10015] Segfault on forward referencing a variable of templated struct
https://issues.dlang.org/show_bug.cgi?id=10015 --- Comment #3 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/38996d31647a6427aa44cec77e81acd6603248f2 Move issue 10015 test case to compilable/testfwdref.d --
[Issue 10101] static if conditional cannot be at global scope using mixin template
https://issues.dlang.org/show_bug.cgi?id=10101 --- Comment #4 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e56015dd24c077ecc36685b8c43f12a9afc294ed Move issue 10101 test case to compilable/testfwdref.d --
[Issue 12983] overload not recognized depending on order of declaration
https://issues.dlang.org/show_bug.cgi?id=12983 --- Comment #4 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b96b82c277c9a6f236cd0cafe27e9fdc4a22b910 Move issue 12983 test case to compilable/testfwdref.d --
[Issue 13860] template required forward reference for typeof(member)
https://issues.dlang.org/show_bug.cgi?id=13860 --- Comment #3 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a8882ca72aa11f6c0a439ebb51caa69de48a8a20 Move issue 13860 test case to compilable/testfwdref.d --
Re: I submitted my container library to code.dlang.org
Am Mon, 30 Mar 2015 00:32:12 +0200 schrieb Martin Nowak code+news.digitalm...@dawg.eu: On 03/29/2015 05:19 PM, w0rp wrote: 4. I ended up writing my own library hashmap, which when I tested ages ago competed with the standard associative array in terms of performance. This allows me to mark many things @safe pure nothrow. Destroy! Nice docs. Always use open addressing when implementing a hash table. https://github.com/D-Programming-Language/dmd/pull/4088 https://github.com/higgsjs/Higgs/pull/170 Another thing to worry about with hash tables is this: http://events.ccc.de/congress/2012/Fahrplan/events/5152.en.html https://www.youtube.com/watch?v=wGYj8fhhUVA
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 00:20:11 UTC, Laeeth Isharc wrote: https://www.quora.com/Why-didnt-D-language-become-mainstream-comparing-to-Golang Post this on reddit.
Re: Passing myself, a struct, as a C callback context
On Monday, 30 March 2015 at 02:53:36 UTC, Paul O'Neil wrote: I'm registering a callback with some C code. The simplified story is here, but the actual code is on GitHub [1] at the end if you care. The call looks something like this. void register(void(*fp)(void*), void* context); I have a class that holds state for the callback and registers itself: final class Klass { void method() { register(callback_function, this); } } `this` is already a reference. You're taking the address of that reference. A simple cast should work: `cast(void*) this`.
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 03:26:14 UTC, deadalnix wrote: On Sunday, 29 March 2015 at 16:32:32 UTC, Idan Arye wrote: Computer science is all about tradeoffs. I used to love Ruby, but then a Rails project got out of hand... Nowadays I use it mainly as a bash replacement - Hundredfolds more expressive, only a tiny tiny bit syntax overhead, and for things that bash's safety would be enough Ruby's certainly suffices. This is pretty much the recurring story with ruby. The first 10 000 lines are a lot of fun, and then it gets out of hands. Just like any other language with dynamic typing.
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Sunday, 29 March 2015 at 19:03:06 UTC, Laeeth Isharc wrote: On Sunday, 29 March 2015 at 15:34:35 UTC, Ola Fosheim Grøstad wrote: Actually, there is quite a large overlap if you look beyond the syntax. Dart is completely unexciting, but I also find it very productive when used with the IDE. Glad to hear this - I haven't yet got very far with Dart, but it seems like a toss-up between Dart and Livescript for a passable language to run on the client (for my little use case). I don't know the future of Dart, but if you have time to wait for it you might consider atscript/Angular 2.0. Knuth is also right that people think in different ways, and it's an entirely natural thing to see a multiplicity of languages emerging that are adapted to these different ways (and of course the particular challenges people face are also different). That's why religious wars about these things have I think most imperative languages are just variations over the same theme. I pick them based on what they+ecosystem is good at, not the language by itself. So basically, you have to be best at one particular application area to do well. Go is aiming to have a good runtime for building smaller web-services, and they are getting there. Because they focus.
Re: DMD compilation speed
On 03/30/2015 01:14 AM, Martin Krejcirik wrote: It seems like every DMD release makes compilation slower. This time I see 10.8s vs 7.8s on my little project. I know this is generally least of concern, and D1's lighting-fast times are long gone, but since Walter often claims D's superior compilation speeds, maybe some profiling is in order ? 25% slowdown is severe, can you share the project and probably file a bug report?
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Mon, 30 Mar 2015 00:29:46 -0700, Jonathan M Davis via Digitalmars-d-announce wrote: On Saturday, March 28, 2015 14:19:46 Walter Bright via Digitalmars-d-announce wrote: Thank you. I need to learn std.algorithm better. Don't we all. Part of the problem with std.algorithm is its power. It's frequently the case that you think that something isn't there when it's either there under a different name, or you just have to look at one of its functions from a different angle to use it for what you're trying to do. It wouldn't surprise me at all if folks who know it quite well get surprised by what it can do at least from time to time. and those who doesn't (like me) keep finding various gems there. ;-) signature.asc Description: PGP signature
Re: Easy bugs
On 03/29/2015 10:20 PM, Jonathan wrote: Hey folks, I'm been starting to work on Debian bugs and found that most of the issues are eventually ranked from easy to hard to fix. I wondering if we can do the same (if not already). I think it would encourage new folks to pick up tasks (like myself). Sounds like a nice idea, but I doubt that it will work out. There are already plenty of tools to prioritize bugs, but people often don't even set importance or severity. We could try something different, let the core contributors weekly curate bugs. I'll start with a bunch of core.atomic improvements. https://issues.dlang.org/show_bug.cgi?id=12891 - add atomicInc and atomicDec to core.atomic https://issues.dlang.org/show_bug.cgi?id=14117 - core.atomic should be @safe That one is a bit harder, because it involves dmd and druntime, but it's a huge improvement, implementation help guaranteed. https://issues.dlang.org/show_bug.cgi?id=13713 - core.atomic should use compiler intrinsics -Martin
Re: [OT]: Congrats Andrei!
w00t \O/ congrats !
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 08:53:15 UTC, Ola Fosheim Grøstad wrote: On Sunday, 29 March 2015 at 19:03:06 UTC, Laeeth Isharc wrote: On Sunday, 29 March 2015 at 15:34:35 UTC, Ola Fosheim Grøstad wrote: Actually, there is quite a large overlap if you look beyond the syntax. Dart is completely unexciting, but I also find it very productive when used with the IDE. Glad to hear this - I haven't yet got very far with Dart, but it seems like a toss-up between Dart and Livescript for a passable language to run on the client (for my little use case). I don't know the future of Dart, but if you have time to wait for it you might consider atscript/Angular 2.0. Very dark as Angular team decided to look for Typescript instead[0]. http://blogs.msdn.com/b/typescript/archive/2015/03/05/angular-2-0-built-on-typescript.aspx Now with Dart team giving up on their VM, Dart becomes just yet another language that transpiles to JavaScript. http://news.dartlang.org/2015/03/dart-for-entire-web.html So, it will just fade way in the sea of JavaScript wannabe replacements. -- Paulo
Re: Format double in decimal notation without trailing zeros after the decimal point
Thanks for the reply. I remember about the accuracy of floating point numbers. It is encouraging that the %g can handle it. format(%.17g, 123456.789123); // == 123456.789123 And we have a flag #. As mentioned in documentation: '#' floating Always insert the decimal point and print trailing zeros. With '#' I get: format(%#.17g, 123456.789123); // == 123456.7891230 So, with the flag '#' %g is almost similar to the %f. But there is no flag repealing '#' if it is enabled by default (in the case of %f). I looked deeper into the function format and realized that my question is more related to the implementation of snprintf. If I understand correctly, snprintf does the job, and std.format provides a safe and very convenient wrapper. On Friday, 27 March 2015 at 17:08:07 UTC, Steven Schveighoffer wrote: On 3/27/15 11:02 AM, akaDemik wrote: The task seemed very simple. But I'm stuck. I want to: 1234567890123.0 to 1234567890123 1.23 to 1.23 1.234567 to 1.2346. With format string %.4f i get 1.2300 for 1.23. With %g i get 1.23456789e+12 for 1234567890123.0. I can not believe that it is not implemented. What did I miss? I think you are asking for trouble to do this. Floating point is not exact, so for example, if I do writefln(%.15f, 123456.789123); I get: 123456.78912295016 How far do you want to go before you determine there will only be zeros? It could be infinity. I'd say your best bet is to format to the max level you want, e.g. %.6f Then trim off any trailing zeros (and decimal point if necessary) after conversion to a string. -Steve
Re: DMD compilation speed
Is it only DMD compile time or DMD + ld ? ld can be very slow sometimes. 2015-03-30 1:14 GMT+02:00 Martin Krejcirik via Digitalmars-d digitalmars-d@puremagic.com: It seems like every DMD release makes compilation slower. This time I see 10.8s vs 7.8s on my little project. I know this is generally least of concern, and D1's lighting-fast times are long gone, but since Walter often claims D's superior compilation speeds, maybe some profiling is in order ?
Re: The D Language: A sweet-spot between Python and C
How about we (ie you, the language expert!) jot down a few more points to later turn into a short but useful article on how to deal with the GC in practical situations? I'm by far not a language expert, especially with manual memory management. I can only discuss what I've dealt with my own projects. I have yet to get to the part where I have to actually try to be @nogc or pre allocate + buffers. But there will be an article at some point. But only when it is ready to go public. I am sure there will be a lot of interest in an Apache equivalent web server in D. With shared library support. I like my new oneplusone smart phone, but it doesn't lend itself to thoughtful expression. Yes - understand that, but this bit is what I mean: I can only discuss what I've dealt with my own projects. One of the best things about Adam Ruppe's books and talks is the way he takes you on the journey of how he figured something out. Humans learn as much by imitating those ahead of them (who seem human and not out of reach) as by book learning. Understand wanting to wait before saying much, but at the moment the GC is one of those effective FUD factors even though my guess is it needn't be for many people who use it as an excuse not to look any further into D. This is what there is currently: http://wiki.dlang.org/Memory_Management http://wiki.dlang.org/Instantiating_Class_Objects_Elsewhere_Than_the_GC_Heap
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 07:45:50 UTC, Paulo Pinto wrote: On Monday, 30 March 2015 at 03:26:14 UTC, deadalnix wrote: On Sunday, 29 March 2015 at 16:32:32 UTC, Idan Arye wrote: Computer science is all about tradeoffs. I used to love Ruby, but then a Rails project got out of hand... Nowadays I use it mainly as a bash replacement - Hundredfolds more expressive, only a tiny tiny bit syntax overhead, and for things that bash's safety would be enough Ruby's certainly suffices. This is pretty much the recurring story with ruby. The first 10 000 lines are a lot of fun, and then it gets out of hands. Just like any other language with dynamic typing. This has more to do with the module system than with the typing. In Ruby, the `require` function reads a source file and interprets it in the global namespace. This means that from that point on, all symbols declared in that source file(and the source files it `require`s) are now part of the global namespace and accessible from anywhere(even from places that didn't `require` it), and that all monkey-patching done in that source file from now on applies *everywhere*. Compare it to Python, that has a module system that handles namespacing and forces you to `import` a module in each scope you want to use it. This means that if foo.py uses stuff from bar.py it must `import` it directly and can't rely on some other baz.py that might dropt it's `import` to bar.py because it no longer needs it without knowing that foo.py was using it. Note that Ruby does has `module`s that can be used for namespacing(or for mixins...) but using them is a hassle, because you either have to always use fully qualified names or to `mixin` them into the current namespace(which propagates to other scopes that want to use stuff from YOUR namespace...) Also note that Python also has ways to mess with the gloabl context - but you have to actually dig in to do this, compared to Ruby where messing up the global context is the standard way of doing things.
Re: I submitted my container library to code.dlang.org
On Sunday, 29 March 2015 at 22:32:34 UTC, Martin Nowak wrote: Always use open addressing when implementing a hash table. https://github.com/D-Programming-Language/dmd/pull/4088 https://github.com/higgsjs/Higgs/pull/170 Here's a variant of a open addressing hash table (Robin Hood one) that uses std.container.Array instead of relying on GC: https://bitbucket.org/infognition/robinhood/src/ (see rbhash.d, the rest is just tests) Not documented yet, sadly. Here are some reflections in this, describing the approach and comparing with other implementations (built-in AAs and linear probing hashtable from vibe.d): http://www.infognition.com/blog/2014/on_robin_hood_hashing.html Apparently with default hash functions for strings such hash tables get very slow due to clustering. With other key types they are pretty fast.
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 07:29:56 UTC, Jonathan M Davis wrote: On Saturday, March 28, 2015 14:19:46 Walter Bright via Digitalmars-d-announce wrote: Thank you. I need to learn std.algorithm better. Don't we all. Part of the problem with std.algorithm is its power. It's frequently the case that you think that something isn't there when it's either there under a different name, or you just have to look at one of its functions from a different angle to use it for what you're trying to do. It wouldn't surprise me at all if folks who know it quite well get surprised by what it can do at least from time to time. - Jonathan M Davis when this happens, it would be great if the person could post to the group a few lines about it so someone (possibly someone else) can collate into a future series on gems in phobos. maybe give subject some consistent name so it is easy to find them later.
Re: pureity of closures
On Sunday, 29 March 2015 at 12:29:13 UTC, Stefan Koch wrote: On Friday, 27 March 2015 at 17:47:26 UTC, H. S. Teoh wrote: What I'm more concerned about is whether the current compiler implementation may accidentally allow leakage of the pure function's internal context, which would break purity. T please explain your reasoning with a bit of example code. I am not sure if I get where/when impurity would be introduced. void delegate() metafoo() pure { int x; return () { x = 42; }; // now stack frame of pure function // is available externally // no idea what may happen }
Re: Windows - std.process - Setting env variables from D
On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote: On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote: Any solutions that people know of? You can't from an exe, it is a limitation of the operating system (same on Linux btw, environment variable inheritance is always from parent to child, never from child to parent). The reason batch files can do it is that they don't run in a separate process, they just run a batch of commands inside the shell itself. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009%28v=vs.85%29.aspx Altering the environment variables of a child process during process creation is the only way one process can directly change the environment variables of another process. A process can never directly change the environment variables of another process that is not a child of that process. If you're an administrator, you could poke the system-wide variables in the registry and tell the processes to reload them: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682653%28v=vs.85%29.aspx but of course, changing system-wide registry entries affects way more than just your parent shell! If you need to change a parent shell variable, the only way is to do it from a batch file. You could perhaps run a .bat which sets the variable and calls your exe to help it do some work. Thanks Adam, Yeah, I knew it was the case in Linux, I just figured as 'set' worked in a batch file that it must be possible in Windows. I think what I'm going to do is have my D program output the commands as strings that are required to set the ENV variables in the parent and then have a batch file to run the program, get its output and run the commands outputted from the D program. Can also have a bash file to do the same (using the source command). This is for setting up a build system we're using, and is normally run via Jenkins, so running it in a kind of ugly way doesnt really matter. We're currently maintaining two seperate scripts to do this work, I'm trying to consolidate them. Maintaining one large-ish D script to do this work and 2 mini scripts to call them should be easier to maintain than 2 large bash/batch scripts. Thanks!
Stream - What is D actually used for?
I was asked during my stream what is D actually used for of course I mentioned e.g. Sociomantic. But as has been said thanks to e.g. Reddit. We really need to push the use cases on the site much much more. Saying it has e.g. performance is wishy washy. We need actual metrics with a purpose. But the overall feel I've had so far is people have a good idea about D. They watch it, but don't really dig into it. In other words, we haven't bit them just yet. Perhaps a video might help? For reference, by the end I had 12 people (including myself) watching. https://livecoding.tv/alphaglosined
Re: They wrote the fastest parallelized BAM parser in D
On Monday, 30 March 2015 at 06:50:19 UTC, george wrote: http://bioinformatics.oxfordjournals.org/content/early/2015/02/18/bioinformatics.btv098.full.pdf+html and a feature http://google-opensource.blogspot.nl/2015/03/gsoc-project-sambamba-published-in.html?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+GoogleOpenSourceBlog+(Google+Open+Source+Blog) D may hold a sweet spot in bioinformatics where you often require quick turnaround (productivity) , raw speed and agility. .NET actually already has a foothold in bioinformatics, specially in user facing software and steering of reading equipments and robots. So D's needs a story over C# and F# (alongside WPF for data visualization) use cases. -- Paulo
Re: They wrote the fastest parallelized BAM parser in D
On Monday, 30 March 2015 at 06:50:19 UTC, george wrote: http://bioinformatics.oxfordjournals.org/content/early/2015/02/18/bioinformatics.btv098.full.pdf+html and a feature http://google-opensource.blogspot.nl/2015/03/gsoc-project-sambamba-published-in.html?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+GoogleOpenSourceBlog+(Google+Open+Source+Blog) D may hold a sweet spot in bioinformatics where you often require quick turnaround (productivity) , raw speed and agility. Thanks. Added to Python wiki section here: http://wiki.dlang.org/Coming_From/Python But we should also create anchors for guides by different use domains for D: finance, bioinformatics, etc. Enterprise users often like to know they are not the first.
Re: Windows - std.process - Setting env variables from D
On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote: Any solutions that people know of? You can't from an exe, it is a limitation of the operating system (same on Linux btw, environment variable inheritance is always from parent to child, never from child to parent). The reason batch files can do it is that they don't run in a separate process, they just run a batch of commands inside the shell itself. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009%28v=vs.85%29.aspx Altering the environment variables of a child process during process creation is the only way one process can directly change the environment variables of another process. A process can never directly change the environment variables of another process that is not a child of that process. If you're an administrator, you could poke the system-wide variables in the registry and tell the processes to reload them: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682653%28v=vs.85%29.aspx but of course, changing system-wide registry entries affects way more than just your parent shell! If you need to change a parent shell variable, the only way is to do it from a batch file. You could perhaps run a .bat which sets the variable and calls your exe to help it do some work.
Re: Windows - std.process - Setting env variables from D
On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote: I'm trying to set environment variables that will be visible when my D program exits. It is possible in a windows batch file using the set command (like set VAR=VALUE ) However, running this in D using: import std.process; import std.stdio; void main(){ auto pid1 = spawnShell(`set VAR=VALUE`); pid1.wait(); auto pid2 = spawnShell(`set`); pid2.wait(); } however, upon exit, there is no VAR=VALUE in the environment. Using std.process.environment[VAR]= VALUE; doesnt store the variable in the parent either. Any solutions that people know of? Type setx /? in the command shell. (Note the x). http://stackoverflow.com/questions/5898131/set-a-persistent-environment-variable-from-cmd-exe
Re: Specify an entire directory tree for string imports
On Monday, 30 March 2015 at 02:51:56 UTC, Baz wrote: It's a DMD Windows bug. It's just been reported 2 days ago: https://issues.dlang.org/show_bug.cgi?id=14349 so nothing wrong from you side. Ok, glad to see it's a bug and not a (fairly limiting) feature. I might take a stab at fixing it, if it's not too hard.
Re: Windows - std.process - Setting env variables from D
On Monday, 30 March 2015 at 13:29:06 UTC, wobbles wrote: On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote: On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote: Any solutions that people know of? You can't from an exe, it is a limitation of the operating system (same on Linux btw, environment variable inheritance is always from parent to child, never from child to parent). The reason batch files can do it is that they don't run in a separate process, they just run a batch of commands inside the shell itself. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009%28v=vs.85%29.aspx Altering the environment variables of a child process during process creation is the only way one process can directly change the environment variables of another process. A process can never directly change the environment variables of another process that is not a child of that process. If you're an administrator, you could poke the system-wide variables in the registry and tell the processes to reload them: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682653%28v=vs.85%29.aspx but of course, changing system-wide registry entries affects way more than just your parent shell! If you need to change a parent shell variable, the only way is to do it from a batch file. You could perhaps run a .bat which sets the variable and calls your exe to help it do some work. Thanks Adam, Yeah, I knew it was the case in Linux, I just figured as 'set' worked in a batch file that it must be possible in Windows. I think what I'm going to do is have my D program output the commands as strings that are required to set the ENV variables in the parent and then have a batch file to run the program, get its output and run the commands outputted from the D program. Can also have a bash file to do the same (using the source command). This is for setting up a build system we're using, and is normally run via Jenkins, so running it in a kind of ugly way doesnt really matter. We're currently maintaining two seperate scripts to do this work, I'm trying to consolidate them. Maintaining one large-ish D script to do this work and 2 mini scripts to call them should be easier to maintain than 2 large bash/batch scripts. Thanks! You tried setx, and it didn't work ? Or you don't want to set permanent environmental variables ?
[Issue 14349] String imports with subpaths don't work on Windows
https://issues.dlang.org/show_bug.cgi?id=14349 Alex Parrill initrd...@gmail.com changed: What|Removed |Added CC||initrd...@gmail.com --- Comment #1 from Alex Parrill initrd...@gmail.com --- Looks like FileName::safeSearchPath in filename.c disallows forward slash on Windows. Fixing this should just involve removing it from the blacklist, though there may be security consequences. Side note: the 'More info' link on safeSearchPath to www.securecoding.cert.org leads to a 404 page. --
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 08:53:15 UTC, Ola Fosheim Grøstad wrote: same theme. I pick them based on what they+ecosystem is good at, not the language by itself. So basically, you have to be best at one particular application area to do well. Go is aiming to have a good runtime for building smaller web-services, and they are getting there. Because they focus. It is necessary to be appealing to Ola by Ola's standards for a language to appeal to other people? I think how it actually works is that you have to find a small but focused group of people to love you lots. Then they tell other people and over time you get better at appealing to those for whom you weren't ready before. So that's similar to what you suggest in one sense, except that the chicken and egg problem is smaller. Sociomantic didn't consider the ecosystem when selecting D (or at least were not put off by its immaturity). But if in five years time their competitors realize the possibilities for doing things better, they will certainly benefit from the work Sociomantic has done on improving D (even purely as a demanding use case, but it's more than that). [And Sociomantic won't lose, in my uninformed estimation, because edge is dynamic]. Similarly in the tiniest of ways, I didn't weight the library situation very heavily in picking D. I have written a couple of bindings (painfully, before I got Dstep to work or knew the language very well!) and wrappers and if anyone like me arrives subsequently then it will be that little bit easier. So that's one more reason why it can take a couple of decades for something to be an overnight success - it takes time for paths and habits to be formed, and there are threshold effects, beyond which there is a phase change. So D's long-term prospects will be shaped by how it responds to the challenges of growth. Looks good to me right now. Laeeth.
Windows - std.process - Setting env variables from D
I'm trying to set environment variables that will be visible when my D program exits. It is possible in a windows batch file using the set command (like set VAR=VALUE ) However, running this in D using: import std.process; import std.stdio; void main(){ auto pid1 = spawnShell(`set VAR=VALUE`); pid1.wait(); auto pid2 = spawnShell(`set`); pid2.wait(); } however, upon exit, there is no VAR=VALUE in the environment. Using std.process.environment[VAR]= VALUE; doesnt store the variable in the parent either. Any solutions that people know of?
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
Ola Fosheim Grøstad: So, it will just fade way in the sea of JavaScript wannabe replacements. Maybe, but Google is using it for Google Ads. Which is their primary business? Still, a bit early to say what happens next. Perhaps next some kind of blend of Typescript and Dart will become part of a next JavaScript update :-) Bye, bearophile
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 10:04:11 UTC, Paulo Pinto wrote: Very dark as Angular team decided to look for Typescript instead[0]. It isn't very dark though, they cooperate with MS to build atscript features into Typescript instead. The two dialect were always meant to be merged at some point. So they decided to merge early. A good idea, actually. http://blogs.msdn.com/b/typescript/archive/2015/03/05/angular-2-0-built-on-typescript.aspx Now with Dart team giving up on their VM, Dart becomes just yet another language that transpiles to JavaScript. Yes, although you can run the dartvm outside the browser, not sure how much love it will receive though. So, it will just fade way in the sea of JavaScript wannabe replacements. Maybe, but Google is using it for Google Ads. Which is their primary business? Still, a bit early to say what happens next.
Re: dsq-1: open-source software synthesizer
On Monday, 30 March 2015 at 06:26:00 UTC, ketmar wrote: On Mon, 30 Mar 2015 19:17:35 +1300, Rikki Cattermole wrote: On 30/03/2015 7:14 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:54:42 +1300, Rikki Cattermole wrote: On 30/03/2015 6:35 p.m., ketmar wrote: On Mon, 30 Mar 2015 18:23:11 +1300, Rikki Cattermole wrote: Although I'm a little concerned because dub is meant to validate and tell you conflicts in licenses. O_O Hey hey hey, context matters! i'm speechless 'cause it's a great idea (let machine do it work!), but i'm not sure how this can be done with wide broad of licenses out here. and i definetely want to see std.license.compare in Phobos! ;-) I agree, I'm concerned about this as well. But hey, its one of the features the dub developers want to have. what i really want to have is libdub. i.e. turning dub to library, so it can be easily integrated in any D project (rdmd comes to mind first). i don't want D building abilities, for example, but i really like to use it's package management part (and get list of files and compiler flags for that packages). sure, i can do this by parsing dub jsons and execing dub itself to do package management work, but libdub is better... maybe someday i'll wrote such thing. ;-) +1 E.g. using libdub in my project DlangIDE would be much easy than command line interface.
[Issue 9378] std.internal.digest.sha_SSE3 breaks if compiled with PIC
https://issues.dlang.org/show_bug.cgi?id=9378 zunk...@gmail.com changed: What|Removed |Added CC||zunk...@gmail.com --
Re: DIP66 1.2 (Multiple) alias this. Continuation of work.
On 3/29/15 1:34 PM, IgorStepanov wrote: 1. We should reject types which use opDispatch and alias this at the same time. Why? Alias this has no filter. opDispatch can use template constraints. It makes perfect sense to prefer opDispatch, unless it doesn't have a valid match, and then use alias this instead. For example, if I wanted to wrap a type so I can instrument calls to 'foo', I could do something like this: struct FooWrapper(T) { T t; alias t this; auto opDispatch(string s, A...)(A args) if(s == foo) { writeln(calling foo); return t.foo(args); } } Why is this a bad use case? -Steve
Re: D1 operator overloading in D2
On 3/30/15 1:42 AM, ketmar wrote: it's still working. moreover, it is used in Phobos! and yet it's not documented anywhere. what i want to know is whether they will be removed for good, or brought back and properly documented? the current situation is awful: compiler has special treatment for some aggregate members, but nothing in documentation tells you that. They technically can be removed for good, because an operator template can now be an alias (this was pretty recent, maybe 1 year ago?). There is still one thing that doesn't work right I think -- covariance. But doing so would break all code that uses it. I think at the very least, Phobos should replace all D1-style operators with D2 style. Dogfooding and all. Originally when the yay, look at these new template-style operators was posted, it was imagined that one could do: mixin(generateD2Operators); in your aggregate, and the links from the new style operators to the old style would give you an upgrade path without having to rewrite all your operators. This really wasn't possible until the alias update. But maybe it's time to add this to std.typecons. I think at the very least we should provide a link to the D1 documentation and say that D1 operators overloads are still supported, but their support is not guaranteed to continue, please use D2 operators wherever possible. Clearly, there is some work that should be done. I agree that if you come across old code, and you are unaware of the old style operators, you will be super-confused as to how the operators are even working. That can be very annoying. I'll put in a doc PR to reference the D1 documentation. -Steve
[Issue 14364] DMD should compile (correctly) SDC test0167.d
https://issues.dlang.org/show_bug.cgi?id=14364 --- Comment #6 from Kenji Hara k.hara...@gmail.com --- (In reply to deadalnix from comment #5) Reopening. The spec is wrong. It has been discussed many time that should have LTR semantic. Can you list the links to the discussions? --
[Issue 12891] add atomicInc and atomicDec to core.atomic
https://issues.dlang.org/show_bug.cgi?id=12891 Jonathan Dunlap jad...@gmail.com changed: What|Removed |Added CC||jad...@gmail.com --- Comment #1 from Jonathan Dunlap jad...@gmail.com --- I might take a look at this. Would a lock:xadd be appropriate for this atomicAdd? --
Re: Passing myself, a struct, as a C callback context
On 3/30/15 5:12 AM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net wrote: On Monday, 30 March 2015 at 02:53:36 UTC, Paul O'Neil wrote: I'm registering a callback with some C code. The simplified story is here, but the actual code is on GitHub [1] at the end if you care. The call looks something like this. void register(void(*fp)(void*), void* context); I have a class that holds state for the callback and registers itself: final class Klass { void method() { register(callback_function, this); } } `this` is already a reference. You're taking the address of that reference. A simple cast should work: `cast(void*) this`. To build on this further, this for a class is actually taking a local stack reference, this is why it's not allowed. And technically, cast(void*) this is dangerous in the general case because opCast can be overridden. If you absolutely need to get a pointer to a class reference, you would need to do this: auto x = this; auto p = x; For example, for a foolproof implementation of converting a class reference to void *, you would need to do: auto x = this; auto p = *(cast(void **)x); I wonder if those who made this change thought of this problem? -Steve
Re: D1 operator overloading in D2
On Mon, 30 Mar 2015 11:25:01 -0400, Steven Schveighoffer wrote: On 3/30/15 1:42 AM, ketmar wrote: it's still working. moreover, it is used in Phobos! and yet it's not documented anywhere. what i want to know is whether they will be removed for good, or brought back and properly documented? the current situation is awful: compiler has special treatment for some aggregate members, but nothing in documentation tells you that. They technically can be removed for good, because an operator template can now be an alias (this was pretty recent, maybe 1 year ago?). There is still one thing that doesn't work right I think -- covariance. But doing so would break all code that uses it. I think at the very least, Phobos should replace all D1-style operators with D2 style. Dogfooding and all. Originally when the yay, look at these new template-style operators was posted, it was imagined that one could do: mixin(generateD2Operators); in your aggregate, and the links from the new style operators to the old style would give you an upgrade path without having to rewrite all your operators. This really wasn't possible until the alias update. But maybe it's time to add this to std.typecons. I think at the very least we should provide a link to the D1 documentation and say that D1 operators overloads are still supported, but their support is not guaranteed to continue, please use D2 operators wherever possible. Clearly, there is some work that should be done. I agree that if you come across old code, and you are unaware of the old style operators, you will be super-confused as to how the operators are even working. That can be very annoying. I'll put in a doc PR to reference the D1 documentation. -Steve i actually replaced that with D2 opovers in Phobos, and it passes unittests, so i can create ER in bugzilla with patch for someone to turn it into PR. signature.asc Description: PGP signature
[Issue 14371] [CTFE] Binary assignment expression makes wrong result in compile-time
https://issues.dlang.org/show_bug.cgi?id=14371 --- 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/4a3c841ed8d4141af227bd47cd75db1d687983af fix Issue 14371 - [CTFE] Binary assignment expression makes wrong result in compile-time https://github.com/D-Programming-Language/dmd/commit/686f01ddeb416981af2a9c22de48fa3d51fe27cc Merge pull request #4529 from 9rnsr/fix14371 Issue 14371 - [CTFE] Binary assignment expression makes wrong result in compile-time --
[Issue 14371] [CTFE] Binary assignment expression makes wrong result in compile-time
https://issues.dlang.org/show_bug.cgi?id=14371 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
Re: Easy bugs
Actually, this is a good alternative: post here if anyone knows about simple bugs that I can tackle. Although Martin, I wouldn't considering writing patches involving atomic ops to be easy/simple bugs. However, I think I know enough x86 asm to write an optimized version of atomicInc and atomicDec. I'll take a crack at it this week! I'll start with a bunch of core.atomic improvements. https://issues.dlang.org/show_bug.cgi?id=12891 - add atomicInc and atomicDec to core.atomic https://issues.dlang.org/show_bug.cgi?id=14117 - core.atomic should be @safe That one is a bit harder, because it involves dmd and druntime, but it's a huge improvement, implementation help guaranteed. https://issues.dlang.org/show_bug.cgi?id=13713 - core.atomic should use compiler intrinsics -Martin
Re: pureity of closures
On Monday, 30 March 2015 at 13:18:44 UTC, Dicebot wrote: On Sunday, 29 March 2015 at 12:29:13 UTC, Stefan Koch wrote: On Friday, 27 March 2015 at 17:47:26 UTC, H. S. Teoh wrote: What I'm more concerned about is whether the current compiler implementation may accidentally allow leakage of the pure function's internal context, which would break purity. T please explain your reasoning with a bit of example code. I am not sure if I get where/when impurity would be introduced. void delegate() metafoo() pure { int x; return () { x = 42; }; // now stack frame of pure function // is available externally // no idea what may happen } Maybe even better: void delegate() metafoo pure { int x; if (x 0) { return () = x -= 1; } else { return () = x += 1; } }
Re: pureity of closures
On Monday, 30 March 2015 at 13:18:44 UTC, Dicebot wrote: On Sunday, 29 March 2015 at 12:29:13 UTC, Stefan Koch wrote: On Friday, 27 March 2015 at 17:47:26 UTC, H. S. Teoh wrote: What I'm more concerned about is whether the current compiler implementation may accidentally allow leakage of the pure function's internal context, which would break purity. T please explain your reasoning with a bit of example code. I am not sure if I get where/when impurity would be introduced. void delegate() metafoo() pure { int x; return () { x = 42; }; // now stack frame of pure function // is available externally // no idea what may happen } Hmmm... Where's the (conceptual) difference to this: struct S { int x; void foo() pure { x = 42; } } S* metafoo() pure { auto s = new S; return s; } Why should your example be impure?
Re: This Week in D #11: new release, undocumented feature exposed, FAQ answered, DConf schedule posted.
On 3/29/15 10:35 PM, weaselcat wrote: On Monday, 30 March 2015 at 01:14:59 UTC, Adam D. Ruppe wrote: http://arsdnet.net/this-week-in-d/mar-29.html The big pieces have already been posted to Reddit, so idk if we want to post again, but if you want to, go ahead and just post the reddit link here too as this is a nice little roundup. I also took the opportunity to document the new ddoc `code` feature! I think reddit is starting to act unfriendly to frequent D posts now, this week in D maybe shouldn't be cross-posted there so much. Really? Please, let's drop the dependency on reddit for street cred or affirmation. I'm sick of it. If a user on reddit doesn't like D, then that is their problem. Besides, nobody here is in charge of whether reddit can have posts on D or not. -Steve
D as System Language
I'm not so much into the D Projects, but am familiar with the concepts of the language. I want to use D as the language of a hobby operating system. There isn't much documentation about doing so, and the question already got asked: When D is a system language, why hasn't anyone made an OS in it yet?. So I ask it again, maybe a bit differently: Is there usefull documentation about using D as OS language? I know there's https://github.com/xomboverlord , but this is for D1, and didn't get updated to D2. It won't get updated by me (in the near future), because I don't know enough of D and the inner workings of it, to do such a thing. For your interest: At first, the OS should run on x86_64. Don't expect any repositories hosted by me about an OS in D, it's just a hobbyistic interest of me.
[Issue 14377] compiler segfault
https://issues.dlang.org/show_bug.cgi?id=14377 --- Comment #1 from Ketmar Dark ket...@ketmar.no-ip.org --- seems to be fixed in 2.067. --
Re: D as System Language
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote: Don't expect any repositories hosted by me about an OS in D, it's just a hobbyistic interest of me. I find it a bit sad... I mean, today not much documentation exists, such a project could be a great example. If everybody locks down its projects then of course nobody will find about it. Maybe the answer to your first question was that other did but decided not to share it. Well, that said, it is your choice to open it or not, and I have no right to criticize this any further.
Re: D as System Language
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote: Is there usefull documentation about using D as OS language? I wrote briefly in my book some stuff that might help get you started https://www.packtpub.com/application-development/d-cookbook Basically you can start with an empty runtime and then add back missing functions as needed to get it to compile. For your interest: At first, the OS should run on x86_64. Though I did 32 bit, I haven't worked with 64 bit. Probably not that much different though.
Re: D as System Language
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote: I'm not so much into the D Projects, but am familiar with the concepts of the language. I want to use D as the language of a hobby operating system. There isn't much documentation about doing so, and the question already got asked: When D is a system language, why hasn't anyone made an OS in it yet?. So I ask it again, maybe a bit differently: Is there usefull documentation about using D as OS language? I know there's https://github.com/xomboverlord , but this is for D1, and didn't get updated to D2. It won't get updated by me (in the near future), because I don't know enough of D and the inner workings of it, to do such a thing. For your interest: At first, the OS should run on x86_64. Don't expect any repositories hosted by me about an OS in D, it's just a hobbyistic interest of me. https://github.com/xomboverlord/xomb
rvalue based copy
Hi, Surely I am misunderstanding something. I got something like this : struct S { void opAssign(const ref s) { //... } } S genS() { S s; //... return s; } main() { S s; s = genS(); } DMD says : ...opAssign (ref const(S) point) is not callable using argument types (S). Then how to do what I wanna do ? Why doesn't this works ? (I am gessing ref argument explitly means no rvalue) Thanks in advance for your help ! :)
Re: Windows - std.process - Setting env variables from D
On Monday, 30 March 2015 at 14:14:50 UTC, Laeeth Isharc wrote: On Monday, 30 March 2015 at 13:29:06 UTC, wobbles wrote: On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote: On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote: Any solutions that people know of? You can't from an exe, it is a limitation of the operating system (same on Linux btw, environment variable inheritance is always from parent to child, never from child to parent). The reason batch files can do it is that they don't run in a separate process, they just run a batch of commands inside the shell itself. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009%28v=vs.85%29.aspx Altering the environment variables of a child process during process creation is the only way one process can directly change the environment variables of another process. A process can never directly change the environment variables of another process that is not a child of that process. If you're an administrator, you could poke the system-wide variables in the registry and tell the processes to reload them: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682653%28v=vs.85%29.aspx but of course, changing system-wide registry entries affects way more than just your parent shell! If you need to change a parent shell variable, the only way is to do it from a batch file. You could perhaps run a .bat which sets the variable and calls your exe to help it do some work. Thanks Adam, Yeah, I knew it was the case in Linux, I just figured as 'set' worked in a batch file that it must be possible in Windows. I think what I'm going to do is have my D program output the commands as strings that are required to set the ENV variables in the parent and then have a batch file to run the program, get its output and run the commands outputted from the D program. Can also have a bash file to do the same (using the source command). This is for setting up a build system we're using, and is normally run via Jenkins, so running it in a kind of ugly way doesnt really matter. We're currently maintaining two seperate scripts to do this work, I'm trying to consolidate them. Maintaining one large-ish D script to do this work and 2 mini scripts to call them should be easier to maintain than 2 large bash/batch scripts. Thanks! You tried setx, and it didn't work ? Or you don't want to set permanent environmental variables Yep, correct. Don't want them to be permanent. The systems have to be clean for other tests at all times, so they need to be on a shell by shell basis sadly.
Re: D as System Language
On Monday, 30 March 2015 at 17:19:38 UTC, Columbus wrote: Also I thought I would find some documentation about creating a custom runtime and so on. Which is information I didn't get from osdev.org I think there is a page on the osdev wiki somewhere, but odds are the chapter in my book is the best we have (and even there, I didn't go too deep into it, I just got interrupts working on x86) I can also offer my minimal.zip which does exceptions and other more advanced features on bare metal and could serve as a guide/starting point. http://arsdnet.net/dcode/minimal.zip
Re: string concatenation with %s
On Monday, 30 March 2015 at 17:18:01 UTC, Suliman wrote: same problem. I am preparing string to next SQL request: string sss = format(SELECT * FROM test.imgs WHERE src LIKE CONCAT('%', REPLACE(CAST(CURDATE()as char), -, ), '%') OR CONCAT('%', CAST(CURDATE()as char), '%')); Here's your code without SQL noise: string sss = format(foo-, bar); It should be obvious now that you forgot to escape those double quotes.
Re: rvalue based copy
On Monday, 30 March 2015 at 17:20:30 UTC, matovitch wrote: Yes but you know what they say does it really do a copy of the struct or is the compiler smart enougth most of the time to avoid copy. (I think it's called return value optimization). Copying isn't necessarily a problem, for small structs it is more efficient to copy than passing by ref. But the return value optimization *is* typically done, yes. Why is this only restricted to templates ? It makes two versions of the function, like overloading on the two types of arguments automatically.
Re: D as System Language
On Monday, 30 March 2015 at 17:22:47 UTC, Adam D. Ruppe wrote: I think there is a page on the osdev wiki somewhere, but odds are the chapter in my book is the best we have (and even there, I didn't go too deep into it, I just got interrupts working on x86) I can also offer my minimal.zip which does exceptions and other more advanced features on bare metal and could serve as a guide/starting point. http://arsdnet.net/dcode/minimal.zip I'm now reading the specific chapter in your book. Maybe I'll work it out.
Re: rvalue based copy
On Monday, 30 March 2015 at 17:21:53 UTC, Steven Schveighoffer wrote: One solution is to overload void opAssign(ref const S s) {...} void opAssign(const S s) {...} lvalues will go into the ref version, rvalues into the non-ref. There won't be any copying of data, so you still save a postblit and copying on the stack. But you have to repeat the implementation. You can call the ref version from the non-ref version: void opAssign(ref const S s) {...} void opAssign(const S s) {opAssign(s); /* calls the ref version */} Of course, only do this when the ref version doesn't store s.
Re: string concatenation with %s
string sss = format(foo-, bar); It should be obvious now that you forgot to escape those double quotes. Thanks! Is there any way to stay string as is. without need of it's escaping and so on? It's seems I have seen something like it in docs, but I am not sure about it...
Re: string concatenation with %s
On Monday, 30 March 2015 at 17:34:20 UTC, Suliman wrote: string sss = format(foo-, bar); It should be obvious now that you forgot to escape those double quotes. Thanks! Is there any way to stay string as is. without need of it's escaping and so on? It's seems I have seen something like it in docs, but I am not sure about it... There are various other string literal forms [1] where you don't need to escape double quotes: AlternateWysiwygString - backticks as delimiters: `foo -, bar` DelimitedString - can use delimiters of choice, here parentheses: q(foo -, bar) TokenString - for D code, probably not a good choice here, but works: q{foo -, bar} Of course, as they're all delimiter based, there will always something you can't put into the string verbatim. [1] http://dlang.org/lex.html#StringLiteral
Re: D as System Language
Many thanks for your work!!! This is the thing I searched so long. Now only the people from risc-v need to publish the privileged ISA documentation, and I can work on my weird plan. I don't know in what kind of problems I'm running into, but it is one of the only exciting things I'm interested in. I want to create an OS written in D for the RISC-V platform. Maybe some UNIX clone, or an exokernel. I don't know. Probably some combination (I mean they don't exclude eachother). But don't expect anything from me, maybe you will hear from me again in some time, maybe not. This is the current plan I'm working on, but it may change. thanks again for your help Columbus out
[Issue 14376] [REG2.064] false positive Error: one path skips field
https://issues.dlang.org/show_bug.cgi?id=14376 Vladimir Panteleev thecybersha...@gmail.com changed: What|Removed |Added CC||thecybersha...@gmail.com Summary|false positive Error: one |[REG2.064] false positive |path skips field |Error: one path skips ||field Severity|normal |regression --- Comment #1 from Vladimir Panteleev thecybersha...@gmail.com --- This code compiles in 2.063. --
Re: D as System Language
On Monday, 30 March 2015 at 15:42:46 UTC, weaselcat wrote: On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote: I'm not so much into the D Projects, but am familiar with the concepts of the language. I want to use D as the language of a hobby operating system. There isn't much documentation about doing so, and the question already got asked: When D is a system language, why hasn't anyone made an OS in it yet?. So I ask it again, maybe a bit differently: Is there usefull documentation about using D as OS language? I know there's https://github.com/xomboverlord , but this is for D1, and didn't get updated to D2. It won't get updated by me (in the near future), because I don't know enough of D and the inner workings of it, to do such a thing. For your interest: At first, the OS should run on x86_64. Don't expect any repositories hosted by me about an OS in D, it's just a hobbyistic interest of me. https://github.com/xomboverlord/xomb xomboverlord happens to be Steve Klabnik, now on the Rust team.
Re: They wrote the fastest parallelized BAM parser in D
.NET actually already has a foothold in bioinformatics, specially in user facing software and steering of reading equipments and robots. So D's needs a story over C# and F# (alongside WPF for data visualization) use cases. -- Paulo Though when it comes to open source bioinformatics projects, Perl and Python have a large foothold among most most bioinformaticians. Most utilities that require speed are often written in C and C++ (BLAST, HMMER, SAMTOOLS etc). I think D stands a good chance as a language of choice for bioinformatics projects. George
Re: Stream - What is D actually used for?
On Monday, 30 March 2015 at 13:29:08 UTC, Rikki Cattermole wrote: what is D actually used for Have you ever heard that phrase, Jack of all trades, master of none? If you could pick one language that lives up to this, which one would you pick?
Re: rvalue based copy
On Monday, 30 March 2015 at 17:14:27 UTC, Adam D. Ruppe wrote: On Monday, 30 March 2015 at 17:09:14 UTC, matovitch wrote: (I am gessing ref argument explitly means no rvalue) That's right. I'd first say don't use ref, just use const S and it will work and probably do what you need efficiently. Yes but you know what they say does it really do a copy of the struct or is the compiler smart enougth most of the time to avoid copy. (I think it's called return value optimization). If you do want it to be ref though, rvalues aren't allowed unless you make it auto ref which needs to be a template: // this will work, second set of () makes it a template // then auto ref makes it use ref for lvalues and non-ref for rvalues // automatially void opAssign()(const auto ref S s) { //... } Why is this only restricted to templates ?
Re: rvalue based copy
On 3/30/15 1:09 PM, matovitch wrote: Hi, Surely I am misunderstanding something. I got something like this : struct S { void opAssign(const ref s) { //... } } S genS() { S s; //... return s; } main() { S s; s = genS(); } DMD says : ...opAssign (ref const(S) point) is not callable using argument types (S). Then how to do what I wanna do ? Why doesn't this works ? (I am gessing ref argument explitly means no rvalue) Thanks in advance for your help ! :) One solution is to overload void opAssign(ref const S s) {...} void opAssign(const S s) {...} lvalues will go into the ref version, rvalues into the non-ref. There won't be any copying of data, so you still save a postblit and copying on the stack. But you have to repeat the implementation. Another possibility is to use auto ref, but that requires a template. Annoying as this is (and blatantly awkward), it saves you from having to implement twice: void opAssign(T)(auto ref const T s) if(is(T == S)) {...} -Steve
[Issue 12984] Cannot interpret [template] at compile time depending on order of declaration
https://issues.dlang.org/show_bug.cgi?id=12984 Nils nilsboss...@googlemail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Nils nilsboss...@googlemail.com --- fixed by https://github.com/D-Programming-Language/dmd/commit/75ffb6305b38edb05e4f132de7795e93df75a579 --
Re: Stream - What is D actually used for?
On Monday, 30 March 2015 at 17:24:25 UTC, Israel wrote: Have you ever heard that phrase, Jack of all trades, master of none? If you could pick one language that lives up to this, which one would you pick? I'd say C++, you can do everything with it, it is just awkward. D actually is a master of all trades - I haven't encountered a programming problem yet, except when restrained by external factors, that D isn't my first choice to solve it with.
Re: Gary Willoughby: Why Go's design is a disservice to intelligent programmers
On Monday, 30 March 2015 at 10:45:50 UTC, bearophile wrote: Ola Fosheim Grøstad: So, it will just fade way in the sea of JavaScript wannabe replacements. Maybe, but Google is using it for Google Ads. Which is their primary business? Still, a bit early to say what happens next. Perhaps next some kind of blend of Typescript and Dart will become part of a next JavaScript update :-) Yeah, I think both Microsoft and Google see this as an effort to prototype what Ecmascript6+ should be like.