Re: [OT] Nim is usable with PNaCl
On 26/04/2015 5:37 p.m., weaselcat wrote: https://github.com/hackwaly/pepper-nim Wonder how hard it would be to get D to do the same, or if it's worth the effort over trying to adapt LDC output to emscripten. I already asked on D.ldc. No reply. I even included links to the differences between what PNaCL supports and LLVM IR.
[Issue 8973] core.cpuid.coresPerCPU returning incorrect value.
https://issues.dlang.org/show_bug.cgi?id=8973 --- Comment #1 from Joakim db...@joakim.fea.st --- Unless you can provide us with some debug data for this function, nobody can debug this unless they have the exact same or similar CPU, which I certainly don't have. --
ARM Cortex-M Microcontroller startup files
Some of you already know that I've been working on startup files for STM32F4xx and LPC17xx. Since a number of people have shown interest in these files, I've now merged those two repositories into one and improved it for adding more vendors. What I'd like you to do, is to tell me which microcontrollers you want support for. This means filing a feature request (eg. file an issue at GitHub telling me which device(s) you want added. If possible, please provide a URL to an existing library. I've filed a feature request myself as an example (these are already in the works, so no need to file any STM32F3 request.) The new repository: https://github.com/jens-gpio/MCU Example feature request: https://github.com/jens-gpio/MCU/issues/1 The old repositories STM32F4xx and LPC17xx are dead (the README has been updated to point to the MCU repository)
Re: setjmp / longjmp
On Sunday, 26 April 2015 at 05:56:46 UTC, ketmar wrote: On Sat, 25 Apr 2015 23:25:13 +, Cassio Butrico wrote: Hello everyone , first congratulations for the wonderful forum , I wish someone could help me , I am writing a small basic interpreter in D and I am with some difficulties. estoutentando manupular the setjmp / longjmp buffers , but the error , I use windows 7 and the dmd 2067 , will be whose manipulate the buffers save and return ? Excuse my english sucks. you shouldn't use setjmp/longjmp in D. use exceptions instead. something like this: instead of setjmp: try { doit } catch (MyException e) { process e } and instead of longjmp: throw new MyException(); Thank you for answering me ketmar I will try this
Adding Radix Sort into Phobos
I have a radix sort implementation at https://github.com/nordlow/justd/blob/master/intsort.d#L92intsort.d which beats Phobos own Quicksort by a factor 1.5 to 4 depending on element type (Intergral or FloatingPoint). Anyone up for the job of adapting and merging it into Phobos' std.algorithm.sorting? See also: https://github.com/Xinok/XSort/issues/1#issuecomment-96321466
Re: Startup files for STM32F4xx
Am Sun, 26 Apr 2015 00:14:42 + schrieb Mike n...@none.com: Usage: auto b = PORTB.load(); PORTB.toggle!PIN0; PORTB.PIN0 = Level.low; writeln(PORTB.PIN0); PORTB.TEST = 0b000; That's some nice code! and really leveraging D to great effect. I know that Volatile!(T) took some engineering to get right, so it would be nice to have that as an official type IMO. It should certainly be in druntime in the long term. But first it needs quite some testing. Maybe I'll propose it for std.experimental or I'll create a dub-package first. The remaining problem is performance. (With optimization the generated code is as good as equivalent C code. However, we need to avoid size overhead: e.g. struct initializers and the opX functions shouldn't generate functions in the executable, though tha can be fixed with the linker) I'm not sure I follow how the linker can solve this. Could you elaborate? That was a sloppily written statement, sorry. Performance as in speed / number of instructions / cycles is not an issue with optimization. Default initialization is a problem as even all-zero initializers go into bss right now. So we need n bytes per struct type in the bss section. (For the register wrapper every register is a type). If they went into rodata instead and if the linker merges all-zero symbols then the overhead is limited to the biggest used struct size. I'm not sure if linkers do this optimization. For small functions (the generated properties, operator overloads) the problem is that these are always force-inlined for performance but we still output a complete function (in order to give the function a valid address and similar things). The linker can remove these with -ffunction-sections and --gc-sections. It might still be nice to have 'static (force)inline' / 'extern (force)inline' semantics[1][2][3]. [1] http://stackoverflow.com/a/216546/471401 [2] http://www.greenend.org.uk/rjk/tech/inline.html [3] https://gcc.gnu.org/onlinedocs/gcc/Inline.html
Re: DMD Copyright string
On 4/21/2015 11:20 AM, Colin wrote: Surely that's meant to be 2015? Walter should prob fix that. Someone could steal D! All the replies, and no PRs. Sigh! https://github.com/D-Programming-Language/dmd/pull/4615
Re: Cleaned up C++
On Wednesday, 22 April 2015 at 19:51:23 UTC, ponce wrote: I should put in in a d-idioms anyway. http://p0nce.github.io/d-idioms/#How-does-D-improve-on-C++17?
Re: Literan/constant ranges
On Sunday, 26 April 2015 at 06:43:22 UTC, Manu wrote: Man, I suck so hard at navigating the std library! Practically nothing is named anything I expect or am familiar with _ It shouldn't be easier to write my own than to find what I want in the lib. There are some differences though; repeat() is not a literal, and repeats infinitely, which means you need to conjoin take(n), which leads to a long and less-readable line. There is a second overload.
Re: setjmp / longjmp
On Sat, 25 Apr 2015 23:25:13 +, Cassio Butrico wrote: Hello everyone , first congratulations for the wonderful forum , I wish someone could help me , I am writing a small basic interpreter in D and I am with some difficulties. estoutentando manupular the setjmp / longjmp buffers , but the error , I use windows 7 and the dmd 2067 , will be whose manipulate the buffers save and return ? Excuse my english sucks. you shouldn't use setjmp/longjmp in D. use exceptions instead. something like this: instead of setjmp: try { doit } catch (MyException e) { process e } and instead of longjmp: throw new MyException(); signature.asc Description: PGP signature
Re: Literan/constant ranges
Man, I suck so hard at navigating the std library! Practically nothing is named anything I expect or am familiar with _ It shouldn't be easier to write my own than to find what I want in the lib. There are some differences though; repeat() is not a literal, and repeats infinitely, which means you need to conjoin take(n), which leads to a long and less-readable line. I wonder if there is any value to a literal/variable distinction as I have? On 26 April 2015 at 15:05, Meta via Digitalmars-d digitalmars-d@puremagic.com wrote: On Sunday, 26 April 2015 at 04:59:48 UTC, Manu wrote: I find myself using these a lot. I hacked them together because I couldn't find anything equally simple in the std library: https://gist.github.com/TurkeyMan/1f551bc5a0d2cec8af2e The question is, is there already a proper/better way to do this? LiteralRange looks quite similar to std.range.repeat[1], and ConstantRange looks similar to std.range.only[2]. 1: http://dlang.org/phobos/std_range.html#repeat 2: http://dlang.org/phobos/std_range.html#only
Re: ARM Cortex-M Microcontroller startup files
On 04/26/2015 05:55 PM, Jens Bauer wrote: Done. http://wiki.dlang.org/Microcontroller_startup_files -This is my first successful Wiki page, BTW. :) Nice, minilibd seems to be maintained as well, you happen to know the author? I'd really like to see binary releases of GDC for arm-none-eabi that ship with a patched compiler (iff necessary) and minilibd.
Re: std.json questions
Thank everybody for you help. For now, yajl-d seems to be an optimal for my task, however will keep an eye for stdx.data.json too.
Re: [OT] Nim is usable with PNaCl
On 04/26/2015 08:18 AM, Rikki Cattermole wrote: I already asked on D.ldc. No reply. I even included links to the differences between what PNaCL supports and LLVM IR. What are they supposed to say? Obviously doable but requires lots of work. This is one of those particular interests that won't get implemented unless a stakeholder writes the code.
Re: extern(C++) infer linkage from interface?
On Sat, 25 Apr 2015 09:50:46 -0400, Daniel Murphy yebbliesnos...@gmail.com wrote: bitwise wrote in message news:op.xxishfi24sdys0@nicolass-macbook-pro.local... I have a class with callbacks that can be overridden, which are inherited from an extern(C++) interface. The callbacks are called from C++ code. Is there any chance that the linkage will be inferred in the future? I think there's a bug report about this, somewhere. I'm not sure it's worth changing. For reference: https://issues.dlang.org/show_bug.cgi?id=13867
[Issue 14476] core.thread unit tests failing on FreeBSD 9+
https://issues.dlang.org/show_bug.cgi?id=14476 Martin Nowak c...@dawg.eu changed: What|Removed |Added CC||c...@dawg.eu --- Comment #4 from Martin Nowak c...@dawg.eu --- (In reply to Jonathan M Davis from comment #2) It looks like it's this commit in druntime which broke things: I hope you used https://github.com/CyberShadow/Digger to bisect this. --
Re: Cleaned up C++
On Sunday, 26 April 2015 at 12:04:20 UTC, Laeeth Isharc wrote: On Sunday, 26 April 2015 at 09:26:11 UTC, ponce wrote: On Wednesday, 22 April 2015 at 19:51:23 UTC, ponce wrote: I should put in in a d-idioms anyway. http://p0nce.github.io/d-idioms/#How-does-D-improve-on-C++17? excellent. I linked it here: http://wiki.dlang.org/Coming_From Luke 4:24 nobody is prophet in his own country http://www.reddit.com/r/programming/comments/33x6lj/how_does_d_improve_on_c17/
[Issue 14476] core.thread unit tests failing on FreeBSD 9+
https://issues.dlang.org/show_bug.cgi?id=14476 --- Comment #6 from Jonathan M Davis issues.dl...@jmdavisprog.com --- (In reply to Martin Nowak from comment #4) (In reply to Jonathan M Davis from comment #2) It looks like it's this commit in druntime which broke things: I hope you used https://github.com/CyberShadow/Digger to bisect this. I've never used Digger, and if I knew about it, I'd forgotten. But git-bisect was plenty, and given that that commit adds the test that fails and the code that it's testing, it's not exactly surprising. The harder part was figuring out what pull request the commit was associated with. But unfortunately, I don't know much about what the code is doing, which makes it harder for me to be helpful.(In reply to Martin Nowak from comment #5) (In reply to Jonathan M Davis from comment #2) The second failure with Testing link_linkdep 2.067.0 comes with shared library support for FreeBSD, not sure why they fail on 9.1. The ugly runtime liker bug is fixed in both 8.4 and 9.1. http://svnweb.freebsd.org/base?view=revisionrevision=226155 Hmmm. I'm using 10.1, so I would _hope_ that it would be fine given that the older versions are, but then again, the code in core.thread seems to work fine on 8.4 and not 9.1 or 10.1. However, looking at Joakim's post, his 32-bit 9.1 VM is failing in a different place earlier in the tests if he comments out the failing core.thread test, so for that problem, 9.1 and 10.1 don't seem to be acting the same (though maybe it's a 32-bit vs 64-bit problem, since he's using 32-bits, whereas I'm using 64). Regardless, it's clear that 8.4 is not acting the same as later versions, so the version of FreeBSD seems to matter more than would be desirable. Maybe I should figure out a way to get a FreeBSD 10.1 setup available for Brad on the autotester so that we're not just testing on an older version - though if he wants the current machines to be supported, he'll have to update the current FreeBSD machines by July according to what freebsd.org says about the support lifecycle of 8.4. But for better or worse, I'm now using FreeBSD 10.1 as my main OS, so I'm likely to start noticing some of these problems that have been getting passed the autotester. --
Re: [OT] compiler optimisations
On 4/26/15 4:33 AM, Laeeth Isharc wrote: I'll leave it there as per Andrei's request about focusing on the hackathon. Thanks! -- Andrei
Re: AA Performance in Benchmarks
On 04/26/2015 12:58 PM, Daniel Murphy wrote: Yes, if we had an AA in phobos. Yes, I think phobos should get a few more optimized containers. SparseSet DenseSet SparseHash DenseHash They should be configurable w.r.t. load factor, equality comparison, and allocation policy (when std.allocator is available). http://sparsehash.googlecode.com/svn/trunk/doc/index.html As the builtin druntime AA will likely always remain a general purpose hash table we can't do all the possible optimizations.
[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition
https://issues.dlang.org/show_bug.cgi?id=13867 --- Comment #1 from nick nicolas.jincher...@gmail.com --- +1 for allowing extern(C++) interface members to be implemented without specifying the linkage. In fact, I believe it is a bug for this not to be the case. Consider this example: interface A { void foo(); } extern(C++) interface B { void foo(); } class Test : A, B { void foo() { } extern(C++) void foo(){} } void main() { Test test = new Test(); test.foo();// error: ambiguous call to 'foo' } I believe the fact that the above example would compile fine if 'extern(C++)' was removed reinforces this point. I think this should be changed to a bug. --
C++ interface problem
I hope someone can tell me where my bug is. I am linking to a dynamic library with C++ interfaces: ``` //alias S = ulong; struct S { ulong data; } extern(C) I getI(); extern(C++) interface I { void foo(); S bar(); } ``` now the question is why does it crash to access bar() in both cases? (using alias aswell as the struct) The C++ class S is a POD class (it contains only 64bits of data and is compiled byte aligned) The call to bar() from D just crashes on win32, the interface works fine on osx 64bit. Any help would be welcome! Is this even possible to solve ? I have no access to the library code so I am not able to build the C++ lib with like DMC or something...
Re: extern(C++) infer linkage from interface?
On Sat, 25 Apr 2015 09:50:46 -0400, Daniel Murphy yebbliesnos...@gmail.com wrote: bitwise wrote in message news:op.xxishfi24sdys0@nicolass-macbook-pro.local... I have a class with callbacks that can be overridden, which are inherited from an extern(C++) interface. The callbacks are called from C++ code. Is there any chance that the linkage will be inferred in the future? I think there's a bug report about this, somewhere. I'm not sure it's worth changing. Ok, thanks for the info. I was wondering if there was some prohibitive reason that the behavior I'm requesting was not currently in force. I guess I'll dig around in bugzilla then, and file an enhancement request if one does not exist.
[Issue 14476] core.thread unit tests failing on FreeBSD 9+
https://issues.dlang.org/show_bug.cgi?id=14476 --- Comment #5 from Martin Nowak c...@dawg.eu --- (In reply to Jonathan M Davis from comment #2) The second failure with Testing link_linkdep 2.067.0 comes with shared library support for FreeBSD, not sure why they fail on 9.1. The ugly runtime liker bug is fixed in both 8.4 and 9.1. http://svnweb.freebsd.org/base?view=revisionrevision=226155 --
Re: Degenerate Regex Case
On Saturday, 25 April 2015 at 09:30:55 UTC, Dmitry Olshansky wrote: A quick investigation shows that it gets stuck at the end of pattern compilation stage. The problem is that as a last pass D's regex goes to optimize the pattern to construct simple bit-scanning engine as approximation for prefix of original pattern. And that process is a lot like Thompson NFA ... _BUT_ the trick of merging equivalent threads wasn't applied there. So in short: file a bug, optimizer absolutely should do de-duplication of threads. --- Dmitry Olshansky Thanks for your help, I'll go file a bug.
[Issue 14504] New: Regex Optimizer doesn't merge equivalent threads.
https://issues.dlang.org/show_bug.cgi?id=14504 Issue ID: 14504 Summary: Regex Optimizer doesn't merge equivalent threads. Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: reaperunr...@gmail.com Given the following code: import std.stdio, std.regex; void main(string argv[]) { string m = argv[1]; auto p = ctRegex!(a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaa); if (match(m, p)) { writeln(match); } else { writeln(no match); } } Compile time becomes extremely long due to the regex optimizer not merging equivalent threads as explained in the forum post here: http://forum.dlang.org/post/gcxnuocczmdosombv...@forum.dlang.org --
[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition
https://issues.dlang.org/show_bug.cgi?id=13867 nick nicolas.jincher...@gmail.com changed: What|Removed |Added CC||nicolas.jincher...@gmail.co ||m --
Re: ARM Cortex-M Microcontroller startup files
On Sunday, 26 April 2015 at 15:55:34 UTC, Jens Bauer wrote: On Sunday, 26 April 2015 at 14:18:24 UTC, Dicebot wrote: On Sunday, 26 April 2015 at 07:04:06 UTC, Jens Bauer wrote: Some of you already know that I've been working on startup files for STM32F4xx and LPC17xx. https://github.com/jens-gpio/MCU Please mention that in wiki.dlang.org May be even worth creating dedicated ARM page there which will aggregated all related articles. Done. http://wiki.dlang.org/Microcontroller_startup_files -This is my first successful Wiki page, BTW. :) Thanks! It is important for that information not be lost among hundreds of NG posts, wiki is much more searchable.
Re: Microcontroller startup file - supported devices wish-list
On Sunday, 26 April 2015 at 01:08:03 UTC, Rikki Cattermole wrote: On 26/04/2015 5:53 a.m., Jens Bauer wrote: I'm planning on adding more STM32 devices. including Cortex-M0, Cortex-M0+ and Cortex-M3 devices ... Move this over to e.g. D's wiki (or Github repo's) and post a link into d.D news group. Preferably with links to each startup file in version control. This thread now continues here: http://forum.dlang.org/post/gzbsizvhpbridbjkm...@forum.dlang.org
Re: ARM Cortex-M Microcontroller startup files
On Sunday, 26 April 2015 at 07:04:06 UTC, Jens Bauer wrote: Some of you already know that I've been working on startup files for STM32F4xx and LPC17xx. Since a number of people have shown interest in these files, I've now merged those two repositories into one and improved it for adding more vendors. What I'd like you to do, is to tell me which microcontrollers you want support for. This means filing a feature request (eg. file an issue at GitHub telling me which device(s) you want added. If possible, please provide a URL to an existing library. I've filed a feature request myself as an example (these are already in the works, so no need to file any STM32F3 request.) The new repository: https://github.com/jens-gpio/MCU Example feature request: https://github.com/jens-gpio/MCU/issues/1 The old repositories STM32F4xx and LPC17xx are dead (the README has been updated to point to the MCU repository) Please mention that in wiki.dlang.org May be even worth creating dedicated ARM page there which will aggregated all related articles.
Re: ARM Cortex-M Microcontroller startup files
On Sunday, 26 April 2015 at 14:18:24 UTC, Dicebot wrote: On Sunday, 26 April 2015 at 07:04:06 UTC, Jens Bauer wrote: Some of you already know that I've been working on startup files for STM32F4xx and LPC17xx. https://github.com/jens-gpio/MCU Please mention that in wiki.dlang.org May be even worth creating dedicated ARM page there which will aggregated all related articles. Done. http://wiki.dlang.org/Microcontroller_startup_files -This is my first successful Wiki page, BTW. :)
[Issue 14476] core.thread unit tests failing on FreeBSD 9+
https://issues.dlang.org/show_bug.cgi?id=14476 --- Comment #3 from Jonathan M Davis issues.dl...@jmdavisprog.com --- It looks like this was the pull request that introduced the change: https://github.com/D-Programming-Language/druntime/pull/1109 --
[Issue 11674] core.stdc.fenv.fenv_t declaration not architecture aware
https://issues.dlang.org/show_bug.cgi?id=11674 Joakim db...@joakim.fea.st changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Joakim db...@joakim.fea.st --- It appears this has since been fixed: https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/fenv.d#L30 --
Re: array operations and ranges
On Sunday, 26 April 2015 at 10:17:59 UTC, Manu wrote: Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I can't help but feel like their incompatibility with the standard array operations is a massive loss. Let's say I want to assign one range to another: b[] = a[]; It's not clear to me why this should fall down if I want to apply a lazy operation for instance: b[] = a.map!(e=e*2)[]; ... or something to that effect. I find that my lazy ranges often end up on the stack, but I can't assign/initialise directly: float[] a = b.transform[]; Instead I need to: float[] a; b.transform.copy(a[]); The fact that they don't mix with array expressions or operators means as soon as a lazy range finds it wants to enter existing array code, it needs to be converted to a series of map()'s. There must be years of thoughts and work on this sort of thing? It seems arrays and ranges are unnecessarily distanced from eachother... what are the reasons for this? Vlad Levenfeld has been doing some interesting work on just this sort of thing. I will see if he is around.
Re: ReQL: pluses and minuses of pipeline-style queries
On Sunday, 26 April 2015 at 01:03:12 UTC, Rikki Cattermole wrote: I'm personally moving towards a DSL. unittest { auto myQuery = using webdev.base.orm.query.parser.defs # allow for D class name instead of table name ; # end of \sentence\ from MyModel where key == $0 as simple # as index # but only one can be defined, two in total internal ; # end of \sentence\ from MyModel where value contains $0 as complex # as index # but only one can be defined, two in total internal ; # end of \sentence\ .query; MyModel[] gotValues = myQuery.simple(test); gotValues = myQuery.perform(complex, another); } Pros: - Runtime reloadability - Runtime composability - More flexible Cons: - It's a string Can Pegged be usefully applied to implement this? Incidentally, it seems that although Hibernated is very nice, there is still work to be done. Eg I would like to insert 10 million rows, and it seems like a transaction would be the best way of doing so, but it's not yet supported. No big deal since the schema is very simple and I can do it by hand, but it would be nice to have at some point. (I looked at your own ORM, but keeping it in memory won't work for me).
Re: BigInt to binary
On Saturday, 25 April 2015 at 21:13:29 UTC, Ali Çehreli wrote: On 04/25/2015 01:23 PM, Dennis Ritchie wrote: which section should apply similar requests? https://issues.dlang.org/ After clicking File and Issue: Component: Phobos Severity: Enhancement Ali Thanks. I reported this: - https://issues.dlang.org/show_bug.cgi?id=14503
[Issue 14491] Deprecate overriding without override
https://issues.dlang.org/show_bug.cgi?id=14491 Iain Buclaw ibuc...@gdcproject.org changed: What|Removed |Added CC||ibuc...@gdcproject.org --- Comment #2 from Iain Buclaw ibuc...@gdcproject.org --- It's been in deprecation since 2.004 (I didn't realise it was /that/ long ago). Updating deprecated documentation as a start to reflect this: https://github.com/D-Programming-Language/dlang.org/pull/980 @yebblies, I'm happy with delaying removal until post DDMD switch-over. --
array operations and ranges
Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I can't help but feel like their incompatibility with the standard array operations is a massive loss. Let's say I want to assign one range to another: b[] = a[]; It's not clear to me why this should fall down if I want to apply a lazy operation for instance: b[] = a.map!(e=e*2)[]; ... or something to that effect. I find that my lazy ranges often end up on the stack, but I can't assign/initialise directly: float[] a = b.transform[]; Instead I need to: float[] a; b.transform.copy(a[]); The fact that they don't mix with array expressions or operators means as soon as a lazy range finds it wants to enter existing array code, it needs to be converted to a series of map()'s. There must be years of thoughts and work on this sort of thing? It seems arrays and ranges are unnecessarily distanced from eachother... what are the reasons for this?
[Issue 14490] Deprecate .sort and .reverse properties for arrays
https://issues.dlang.org/show_bug.cgi?id=14490 Iain Buclaw ibuc...@gdcproject.org changed: What|Removed |Added CC||ibuc...@gdcproject.org --- Comment #1 from Iain Buclaw ibuc...@gdcproject.org --- This became a warning in 2.067, raised PR to update documentation https://github.com/D-Programming-Language/dlang.org/pull/980 --
Re: ReQL: pluses and minuses of pipeline-style queries
On 27/04/2015 1:12 a.m., Idan Arye wrote: On Sunday, 26 April 2015 at 01:03:12 UTC, Rikki Cattermole wrote: I'm personally moving towards a DSL. unittest { auto myQuery = using webdev.base.orm.query.parser.defs # allow for D class name instead of table name ; # end of \sentence\ from MyModel where key == $0 as simple # as index # but only one can be defined, two in total internal ; # end of \sentence\ from MyModel where value contains $0 as complex # as index # but only one can be defined, two in total internal ; # end of \sentence\ .query; MyModel[] gotValues = myQuery.simple(test); gotValues = myQuery.perform(complex, another); } Pros: - Runtime reloadability - Runtime composability - More flexible Cons: - It's a string I get why people want to use a DSL based on the host language's constructs. The host language is built to deal with it's own constructs, so composing your queries from them allows you to easily do stuff like store query parts in variables, create functions that modify queries, use reflection on the queries, send variables and expressions from the host process directly to the query etc. What do you gain from a string-based DSL? It doesn't allow you to do any of these things - at least not any more conveniently/efficiently/safely than you could with SQL strings - so essentially it's just a language to replace SQL. Now, Some languages are so messed up that it's worthwhile to create a language the compiles to them(*cough* Javascript *cough*). SQL is not one of them. Even if we assume this language is better than SQL - is the difference enough to justify leanring this new language, to translate SQL errors caused by misuse of that langauge(or propagate and let the user deal with it), and deal with errors caused by bad implementation of the translation? Worse case scenario, you are free to use the raw sql function for a query. But it will only work if its for an SQL database engine. Also this won't compile to D.
[Issue 11520] [bionic] qsort is missing on linux/bionic
https://issues.dlang.org/show_bug.cgi?id=11520 Joakim db...@joakim.fea.st changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --
Re: AA Performance in Benchmarks
Laeeth Isharc wrote in message news:hnihyhgtmdzhszkpn...@forum.dlang.org... At a slight tangent: is there a way to reserve capacity for an associative array? The obvious way does not seem to work. No. I noticed also in a talk at nativecode (possibly by Herb Sutter) that C++ gives you the ability to tune almost any parameter of the associative array implementation in the standard library. (I'm not a C++ guy). Is this entirely spurious, or would it be helpful for D? Yes, if we had an AA in phobos.
[Issue 14503] New: BigInt to binary/octal and lower case %x (hexadecimal format)
https://issues.dlang.org/show_bug.cgi?id=14503 Issue ID: 14503 Summary: BigInt to binary/octal and lower case %x (hexadecimal format) Product: D Version: future Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nob...@puremagic.com Reporter: dennis.m.ritc...@mail.ru I believe that we need to add new format specifiers for the data type BigInt also need to fix the uppercase letters to lowercase hexadecimal specifier %x: - import std.bigint : BigInt; import std.string : format; import std.stdio : writeln, writefln; void main() { BigInt n = 15; string s = format(%x, n); // does not work properly writeln(s); writefln(%x, n); // prints F is a bug // and to print a lower case /*string t = format(%b, n); // Format specifier not understood: %b writeln(t); // does not work writefln(%b, t); // does not work */ /*string test = format(%o, n); // Format specifier not understood: %o writeln(test); // does not work writefln(%o, test); // does not work */ } --
Re: Cleaned up C++
On Sunday, 26 April 2015 at 09:26:11 UTC, ponce wrote: On Wednesday, 22 April 2015 at 19:51:23 UTC, ponce wrote: I should put in in a d-idioms anyway. http://p0nce.github.io/d-idioms/#How-does-D-improve-on-C++17? excellent. I linked it here: http://wiki.dlang.org/Coming_From
Re: ReQL: pluses and minuses of pipeline-style queries
On 27/04/2015 12:10 a.m., Laeeth Isharc wrote: On Sunday, 26 April 2015 at 01:03:12 UTC, Rikki Cattermole wrote: I'm personally moving towards a DSL. unittest { auto myQuery = using webdev.base.orm.query.parser.defs # allow for D class name instead of table name ; # end of \sentence\ from MyModel where key == $0 as simple # as index # but only one can be defined, two in total internal ; # end of \sentence\ from MyModel where value contains $0 as complex # as index # but only one can be defined, two in total internal ; # end of \sentence\ .query; MyModel[] gotValues = myQuery.simple(test); gotValues = myQuery.perform(complex, another); } Pros: - Runtime reloadability - Runtime composability - More flexible Cons: - It's a string Can Pegged be usefully applied to implement this? Incidentally, it seems that although Hibernated is very nice, there is still work to be done. Eg I would like to insert 10 million rows, and it seems like a transaction would be the best way of doing so, but it's not yet supported. No big deal since the schema is very simple and I can do it by hand, but it would be nice to have at some point. (I looked at your own ORM, but keeping it in memory won't work for me). Dvorm like Cmsed is going bye byes. My next web service framework is going to have a very different approach to ORM's and routing! The given code example, is an actual unittest for the parser. It'll be using a reflection API to wrap ORM models up. So the ORM will no longer do serialization. Instead the backend will to the appropriate types. Just so you get a small taste of the reflection capabilities. I know it may not seem like much, but imagine e.g. lua to have wrapper code around this and to act as if the data models were written natively in it or to pass a template (lets say lua based) a bunch of data models and have it call D methods on it! The only problem is that the web server that it is meant to compliment isn't ready yet. https://github.com/DNetDev/webserver Until I or somebody else gets round to implementing this https://github.com/rejectedsoftware/vibe.d/issues/1074 mindset wise, I can't continue on. Also you are welcome to join https://gitter.im/DNetDev/Public if you want to talk more. module webdev.base.reflection.model; import webdev.base.traits.are : isADataModel, isADataModelProperty, isDataModelMemberId, isADataModelQueryMethod, isADataModelQueryStaticMethod; import webdev.base.traits.have : getDataModelName, getDataModelDescription, getDataModelPropertyDescription, getDataModelPropertyHints, getDataModelPropertyName; import webdev.base.udas : OrmPropertyTypes; private __gshared { import std.variant : Algebraic; import std.traits : fullyQualifiedName, isArray, ReturnType, ParameterTypeTuple; AReflectedModel*[string] models; AReflectedModel*[string] modelsByTableName; } /* * Basic interactions of the different kinds of models */ /** * Gets all names of data models registered * Uses the fully qualified name (package + module + class/struct name) * * Returns: * The names to all data models */ string[] reflectedModelNames() { return models.keys; } /** * Lazily registers and gets a reflected model given the data model type * * Returns: * The reflected model */ AReflectedModel* getReflectModel(T)() if(isADataModel!T) { return getReflectedModel(fullyQualifiedName!T); } /** * Gets a reflected model based upon its fully qualified name * * Params: * name= Name of the model * * Returns: * The reflected model */ AReflectedModel* getReflectedModel(string name) { if (name !in models) return null; return models[name].dup(); } /** * Gets a reflected model based upon its table name * * Params: * name= Name of the model * * Returns: * The reflected model */ AReflectedModel* getReflectedModelByTableName(string name) { if (name !in modelsByTableName) return null; return modelsByTableName[name].dup(); } /* * General reflection based types */ /// enum OrmActualPropertyTypes { Unknown, UByte, Byte, UShort, Short, UInt, Int, ULong, Long, Float, Double, String, WString, DString, Array, DataModel } /// alias ModelValidTypes = Algebraic!(AReflectedModelInstance*, ubyte, byte, ushort, short, uint, int, ulong, long, float, double, string, wstring, dstring); /// struct PropertyHint { /// string name; /// OrmActualPropertyTypes actualType; /// OrmActualPropertyTypes arrayActualType; /// AReflectedModel* objectActualType; /// OrmPropertyTypes hintType; /// size_t size; /// string description; /// bool
Re: array operations and ranges
Naturally, where I wrote: float[] a = b.transform[]; I meant: float[N] a = b.transform[]; // -- on the stack On 26 April 2015 at 20:17, Manu turkey...@gmail.com wrote: Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I can't help but feel like their incompatibility with the standard array operations is a massive loss. Let's say I want to assign one range to another: b[] = a[]; It's not clear to me why this should fall down if I want to apply a lazy operation for instance: b[] = a.map!(e=e*2)[]; ... or something to that effect. I find that my lazy ranges often end up on the stack, but I can't assign/initialise directly: float[] a = b.transform[]; Instead I need to: float[] a; b.transform.copy(a[]); The fact that they don't mix with array expressions or operators means as soon as a lazy range finds it wants to enter existing array code, it needs to be converted to a series of map()'s. There must be years of thoughts and work on this sort of thing? It seems arrays and ranges are unnecessarily distanced from eachother... what are the reasons for this?
Re: [OT] compiler optimisations
On Saturday, 25 April 2015 at 22:05:05 UTC, Ola Fosheim Grøstad wrote: On Saturday, 25 April 2015 at 14:48:41 UTC, Laeeth Isharc wrote: I find it worrying that the evangelical D users are perceiving D as a compiled scripting language and claim it is similar to Python... D semantics are not at all like Python. That can't win. Why does it worry you? What bad things will happen? Bad things that could happen is that D never can be like Python and if you try to make it such you no longer have a system programming contender. So because some people have found it useful in that domain and have shared their positive feelings, there is a risk that this hijacks the direction of the language away from what would ultimately be to its greatest benefit (and perhaps to yours, anyway)? Nobody goes there anymore - that place is too popular. Conceivable, but you can hardly control what people do with and say about their use of a programming language, even of a closed source commercial product. I guess one can submit pull requests that take the language in the direction one favours though, and maybe you do this. questions, but I think your argument would be more effective if you explained why shipping vibe.d somehow detracts from D's Because it shifts the focus towards an application area where D will have trouble to gain significant ground. That means the language will be evaluated up to that application area. There is a limit in the market as new projects will gravitate towards the most promising language in their application area. And there are many languages pitching in the web domain. It's very hard to know what people ultimately end up doing with a tool that you bring into the world, and one may be the master of computer science and language design and still be surprised by what takes off. The world is a big place and changing rapidly. If one has a set idea about what something should and shouldn't do, one may find oneself eventually overcome by Nature, who is more powerful - I have given up trying to fight her. Which essentially is escapism from a language development point of view. Languages are not judged by their libraries, unless they lack functionality due to flaws in language semantics. It depends on who is doing the judging, and what they are trying to do. The decision by a commercial user to adopt a language framework surely does depend on the cost of accomplishing her goals using that framework, and this surely depends for many domains on the implementations and libraries available. It's a funny thing I notice people do to pretend that decisions about language adoption are based on the merits of the pure language itself, when only for a subset (I suspect a minority) is that truly the case. [I am not sure if it is escapism to listen to your market and do what you need to to address the biggest concerns]. This is different in a scripting language which often is used in contexts where you cannot predict your needs ahead of time. I.e. you are prototyping and are exploring new directions or are just covering your needs day by day. If you are doing that in a long running predictable project you are in a bad shape (aka fire fighting). Fair point, although I suspect this is a feature of the domain not the language. One might write a bond analytics framework in C++, but that doesn't mean one knows how it ultimately is going to be used. The world is a big place, and one doesn't necessarily understand the needs of others. Of course it is frustrating if the world charges ahead in a direction that one doesn't find interesting, but submitting code probably has more influence than telling people they shouldn't do this. This whole scripting vs system language thing suffers from reification of a distinction that once mapped to something crisp in reality, but no longer does. AHL (one of the largest systematic fund managers) have all their trading systems in Python, for example, so the connotations of lack of robustness and difficulty of building large and complex systems that perhaps were once associated with the idea of a scripting language perhaps apply less today. (Which isn't to say that you will get me to love dynamic typing for serious work). Is Go a scripting language or a systems language? On the one hand, the D front page no longer positions D as a systems language (which I think is the right move); on the other, people are using it for low-level stuff. So why get hung up on labels: technology is a tool for solving problems, and the question is how well adapted a particular tool is to the particular problems one faces (and how easily it can get there with a bit of work). Adam is a great guy, but he is probably more patient than most with figuring out workarounds ;-). Yes - which is why he (and his unique kind of way of being in the world) is so valuable. Someone needs to break the ground, and by doing so
[Issue 14476] core.thread unit tests failing on FreeBSD 9+
https://issues.dlang.org/show_bug.cgi?id=14476 --- Comment #2 from Jonathan M Davis issues.dl...@jmdavisprog.com --- It looks like it's this commit in druntime which broke things: commit 5c96aca53bf63a9abc58fd45b59156e605c5fa3a Author: Martin Nowak c...@dawg.eu Date: Tue Jan 20 08:56:25 2015 +0100 round thread stack size to pagesize and min stack size The second failure with Testing link_linkdep is there before that commit, but that's the commit that introduces the failure in core.thread. --
Re: ReQL: pluses and minuses of pipeline-style queries
On Sunday, 26 April 2015 at 01:03:12 UTC, Rikki Cattermole wrote: I'm personally moving towards a DSL. unittest { auto myQuery = using webdev.base.orm.query.parser.defs # allow for D class name instead of table name ; # end of \sentence\ from MyModel where key == $0 as simple # as index # but only one can be defined, two in total internal ; # end of \sentence\ from MyModel where value contains $0 as complex # as index # but only one can be defined, two in total internal ; # end of \sentence\ .query; MyModel[] gotValues = myQuery.simple(test); gotValues = myQuery.perform(complex, another); } Pros: - Runtime reloadability - Runtime composability - More flexible Cons: - It's a string I get why people want to use a DSL based on the host language's constructs. The host language is built to deal with it's own constructs, so composing your queries from them allows you to easily do stuff like store query parts in variables, create functions that modify queries, use reflection on the queries, send variables and expressions from the host process directly to the query etc. What do you gain from a string-based DSL? It doesn't allow you to do any of these things - at least not any more conveniently/efficiently/safely than you could with SQL strings - so essentially it's just a language to replace SQL. Now, Some languages are so messed up that it's worthwhile to create a language the compiles to them(*cough* Javascript *cough*). SQL is not one of them. Even if we assume this language is better than SQL - is the difference enough to justify leanring this new language, to translate SQL errors caused by misuse of that langauge(or propagate and let the user deal with it), and deal with errors caused by bad implementation of the translation?
Re: ReQL: pluses and minuses of pipeline-style queries
On Saturday, 25 April 2015 at 05:16:21 UTC, Andrei Alexandrescu wrote: Found this on reddit a few days ago: http://rob.conery.io/2015/04/17/rethinkdb-2-0-is-amazing/ A good discussion of the pros and cons of pipeline-style queries (the ReQL query language reminiscent of D's algorithms/ranges) vs. classic SQL. Andrei I think his example of composability is targeting the exact examples where ReQL is composable and SQL isn't. It's easy enough to create an opposite example: let's say that our initial query is this: select vendor.name from vendor inner join catalog on vendor.id = catalog.vendor_id inner join details on details.catalog_id = catalog.id r.db(music).table(catalog).map(function(album){ return { artist : album(vendor)(name) } }) If we want to add the `type_id = 2` filter, in SQL it's a matter of appending a line: select vendor.name from vendor inner join catalog on vendor.id = catalog.vendor_id inner join details on details.catalog_id = catalog.id where details.media_type_id = 2; But in ReQL you'd have to insert the filter in the middle: r.db(music).table(catalog).filter(function(album){ return album(details).filter(function(track){ return track(media_type_id).eq(2) }) }).map(function(album){ return { artist : album(vendor)(name) } }) So, composablity seems to be just a matter of where the part you want to add happens to be placed in the query's structure... At this point one might claim that in the SQL case we had to modify a string while in the ReQL case we could simply use methods of the existing query object - but that's because the ReQL query is wrapped for us(the actual format sent to the server is not the one written in the source code) while the SQL isn't(OK, that's a lie - the SQL query is compiled to some more efficient format. But that happens in the driver/server, so the bindings don't have to do it). In reality SQL is also wrapped, either by entirely new languages(ORMs like Hibernate) or by query builders that let you use SQL almost directly, and simply make it more convenient(I had good experience with PetaPoco(http://www.toptensoftware.com/petapoco/), for example). If you use these wrappers you get the same composability as ReQL(modify query by invoking methods of existing query objects).
[Issue 14490] Deprecate .sort and .reverse properties for arrays
https://issues.dlang.org/show_bug.cgi?id=14490 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #2 from bearophile_h...@eml.cc --- Is Phobos reverse returning the array? If this is not true, then I think you can't remove the built-in reverse yet. --
Porting Page on Wiki needs work
http://wiki.dlang.org/PortingOverview Page was linked to but non-existent. I put a couple of links to p0nce, and will try to fill it out a bit over time but perhaps others could share their expertise. Thanks. Laeeth.
Re: [hackathlon] stdc ddoc needed ?
On 4/26/2015 2:23 PM, Baz wrote: By the way, the stdc ddoc headers include some invalid addresses, e.g: pubs.opengroup.org/onlinepubs/009695399/basedefs/_ctype.h.html while it seems to be now: pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h Please do a PR to fix those!
Re: D 2.067.1
Side note : when updating Arch package to 2.067.1 I decided to add `-L-lcurl` option to default `dmd.conf` in context of recent discussion on topic. Please report if that causes any issues with link order bugs - I couldn't trigger any but there are wild talse running around that those exist ;)
Re: [OT] compiler optimisations
On Sunday, 26 April 2015 at 22:41:22 UTC, Ola Fosheim Grøstad wrote: Oh well, I don't think these debates have any effect on that. People probably have an ability to set their own priorities whether it is family or hackatons. I think it's worth respecting Andrei's wishes for the week, we can resume arguing over D in May. : )
Re: [OT] Nim is usable with PNaCl
On 04/26/2015 01:37 AM, weaselcat wrote: https://github.com/hackwaly/pepper-nim Wonder how hard it would be to get D to do the same, or if it's worth the effort over trying to adapt LDC output to emscripten. Manu was looking into this a little while a go. https://github.com/ldc-developers/ldc/issues/800 https://github.com/ldc-developers/ldc/issues/826 -- Paul O'Neil Github / IRC: todayman
[Issue 14507] New: Installer doesn't configure VS2010 properly; missing mspdb100.dll
https://issues.dlang.org/show_bug.cgi?id=14507 Issue ID: 14507 Summary: Installer doesn't configure VS2010 properly; missing mspdb100.dll Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: turkey...@gmail.com This seems to be back again. Fresh install of 2.067.1, compiling for Win64, linker complains: The program can't start because mspdb100.dll is missing from your computer. My computer has VS2010, VS2012, and VS2013 on it. I am using VS2010. I think one problem is that Visual-D needs to ignore sc.ini when operating within each respective version of VS, and give the proper paths for the environment explicitly. Or maybe that *is* the problem, and this should be escalated to Rainer? --
Re: [OT] compiler optimisations
On Sunday, 26 April 2015 at 11:33:07 UTC, Laeeth Isharc wrote: Conceivable, but you can hardly control what people do with and say about their use of a programming language, even of a closed source commercial product. I guess one can submit pull requests that take the language in the direction one favours though, and maybe you do this. You are downplaying the underlying issue. When you design a language you have layers that build upon each other. The memory model is a foundational design layer (not implementation) that affects all layers above it. It's not a patchable entity. by what takes off. The world is a big place and changing rapidly. If one has a set idea about what something should and shouldn't do, one may find oneself eventually overcome by Nature, who is more powerful - I have given up trying to fight her. That would take a paradigm shift. Which could happen, but not any time soon. (e.g. program synthesis). D/C++/Java are all built on Simula's model. Nothing surprisingly new. And no, the uptake of programming languages over the past 30 years have not been full of surprises... It's been surprisingly predictable. Installed base and critical mass across the board. available. It's a funny thing I notice people do to pretend that decisions about language adoption are based on the merits of the pure language itself, when only for a subset (I suspect a minority) is that truly the case. As usual in these technological social dynamics you have: 1. early adopters 2. hubs (people/artifacts that connect to lots of new nodes in the network) 3. mainstream adoption (commercial project management) At first you need the early adopters. Like independent game devs/enthusiast that pave the road by building attractive infrastructure, like state of the art frameworks. Then the frameworks/people (if they are good) will connect to the more pragmatic audience. But that means you need excellent programmers/designers in the first place, and that means you need something that excellent programmers/designers find attractive. If Rust overcomes the complexity of linear typing, then they are in a good spot (in terms of social dynamics), but that's a big if. The mainstream will go with what is perceived as low risk/reduced costs. And that takes a lot more than a downloadable compiler or three. [I am not sure if it is escapism to listen to your market and do what you need to to address the biggest concerns]. You mean like fixing the language so that you can either have a fast GC, efficient ownership handling or both? Surely you need at least one? necessarily understand the needs of others. Of course it is frustrating if the world charges ahead in a direction that one doesn't find interesting, but submitting code probably has more influence than telling people they shouldn't do this. Nope. As long as there are intelligent people involved informing is always the most efficient strategy, since you need people to pull in the same direction. If not, then forking is the only solution. Submitting code has very low effect when the key issues are design issues or knowledge related. You now have @nogc and a modest effort on improving the GC. That came about as an outcome of persistent debate. Without persistent debate, nothing would have come in that direction. This whole scripting vs system language thing suffers from reification of a distinction that once mapped to something crisp in reality, but no longer does. Uhm... This is completely wrong. It's like conflating perl and Ada. Is Go a scripting language or a systems language? It is an application level programming language geared towards servers using a particular implementation strategy (CSP/GC). Go is a very opinionated language. On the one hand, the D front page no longer positions D as a systems language (which I think is the right move); on the other, people are using it for low-level stuff. Andrei and Walter both keep calling it a system level programming language. Walter repeatedly states that even 1% performance loss is a big issue for him. So obviously they will need to focus on backing that up, or make a statement that there is a shift in direction. Adam's technical contribution is large in itself, but the effect of his inspiration on others may well be larger. Probably, but workaround makes for unmaintainable code. Tricks are cute, but you should avoid using tricks in production. Have you written anything on what this should look like? Could, not should. Read up on linear typing and you see what the perimeter looks like. Read up on C++ and you know what current practice looks like. Read up on dependent and behavioural typing and you may catch a glimpse of the horizon. As far as I am concerned, C99/C++ semantics are good enough as a common ground (if made orthogonal). The main issues C++ struggles with are syntactical/textual. That doesn't mean you
Re: ARM Cortex-M Microcontroller startup files
On Sunday, 26 April 2015 at 18:23:47 UTC, Martin Nowak wrote: The wiki says to disable multilib (http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler#Build_GCC), what's the problem? Maybe ask Iain/Johannes if it's GDC specific. When I first started working with GDC, I had a hell of a time getting the cross-compiler to build. I disabled multilib simply to remove a variable. Since I was able to eventually get what I needed with that configuration, I left it as is. In summary, the choice to disable multilib was rather arbitrary. I'm not currently working on this, and I don't have the hardware to properly test it. Timo also asked about this a while ago, but it didn't elicit much discussion (http://forum.dlang.org/post/uwkshliqwbmmxdfiu...@forum.dlang.org). I'm not knowledgable enough about it, so I wasn't able to offer any help. Mike
[Issue 14507] Installer doesn't configure VS2010 properly; missing mspdb100.dll
https://issues.dlang.org/show_bug.cgi?id=14507 Vladimir Panteleev thecybersha...@gmail.com changed: What|Removed |Added CC||thecybersha...@gmail.com Component|DMD |installer --
Re: [hackathlon] stdc ddoc needed ?
On Sunday, 26 April 2015 at 21:23:24 UTC, Baz wrote: pubs.opengroup.org/onlinepubs/009695399/basedefs/_ctype.h.html while it seems to be now: pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h i was wrong. new links are for the specifications issue 7 but core.stdc API is well compliant with specifications version 6. Actually stdc does not match version 7. So no problems with links.
[Issue 14504] Regex Optimizer doesn't merge equivalent threads.
https://issues.dlang.org/show_bug.cgi?id=14504 Dmitry Olshansky dmitry.o...@gmail.com changed: What|Removed |Added CC||dmitry.o...@gmail.com Assignee|nob...@puremagic.com|dmitry.o...@gmail.com --
Re: Is this a bug in return type inference?
On 04/26/2015 12:32 PM, Meta wrote: import std.random; auto test(int n) { if (n = 0 n 33) { return int(0); } else if (n = 33 n 66) { return float(0); } else { return real(0); } } void main() { auto n = uniform(0, 100); auto res = test(n); //Prints float pragma(msg, typeof(res)); } I expected the result to be real. Why is the return type of test inferred as float instead? I would expect it to choose real, as both int and float can be converted to real without precision loss, but the opposite is not true. Is this a bug? Yes, a bug for floating types only. It seems that not the common type but the first type is used among floating point types. I wrote a short program to prove it to myself: import std.traits; import std.typetuple; import std.format; auto foo(A, B)(int n) { if (n) { return A(0); } else { return B(0); } } void main() { alias types = TypeTuple!(float, double, real); foreach (A; types) { foreach (B; types) { alias ReturnType = typeof(foo!(A, B)(0)); pragma(msg, format(%s %s - %s%s, A.stringof, B.stringof, ReturnType.stringof, (is (ReturnType == CommonType!(A, B)) ? : -- BUG))); } } } float float - float float double - float -- BUG float real - float -- BUG double float - double double double - double double real - double -- BUG real float - real real double - real real real - real Ali
[Issue 14505] File doesn't rewind read pointer for a+ mode on Windows DMC
https://issues.dlang.org/show_bug.cgi?id=14505 Martin Nowak c...@dawg.eu changed: What|Removed |Added Hardware|All |x86 Summary|File doesn't rewind read|File doesn't rewind read |pointer for a+ mode on |pointer for a+ mode on |Windows |Windows DMC --- Comment #3 from Martin Nowak c...@dawg.eu --- Correction, this is only a DMC problem, works fine with MSVC. --
Re: [OT] compiler optimisations
On Sunday, 26 April 2015 at 15:40:11 UTC, Andrei Alexandrescu wrote: On 4/26/15 4:33 AM, Laeeth Isharc wrote: I'll leave it there as per Andrei's request about focusing on the hackathon. Thanks! -- Andrei thanks for what? need statistics that you make? well i download and try, play --- and don't use. your statics are worth NOTHING. please clean up the language - d1 style and make it stable.
[Issue 14506] New: Wrong floating point type inferred for function with auto return type
https://issues.dlang.org/show_bug.cgi?id=14506 Issue ID: 14506 Summary: Wrong floating point type inferred for function with auto return type Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: monkeywork...@hotmail.com import std.random; auto test(int n) { if (n = 0 n 33) { return int(0); } else if (n = 33 n 66) { return float(0); } else { return real(0); } } void main() { auto n = uniform(0, 100); auto res = test(n); //typeof(res) should be inferred as real assert(is(typeof(res) == float)); } Another example from Ali Çehreli: import std.traits; import std.typetuple; import std.format; auto foo(A, B)(int n) { if (n) { return A(0); } else { return B(0); } } void main() { alias types = TypeTuple!(float, double, real); foreach (A; types) { foreach (B; types) { alias ReturnType = typeof(foo!(A, B)(0)); pragma(msg, format(%s %s - %s%s, A.stringof, B.stringof, ReturnType.stringof, (is (ReturnType == CommonType!(A, B)) ? : -- BUG))); } } } Output: float float - float float double - float -- BUG float real - float -- BUG double float - double double double - double double real - double -- BUG real float - real real double - real real real - real --
Re: [hackathlon] stdc ddoc needed ?
On Sunday, 26 April 2015 at 20:45:32 UTC, Walter Bright wrote: On 4/26/2015 11:38 AM, Baz wrote: Hi, is it worth documenting stdc ? No. In general, D should not be re-documenting APIs where the documentation exists elsewhere, because: 1. have to rewrite it because of copyright 2. such rewrites introduce errors and ambiguities 3. documentation always gets out of date 4. a user would be foolish to use re-documentation rather than the official documentation 5. our time is much better expended on more productive things. I'm about to copy all the docs from offical sources, e.g http://www.cplusplus.com/reference/cctype/. There's been a post from W.B a few weeks ago about undocumented sources. I don't remember if it included stdc. It doesn't include API interfaces. Thanks for asking before doing the work. I'd sure hate for you to expend a lot of effort on this only to have it rejected. We can't afford to waste effort like that. Well, i should have waited because i've started and now i realize it wouldn't be human to do that in one shot anyway. By the way, the stdc ddoc headers include some invalid addresses, e.g: pubs.opengroup.org/onlinepubs/009695399/basedefs/_ctype.h.html while it seems to be now: pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h
Re: SDC needs you -- redux
I'd like to contribute to SDC too, but... the current build system (Makefile) keeps me from working on it: I mostly work on Windows, and I do not want to use MinGW/MSYS/Cygwin for this. CMake would be a much nicer buildsystem for me. Are you interested in switching to CMakeFile ? (I am hoping someone else will do this, but I may give it a try to see if I can get it to work...)
Re: ARM Cortex-M Microcontroller startup files
On Sunday, 26 April 2015 at 18:23:47 UTC, Martin Nowak wrote: On 04/26/2015 07:29 PM, Jens Bauer wrote: Unfortunately, I have not been able to build with multilib yet, so my setup cannot build code for Cortex-M0; it keeps stuffing Cortex-M3 and Cortex-M4 instructions in there. The wiki says to disable multilib (http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler#Build_GCC), what's the problem? The problem is that I cannot have a single compiler, which compiles for these architectures: ARM7TDMI Cortex-M0 Cortex-M3 Cortex-M4 Using a Cortex-M3 or Cortex-M4 compiler to build code for a Cortex-M0, will insert 32-bit instructions randomly (most code is 16-bit, though, so parts of it gets it right). As soon as the microcontroller tries to run a 32-bit instruction, it will crash. -In order to build code for Cortex-M0 or Cortex-M0+, I will have to rebuild the compiler. The alternative is to build 5 different compilers. I don't want that either. ... The reason I cannot build GDC with multilib, is that I get a compile-error when building the final GCC+GDC. Building GCC alone without GDC gives me no such error. -So if I want to have multilib support, I will have to be without GDC.
Re: setjmp / longjmp
On 26/04/2015 06:56, ketmar wrote: snip you shouldn't use setjmp/longjmp in D. use exceptions instead. something like this: snip True in the general case. Still, there must be some reason that trying it in D causes an AV (even if I disable the GC). I remain curious about what that reason is. Some time ago, just for fun, I wrote an Unlambda to D compiler. Except that I couldn't get the c builtin to work properly. Exceptions cover typical uses cases, but a subtlety of it is that (roughly speaking) the continuation it emits can escape from the function it is passed into, and then when the continuation is later invoked it should return the program to the point at which c was invoked. Essentially, it can wind the stack as well as unwinding it. I envisaged that, maybe with the aid of setjmp and some trick to get GC to work with it, it could be made to work. Stewart. -- My email address is valid but not my primary mailbox and not checked regularly. Please keep replies on the 'group where everybody may benefit.
Re: [hackathlon] stdc ddoc needed ?
On 4/26/2015 11:38 AM, Baz wrote: Hi, is it worth documenting stdc ? No. In general, D should not be re-documenting APIs where the documentation exists elsewhere, because: 1. have to rewrite it because of copyright 2. such rewrites introduce errors and ambiguities 3. documentation always gets out of date 4. a user would be foolish to use re-documentation rather than the official documentation 5. our time is much better expended on more productive things. I'm about to copy all the docs from offical sources, e.g http://www.cplusplus.com/reference/cctype/. There's been a post from W.B a few weeks ago about undocumented sources. I don't remember if it included stdc. It doesn't include API interfaces. Thanks for asking before doing the work. I'd sure hate for you to expend a lot of effort on this only to have it rejected. We can't afford to waste effort like that.
Re: Is this a bug in return type inference?
On Sunday, 26 April 2015 at 20:21:32 UTC, Ali Çehreli wrote: Yes, a bug for floating types only. It seems that not the common type but the first type is used among floating point types. I wrote a short program to prove it to myself: import std.traits; import std.typetuple; import std.format; auto foo(A, B)(int n) { if (n) { return A(0); } else { return B(0); } } void main() { alias types = TypeTuple!(float, double, real); foreach (A; types) { foreach (B; types) { alias ReturnType = typeof(foo!(A, B)(0)); pragma(msg, format(%s %s - %s%s, A.stringof, B.stringof, ReturnType.stringof, (is (ReturnType == CommonType!(A, B)) ? : -- BUG))); } } } float float - float float double - float -- BUG float real - float -- BUG double float - double double double - double double real - double -- BUG real float - real real double - real real real - real Ali https://issues.dlang.org/show_bug.cgi?id=14506
[Issue 14470] Reuse of object memory: new emplace overload
https://issues.dlang.org/show_bug.cgi?id=14470 --- Comment #1 from rswhi...@gmail.com --- Related Thread: http://forum.dlang.org/thread/pllencnccodsfydjj...@forum.dlang.org --
[Issue 8973] core.cpuid.coresPerCPU returning incorrect value.
https://issues.dlang.org/show_bug.cgi?id=8973 Temtaime temta...@gmail.com changed: What|Removed |Added CC||temta...@gmail.com --- Comment #2 from Temtaime temta...@gmail.com --- Confirmed, returning 16 for me(fx 8350). --
Re: std.json questions
On Saturday, 25 April 2015 at 18:30:33 UTC, Baz wrote: On Saturday, 25 April 2015 at 09:56:25 UTC, tired_eyes wrote: I think this is ugly and clunky approach, what is the beautiful one? What you clearly need is a serializer: look at these: http://wiki.dlang.org/Libraries_and_Frameworks#Serialization and also: https://github.com/search?utf8=✓q=serializer+language%3ADtype=Repositoriesref=searchresults some of them might have an API to save load an object or a struct in a single call. too bad D:YAML links are broken, do you know where to find that project ?
Re: ARM Cortex-M Microcontroller startup files
On Sunday, 26 April 2015 at 16:09:57 UTC, Martin Nowak wrote: On 04/26/2015 05:55 PM, Jens Bauer wrote: Done. http://wiki.dlang.org/Microcontroller_startup_files -This is my first successful Wiki page, BTW. :) Nice, minilibd seems to be maintained as well, you happen to know the author? I haven't met Timo (yet), I live in Denmark, and as far as I understand, Timo is from Finland. -But we communicate here. I'd really like to see binary releases of GDC for arm-none-eabi that ship with a patched compiler (iff necessary) and minilibd. So far, building GCC-4.9.2+GDC-4.9 works for me. I haven't done any 'deep' coding yet, but I do some tests almost every day. I may be able to put together some kind of recipe for building the GCC+GDC I have. Unfortunately, I have not been able to build with multilib yet, so my setup cannot build code for Cortex-M0; it keeps stuffing Cortex-M3 and Cortex-M4 instructions in there. -But if I build GCC without GDC, then I can build with multilib, and make code for Cortex-M0. So I cannot have both. I know Mike have been working on this. Hopefully one of us will find a solution.
[hackathlon] stdc ddoc needed ?
Hi, is it worth documenting stdc ? I'm about to copy all the docs from offical sources, e.g http://www.cplusplus.com/reference/cctype/. There's been a post from W.B a few weeks ago about undocumented sources. I don't remember if it included stdc.
Re: std.json questions
On Sunday, 26 April 2015 at 17:14:22 UTC, extrawurst wrote: On Saturday, 25 April 2015 at 18:30:33 UTC, Baz wrote: On Saturday, 25 April 2015 at 09:56:25 UTC, tired_eyes wrote: I think this is ugly and clunky approach, what is the beautiful one? What you clearly need is a serializer: look at these: http://wiki.dlang.org/Libraries_and_Frameworks#Serialization and also: https://github.com/search?utf8=✓q=serializer+language%3ADtype=Repositoriesref=searchresults some of them might have an API to save load an object or a struct in a single call. too bad D:YAML links are broken, do you know where to find that project ? https://github.com/kiith-sa/D-YAML
Re: array operations and ranges
On Sunday, 26 April 2015 at 10:17:59 UTC, Manu wrote: I find that my lazy ranges often end up on the stack, but I can't assign/initialise directly: float[] a = b.transform[]; Instead I need to: float[] a; b.transform.copy(a[]); To enable the first line, builtin arrays would need to be able to recognize arbitrary range types and do the right thing. You can always do this: float[] a = b[].transform.array; I've got a lib to enable this syntax: Array!float a = b[].transform_1; a[i..j] = c[x..y].transform_2; for arbitrary user-defined or composed n-dimensional range types. here: https://github.com/evenex/autodata where ranges are made more interoperable by common mixin templates which also cut down on a lot of boilerplate. (see examples in: https://github.com/evenex/autodata/tree/master/source/spaces)
Is this a bug in return type inference?
import std.random; auto test(int n) { if (n = 0 n 33) { return int(0); } else if (n = 33 n 66) { return float(0); } else { return real(0); } } void main() { auto n = uniform(0, 100); auto res = test(n); //Prints float pragma(msg, typeof(res)); } I expected the result to be real. Why is the return type of test inferred as float instead? I would expect it to choose real, as both int and float can be converted to real without precision loss, but the opposite is not true. Is this a bug?
[Issue 14503] BigInt to binary/octal and lower case %x (hexadecimal format)
https://issues.dlang.org/show_bug.cgi?id=14503 Ivan Kazmenko ga...@mail.ru changed: What|Removed |Added CC||ga...@mail.ru --
Re: ARM Cortex-M Microcontroller startup files
On 04/26/2015 07:29 PM, Jens Bauer wrote: I may be able to put together some kind of recipe for building the GCC+GDC I have. Unfortunately, I have not been able to build with multilib yet, so my setup cannot build code for Cortex-M0; it keeps stuffing Cortex-M3 and Cortex-M4 instructions in there. The wiki says to disable multilib (http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler#Build_GCC), what's the problem? Maybe ask Iain/Johannes if it's GDC specific. -But if I build GCC without GDC, then I can build with multilib, and make code for Cortex-M0. So I cannot have both. I know Mike have been working on this. Hopefully one of us will find a solution. What libc are you using? The gcc-arm-embedded project uses newlib and newlib-nano. https://launchpad.net/gcc-arm-embedded
Re: D needs emplacement new
Since I'm unable to rebuild phobos on my Windows 8.1 PC, would someone else be interested, to apply a PR? The code (including comment) would be this: /** Given an existing object $(D obj), reinitialize the object of $(D class) type $(D T) at that address. The constructor is passed the arguments $(D Args), if any. Returns: The reinitialized object */ T emplace(T, Args...)(ref T obj, auto ref Args args) if (is(T == class)) { enforce!ConvException(obj !is null, emplace: Object is null and cannot be reinitialized); enum classSize = __traits(classInstanceSize, T); void[] buf = (cast(void*) obj)[0 .. classSize]; return emplace!T(buf, args); } Unfortunately, I do not have much time to deal with the phobos-rebuilding problem, but I still want to improve phobos.
[Issue 14502] dmd -O optimization breaks app
https://issues.dlang.org/show_bug.cgi?id=14502 --- Comment #1 from Tomáš Chaloupka chalu...@gmail.com --- Its really hard for me (as a D noob) to dustmite something usable from this :( The output from gdb is: Program received signal SIGSEGV, Segmentation fault. 0x77aa5407 in object.TypeInfo_Class.getHash(const(void*)) () from /opt/dmd-2.067/lib64/libphobos2.so.0.67 #0 0x77aa5407 in object.TypeInfo_Class.getHash(const(void*)) () from /opt/dmd-2.067/lib64/libphobos2.so.0.67 #1 0x77ac371a in _aaInX () from /opt/dmd-2.067/lib64/libphobos2.so.0.67 #2 0x77ac36d0 in _aaGetRvalueX () from /opt/dmd-2.067/lib64/libphobos2.so.0.67 #3 0x00407bf8 in test.HavlakLoopFinder.DSF(test.BasicBlock, test.UnionFindNode[], int[test.BasicBlock], int[], int) () #4 0x00407c48 in test.HavlakLoopFinder.DSF(test.BasicBlock, test.UnionFindNode[], int[test.BasicBlock], int[], int) () #5 0x00407c48 in test.HavlakLoopFinder.DSF(test.BasicBlock, test.UnionFindNode[], int[test.BasicBlock], int[], int) () It has deterministic behaviour, always segfaults on the 12th iteration. I've made a PR https://github.com/kostya/benchmarks/pull/23 which ads final to classes to speed it up a bit and this problem no longer occur with these changes - I have no idea why --
[Issue 14505] File doesn't rewind read pointer for a+ mode on Windows
https://issues.dlang.org/show_bug.cgi?id=14505 --- Comment #2 from Martin Nowak c...@dawg.eu --- (In reply to Martin Nowak from comment #1) Related to bug 14422. Issue 14422 --
[Issue 14505] File doesn't rewind read pointer for a+ mode on Windows
https://issues.dlang.org/show_bug.cgi?id=14505 --- Comment #1 from Martin Nowak c...@dawg.eu --- Related to bug 14422. --
[Issue 14505] New: File doesn't rewind read pointer for a+ mode on Windows
https://issues.dlang.org/show_bug.cgi?id=14505 Issue ID: 14505 Summary: File doesn't rewind read pointer for a+ mode on Windows Product: D Version: D2 Hardware: All OS: Windows Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: c...@dawg.eu cat bug.d CODE void main() { import std.file, std.stdio; std.file.write(test.txt, content); auto f = File(test.txt, a+); assert(f.tell == 0); } CODE dmd -run bug Happens for DMC's and MSVC's runtime. --
[Issue 13820] switch and case expressions should support alias this types
https://issues.dlang.org/show_bug.cgi?id=13820 Martin Krejcirik m...@krej.cz changed: What|Removed |Added CC||m...@krej.cz Version|unspecified |D2 --
[Issue 13820] switch and case expressions should support alias this types
https://issues.dlang.org/show_bug.cgi?id=13820 Martin Krejcirik m...@krej.cz changed: What|Removed |Added Keywords||pull Hardware|x86_64 |All OS|Linux |All --- Comment #1 from Martin Krejcirik m...@krej.cz --- https://github.com/D-Programming-Language/dmd/pull/4618 --
Re: ARM Cortex-M Microcontroller startup files
On Sunday, 26 April 2015 at 16:34:09 UTC, Dicebot wrote: On Sunday, 26 April 2015 at 15:55:34 UTC, Jens Bauer wrote: Done. http://wiki.dlang.org/Microcontroller_startup_files Thanks! It is important for that information not be lost among hundreds of NG posts, wiki is much more searchable. No problem. I hesitated, because I'm not sure of the directory structure yet. I may have to change it again, but I think I'll be able to keep the current repository.
D 2.067.1
We're glad to announce dmd 2.067.1 which includes several regression and bug fixes over 2.067.0. http://dlang.org/changelog.html#2.067.1 Please report any bug you encounter at https://issues.dlang.org/.
Re: Cleaned up C++
On Sunday, 26 April 2015 at 14:28:11 UTC, Baz wrote: On Sunday, 26 April 2015 at 12:04:20 UTC, Laeeth Isharc wrote: On Sunday, 26 April 2015 at 09:26:11 UTC, ponce wrote: On Wednesday, 22 April 2015 at 19:51:23 UTC, ponce wrote: I should put in in a d-idioms anyway. http://p0nce.github.io/d-idioms/#How-does-D-improve-on-C++17? excellent. I linked it here: http://wiki.dlang.org/Coming_From Luke 4:24 nobody is prophet in his own country http://www.reddit.com/r/programming/comments/33x6lj/how_does_d_improve_on_c17/ Lesson taken: should have put a less aggressive title.
Re: Updating ddoc to support modern HTML tags
On 26/04/2015 03:58, Andrei Alexandrescu wrote: On 4/25/15 5:41 PM, Stewart Gordon wrote: snip Even then, I wasn't able to do it perfectly. Has anybody tried to use Ddoc to generate (for example) LaTeX, RTF, XML or JSON output, for that matter? LaTeX is there. I also wrote text only and verbatim ddoc files, they're all there in the distribution. There are a few issues with JSON that could be easily fixed but seems like a low impact issue. LaTeX is where? The text only and verbatim ddoc files are where? I've just downloaded the latest DMD package and can't see any sign of these anywhere. Stewart. -- My email address is valid but not my primary mailbox and not checked regularly. Please keep replies on the 'group where everybody may benefit.
Re: array operations and ranges
Manu, I just saw your other post clarifying the code was float[N] a = ..., not float[] a. That changes things a bit. I just implemented a static array type in the lib (1-d only for now) which can do the following: unittest { import std.range: only; StaticArray!(int, 2) x; assert (x[] == [0, 0]); x[0..2] = only (5, 6); assert (x[] == [5, 6]); x[] += 5; assert (x[] == [10, 11]); x[0..1] -= 5; assert (x[] == [5, 11]); StaticArray!(int, 4) y = only (1,2,3,4); assert (y[] == [1, 2, 3, 4]); auto z = only (9,8,7).static_array!([3]); assert (z[] == [9, 8, 7]); } Assertions are thrown if the assigned range doesn't match the static array length. https://github.com/evenex/autodata/blob/master/source/spaces/array.d
Re: Adding Radix Sort into Phobos
On 04/26/2015 09:16 AM, Per =?UTF-8?B?Tm9yZGzDtnci?= per.nord...@gmail.com wrote: I have a radix sort implementation at https://github.com/nordlow/justd/blob/master/intsort.d#L92intsort.d which beats Phobos own Quicksort by a factor 1.5 to 4 depending on element type (Intergral or FloatingPoint). Anyone up for the job of adapting and merging it into Phobos' std.algorithm.sorting? Code seems to be pretty done (although there are lots of TODOs). Why not simply convert it into a pull request?
How does D improve on C++17?
Now on the front page of Hacker News! https://news.ycombinator.com/
Re: How does D improve on C++17?
On Monday, 27 April 2015 at 01:28:01 UTC, Walter Bright wrote: Now on the front page of Hacker News! https://news.ycombinator.com/ Would be nice if coherent ownership semantics could be added to the list of things D does better than C++17
Re: How does D improve on C++17?
On Monday, 27 April 2015 at 01:28:01 UTC, Walter Bright wrote: Now on the front page of Hacker News! https://news.ycombinator.com/ I feel like nowadays its just a Pick your poison type of thing. It seems like an arms race so i dont think neither will improve upon the other.
[Issue 14508] New: compiling with -unittest instantiates templates in non-root modules
https://issues.dlang.org/show_bug.cgi?id=14508 Issue ID: 14508 Summary: compiling with -unittest instantiates templates in non-root modules Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: c...@dawg.eu cat foo.d CODE import bar; CODE cat bar.d CODE struct MonoTimeImpl() { } alias MonoTime = MonoTimeImpl!(); CODE dmd -c -unittest foo nm foo.o As bar.d isn't a root module the MonoTimeImpl!() template shouldn't be instantiated. It works correctly with -O -release -inline and only fails with -unittest. --
[Issue 14509] New: Can't override Object methods in synchronized classes
https://issues.dlang.org/show_bug.cgi?id=14509 Issue ID: 14509 Summary: Can't override Object methods in synchronized classes Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: pub...@dicebot.lv === synchronized class A { override equals_t opEquals(Object rhs) { return 0; } } === Error: function test.A.opEquals does not override any function, did you mean to override 'object.Object.opEquals'? There does not seem to be any way to override Object methods in synchronised classes as those become implicitly shared. --