Re: array of delegates
So, that message is a pretty cryptic, but the problem there is that map does its thing at runtime, but partial is a template and must be instantiated at compile time. Instead you can use std.meta.staticMap, by doing something like this: void main() { import std.stdio; import std.functional; import std.meta; AA aa = new AA(); int delegate(int, Props) sg; sg = template partialSG(alias a) { alias partialSG = partial!(sg, a); } alias indarr = AliasSeq!(0, 1, 2, 3, 4); alias funs = staticMap!(partialSG, indarr); foreach (fun; funs) { writeln( fun(Props.p1) ); writeln( fun(Props.p2) ); } }
Re: Getting the current module as a symbol
On Wednesday, 13 April 2016 at 16:58:34 UTC, Vladimir Panteleev wrote: On Wednesday, 13 April 2016 at 11:36:07 UTC, Mithun Hunsur wrote: Yeah, that also works; you have to define a symbol (if you don't have one you can already use) in order to get to it, so it's a little wasteful. Still useful to know, though! No, it's not necessary. You should be able to walk the chain of __traits(parent) by starting with a local symbol, e.g. a lambda predicate. Have a look at std.traits.moduleName which does most of the work. Aha! That is a _very_ clever trick. :) For everyone else: __traits(parent, {}); The {} is a lambda predicate instantiated in the current scope (i.e. module scope); getting the parent of that gets you the module. If you wanted to generalise that, you could walk up the parent chain like Vladimir says - but this is perfect for my uses. Thanks again!
Re: Integer overflow checking
On Thursday, 14 April 2016 at 04:52:12 UTC, Walter Bright wrote: On 4/13/2016 8:00 PM, deadalnix wrote: Also, just checked, on sandy bridge, the LEA has 3clock latency (but start earlier in the pipeline) and the add 1, so it is not as bad as it looks (it is still bad). The size is larger, too (not so cache friendly). Integer arithmetic is sort of the bread and butter of computer programs, how much slowdown will people accept? Maybe not everywhere, but some security related code and/or tool like ubsan surely can benefit from this.
[Issue 15629] [REG2.066.0] wrong code with "-O -inline" but correct with "-O"
https://issues.dlang.org/show_bug.cgi?id=15629 Walter Brightchanged: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #6 from Walter Bright --- Comment 3 further reduces to: void main() { int[] a = [3]; int value = a[0] >= 0 ? a[0] : -a[0]; assert(a[0] == 3); writeln(value, a); } void writeln(int v, int[] a) { } and only -O is needed (not -inline). --
Re: Integer overflow checking
On 4/13/2016 8:00 PM, deadalnix wrote: Also, just checked, on sandy bridge, the LEA has 3clock latency (but start earlier in the pipeline) and the add 1, so it is not as bad as it looks (it is still bad). The size is larger, too (not so cache friendly). Integer arithmetic is sort of the bread and butter of computer programs, how much slowdown will people accept?
[Issue 12624] [REG 2.064] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime
https://issues.dlang.org/show_bug.cgi?id=12624 --- Comment #10 from Vladimir Panteleev--- (In reply to Walter Bright from comment #8) > Works for me, but added the test case to the test suite. According to Digger, it was fixed by https://github.com/D-Programming-Language/dmd/pull/5109 --
[Issue 12507] SysTime.init.toString should not segfault
https://issues.dlang.org/show_bug.cgi?id=12507 Issue 12507 depends on issue 12624, which changed state. Issue 12624 Summary: [REG 2.064] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime https://issues.dlang.org/show_bug.cgi?id=12624 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WORKSFORME --
[Issue 12624] [REG 2.064] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime
https://issues.dlang.org/show_bug.cgi?id=12624 Walter Brightchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WORKSFORME --
[Issue 12624] [REG 2.064] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime
https://issues.dlang.org/show_bug.cgi?id=12624 --- Comment #9 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/ebf5dfc90d00c7c693ba50c25e38bce15ddd7827 add test cases for issue 12624 https://github.com/D-Programming-Language/dmd/commit/4f4fe9dcc83dd85b08d95d077bd194c5c1ef3647 Merge pull request #5658 from WalterBright/test12624 add test cases for issue 12624 --
[Issue 15923] New: is expression qualifier matching does not work with multiple qualifiers
https://issues.dlang.org/show_bug.cgi?id=15923 Issue ID: 15923 Summary: is expression qualifier matching does not work with multiple qualifiers Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: and...@erdani.com Consider: alias T = shared(const int); static if (is(T == shared(U), U)) pragma(msg, "works"); else static assert(0, "does not work"); This fails to compile. The compiler should peel the "shared" and bind U to const int. This code does work: alias T = shared(const int); static if (is(T == shared(const(U)), U)) pragma(msg, "works"); else static assert(0, "does not work"); --
Re: Integer overflow checking
On Thursday, 14 April 2016 at 02:55:01 UTC, deadalnix wrote: On Wednesday, 13 April 2016 at 22:13:27 UTC, Walter Bright wrote: On 4/12/2016 5:06 AM, Andrei Alexandrescu wrote: Interesting: http://blog.regehr.org/archives/1384 -- Andrei Curiously never mentioned is the following optimization: return a+b*2+27; becomes: LEA EAX,27[ESI][EDI*2] To overflow check: ADD EDI,EDI JO overflow ADD EDI,27 JO overflow MOV EAX,ESI ADD EAX,EDI JO overflow I don't see efficiency there, even with the JO's being free. It is clearly not as optimal, but still pretty good. The article doesn't pretend it all come for free, just that it comes for much cheaper than before. Also, just checked, on sandy bridge, the LEA has 3clock latency (but start earlier in the pipeline) and the add 1, so it is not as bad as it looks (it is still bad).
Re: Integer overflow checking
On Wednesday, 13 April 2016 at 22:13:27 UTC, Walter Bright wrote: On 4/12/2016 5:06 AM, Andrei Alexandrescu wrote: Interesting: http://blog.regehr.org/archives/1384 -- Andrei Curiously never mentioned is the following optimization: return a+b*2+27; becomes: LEA EAX,27[ESI][EDI*2] To overflow check: ADD EDI,EDI JO overflow ADD EDI,27 JO overflow MOV EAX,ESI ADD EAX,EDI JO overflow I don't see efficiency there, even with the JO's being free. It is clearly not as optimal, but still pretty good. The article doesn't pretend it all come for free, just that it comes for much cheaper than before.
Re: Opportunity: Software Execution Time Determinism
On 4/13/2016 8:50 AM, Nordlöw wrote: I'm currenly in an industry with extremely high demands on software determinism, both in space and time (hard realtime). My conclusion so far is that most safety-critical industries today are in desperate need of better (any) language support for guaranteeing determinism, especially time. The amount of time/money spent/wasted on complicated extra tooling processes and tests to assure time-determinism is just insane, at least in the avionics industry. I'd be interested if you can give an overview of the existing tools/techniques for dealing with this.
Re: Opportunity: Software Execution Time Determinism
On 4/13/2016 6:13 PM, Andrei Alexandrescu wrote: Tarjan was among the first to study the problem: http://www.cs.princeton.edu/courses/archive/spr06/cos423/Handouts/Amortized.pdf. He assigned "computational credits" to functions and designed a type system in which functions cannot consume more credits than assigned. One simpler thing we can do is add an attribute: void fun() @credits(2); meaning fun() consumes two computational credits. Then a function that calls fun() n times consumes n*2 credits etc. Generally we wouldn't aim for automatically determining credits consumed, but we can define a library that allows the user to declare credits appropriately. This looks like it could be combined with Simen's @constanttime idea. After all, a function would have to run in constant time in order for the credits to be consistent. Or maybe go one step further, and use @BigO(2) ? @BigO(2) would imply constant time. This would fit in with your research on combining complexities.
Re: Opportunity: Software Execution Time Determinism
On 4/13/2016 5:31 PM, Simen Kjaeraas wrote: On Wednesday, 13 April 2016 at 22:58:26 UTC, Walter Bright wrote: The compiler could be fairly easily compute cyclomatic complexity, but how that would be used to determine max time escapes me. For example, how many times would a particular loop be executed? Isn't this the halting problem, i.e. not computable? The first step is simple - we care only about functions being constant-time. Let's invent a @keyword for that: @constanttime. @constanttime functions can only call other functions marked @constanttime, and may not contain conditionals, gotos or while-loops. @constanttime functions may contain for and foreach-loops, iff the number of iterations are known at compile-time, and 'break' is never used. Very interesting. Recursion would have to be disallowed as well. The part about conditionals seems a bit harsh, but it's got to be there for determinism. Understood. Not knowing Nordlöw's use case I can't say for sure what he actually needs. Your ideas are good. Let's see what Nordlöw says.
Re: Fixed-Length Array Sorting
On 4/13/16 7:20 PM, Temtaime wrote: If you want help std algorithm sorting, a better start is to fix bugs : a lot of functions can't work with swapstrategy stable and so on. Are these in bugzilla? -- Andrei
Re: Opportunity: Software Execution Time Determinism
On 4/13/16 6:58 PM, Walter Bright wrote: The compiler could be fairly easily compute cyclomatic complexity, but how that would be used to determine max time escapes me. For example, how many times would a particular loop be executed? Isn't this the halting problem, i.e. not computable? Andrei has done some great work on determining big O complexity, but that's only a small part of this problem. I don't know about any work in this area, but I can see it would be valuable. Tarjan was among the first to study the problem: http://www.cs.princeton.edu/courses/archive/spr06/cos423/Handouts/Amortized.pdf. He assigned "computational credits" to functions and designed a type system in which functions cannot consume more credits than assigned. One simpler thing we can do is add an attribute: void fun() @credits(2); meaning fun() consumes two computational credits. Then a function that calls fun() n times consumes n*2 credits etc. Generally we wouldn't aim for automatically determining credits consumed, but we can define a library that allows the user to declare credits appropriately. Andrei
[Issue 12624] [REG 2.064] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime
https://issues.dlang.org/show_bug.cgi?id=12624 --- Comment #8 from Walter Bright--- Works for me, but added the test case to the test suite. --
[Issue 12624] [REG 2.064] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime
https://issues.dlang.org/show_bug.cgi?id=12624 Walter Brightchanged: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #7 from Walter Bright --- https://github.com/D-Programming-Language/dmd/pull/5658 --
Re: Opportunity: Software Execution Time Determinism
On Wednesday, 13 April 2016 at 22:58:26 UTC, Walter Bright wrote: The compiler could be fairly easily compute cyclomatic complexity, but how that would be used to determine max time escapes me. For example, how many times would a particular loop be executed? Isn't this the halting problem, i.e. not computable? The first step is simple - we care only about functions being constant-time. Let's invent a @keyword for that: @constanttime. @constanttime functions can only call other functions marked @constanttime, and may not contain conditionals, gotos or while-loops. @constanttime functions may contain for and foreach-loops, iff the number of iterations are known at compile-time, and 'break' is never used. The part about conditionals seems a bit harsh, but it's got to be there for determinism. Constant time is easy, and may or may not be enough to cover Nordlöw's needs. Anything beyond it is very likely to be halting problem stuff. Andrei has done some great work on determining big O complexity, but that's only a small part of this problem. I have a friend who works on timing attacks in cryptography. Knowing the implementation and measuring the time it takes to multiply two bigints can help you guess what the numbers are, so in his case @constanttime would be exactly what he wants, while big-O would be useless. Not knowing Nordlöw's use case I can't say for sure what he actually needs. -- Simen
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 17:21:58 UTC, Jon D wrote: On Wednesday, 13 April 2016 at 17:01:33 UTC, Dicebot wrote: On Wednesday, 13 April 2016 at 16:34:16 UTC, Jon D wrote: [...] You don't need to put anything on path to run utils from dub packages. `dub run` will take care of setting necessary envionment (without messing with the system): dub fetch package_with_apps dub run package_with_apps:app1 --flags args These are command line utilities, along the lines of unix 'cut', 'grep', etc, intended to be used as part of unix pipeline. It'd be less convenient to be invoking them via dub. They really should be on the path themselves. --Jon if dub supports something like: ``` dub deploy ``` and you can specifiy some dir like '/usr/bin/' in the dub.sdl, it would be great
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 16:34:16 UTC, Jon D wrote: Thanks Rory, Puming. I'll look into this and see how best to make it fit. I'm realizing also there's one additional capability it'd be nice to have in dub for tools like this, which in an option to install the executables somewhere that can be easily be put on the path. Still, even without this there'd be benefit to having them fetched via dub. --Jon Well, you can do that: In the subpackage dub.sdl, add targetPath: ``` name "app1" targetType "executable" targetPath "../bin/" dependency "myapp:common" version="*" ```
[Issue 15922] New: DMD segfault in functionParameters()
https://issues.dlang.org/show_bug.cgi?id=15922 Issue ID: 15922 Summary: DMD segfault in functionParameters() Product: D Version: D2 Hardware: x86_64 URL: https://gist.github.com/Hackerpilot/ba992214296597698a 2c455dbf4abaff OS: Linux Status: NEW Keywords: ice-on-invalid-code, industry Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: briancsch...@gmail.com Dmd segfaults when compiling this code: template StorageAttributes(Store) { enum hasInsertMethod = Store.insert; enum hasFullSlice = Store.init[]; } struct ValidSparseDataStore(DataT) { DataT insert() { correctedInsert!(false); } DataT correctedInsert(bool CorrectParents)() {} auto opSlice() inout {} } alias BasicCubeT = StorageAttributes!(ValidSparseDataStore!int); --
array of delegates
Hi at all! Having read this: http://forum.dlang.org/post/mailman.2415.1354291433.5162.digitalmars-d-le...@puremagic.com still have a problem... Lets begin with what works: enum Props{p1, p2} class AA { int[] arr1; int[] arr2; this() { //arbitrary values... arr1 = [9, 6, 33, 42, 58]; arr2 = [2, 3, 44, 28, 77]; } auto Foo(int i, Props p) { with(Props) { final switch(p) { case p1: { return arr1[i]; } break; case p2: { return arr2[i]; } break; } } } } main() { int indarr[] = [0, 1, 2, 3, 4]; import std.stdio; import std.functional; AA aa = new AA(); int delegate(int, Props) sg; sg = alias M3 = partial!(sg, 3); writeln(M3(Props.p1)); writeln(M3(Props.p2)); } So far, so good. But now the question: if I try import std.algorithm; indarr.map!(a => partial!(sg, a)); I get an error, like Error: partial (Props _param_0) is not callable using argument types (). Do you have a hint, what I'm doing wrong? For the motivation: In this way I would like to store some "links" to data I have without having to define a struct, which incorporate the data. The struct itself is not the problem, but how the data is handled is not known by the struct, but only by the class AA, so the expressions inside the switch should not (?) lie inside the struct.
Re: Fixed-Length Array Sorting
On Wednesday, 13 April 2016 at 22:02:19 UTC, Nordlöw wrote: On Wednesday, 13 April 2016 at 19:58:49 UTC, Andrei Alexandrescu wrote: * Cut and paste error at https://github.com/nordlow/phobos-next/blob/master/src/sortn.d#L90 Fixed. * I see some sizes are not supported, we should not have holes. * Sometimes the sort routine gets too bulky. Suggestion: also define networks for medianOfUpTo and medianExactly, then use them in a quicksort manner - first compute the median to segregate values in below/over the median, then make two calls to sortExactly!(n / 2). That way you get to sort n values with median of n values (smaller and simpler) and two sorts of n / 2 values. Added as TODOs for now. Thanks! If you want help std algorithm sorting, a better start is to fix bugs : a lot of functions can't work with swapstrategy stable and so on. Me for example suffers from that.
Re: Opportunity: Software Execution Time Determinism
The compiler could be fairly easily compute cyclomatic complexity, but how that would be used to determine max time escapes me. For example, how many times would a particular loop be executed? Isn't this the halting problem, i.e. not computable? Andrei has done some great work on determining big O complexity, but that's only a small part of this problem. I don't know about any work in this area, but I can see it would be valuable.
Re: Opportunity: Software Execution Time Determinism
On Wednesday, 13 April 2016 at 15:50:40 UTC, Nordlöw wrote: I'm currenly in an industry with extremely high demands on software determinism, both in space and time (hard realtime). I'm aware of the lack of absolute time-determinism in the CPU architectures of today. What is absolute time-determinism in a CPU architectures ? and why is it important in hard real time environments ? Nick
Re: Integer overflow checking
On 4/12/2016 5:06 AM, Andrei Alexandrescu wrote: Interesting: http://blog.regehr.org/archives/1384 -- Andrei Curiously never mentioned is the following optimization: return a+b*2+27; becomes: LEA EAX,27[ESI][EDI*2] To overflow check: ADD EDI,EDI JO overflow ADD EDI,27 JO overflow MOV EAX,ESI ADD EAX,EDI JO overflow I don't see efficiency there, even with the JO's being free.
Re: Fixed-Length Array Sorting
On Wednesday, 13 April 2016 at 19:58:49 UTC, Andrei Alexandrescu wrote: * Cut and paste error at https://github.com/nordlow/phobos-next/blob/master/src/sortn.d#L90 Fixed. * I see some sizes are not supported, we should not have holes. * Sometimes the sort routine gets too bulky. Suggestion: also define networks for medianOfUpTo and medianExactly, then use them in a quicksort manner - first compute the median to segregate values in below/over the median, then make two calls to sortExactly!(n / 2). That way you get to sort n values with median of n values (smaller and simpler) and two sorts of n / 2 values. Added as TODOs for now. Thanks!
[Issue 3410] std.stdio.File.tell() doesn't work for files >2GB
https://issues.dlang.org/show_bug.cgi?id=3410 Andrei Alexandrescuchanged: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #5 from Andrei Alexandrescu --- And this as well! --
[Issue 3409] stdio.File.seek() doesn't work for files >2GB
https://issues.dlang.org/show_bug.cgi?id=3409 Andrei Alexandrescuchanged: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #11 from Andrei Alexandrescu --- I'll just close then. Thx! --
Re: Command line utilities for tab-separated value files
On 04/13/2016 01:40 PM, Jon D wrote: > What do you mean by an "AMA"? It means "(I'm the author), Ask Me Anything". Ali
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 19:52:30 UTC, Walter Bright wrote: On 4/11/2016 5:50 PM, Jon D wrote: I'd welcome any feedback, either on the apps or the code. Intention is that the code be reasonable example programs. And, I may write a blog post about my D explorations at some point, they'd be referenced in such an article. You've got questions on: https://www.reddit.com/r/programming/comments/4ems6a/commandline_utilities_for_large_tabseparated/ !! As the author, it'd be nice to do an AMA there. Thanks for posting there and letting me know. I responded and will watch the thread. What do you mean by an "AMA"?
[Issue 3409] stdio.File.seek() doesn't work for files >2GB
https://issues.dlang.org/show_bug.cgi?id=3409 Simen Kjaeraaschanged: What|Removed |Added CC||simen.kja...@gmail.com --- Comment #10 from Simen Kjaeraas --- This was fixed in https://github.com/D-Programming-Language/phobos/pull/3828. --
[Issue 3410] std.stdio.File.tell() doesn't work for files >2GB
https://issues.dlang.org/show_bug.cgi?id=3410 Simen Kjaeraaschanged: What|Removed |Added CC||simen.kja...@gmail.com --- Comment #4 from Simen Kjaeraas --- This was fixed in https://github.com/D-Programming-Language/phobos/pull/3828. --
Re: Fixed-Length Array Sorting
On 04/13/2016 12:07 PM, Nordlöw wrote: On Tuesday, 12 April 2016 at 14:56:00 UTC, Andrei Alexandrescu wrote: Also to avoid cache line thrashing, sort parallel swaps by leftmost index. E.g. this line: 18,19, 20,21, 2,4, 1,3, 0,5, 6,8, 7,9, 10,12, 11,13, becomes: 0,5, 1,3, 2,4, 6,8, 7,9, 10,12, 11,13, 18,19, 20,21, Andrei Done. No time but couple more remarks:\ * Cut and paste error at https://github.com/nordlow/phobos-next/blob/master/src/sortn.d#L90 * I see some sizes are not supported, we should not have holes. * Sometimes the sort routine gets too bulky. Suggestion: also define networks for medianOfUpTo and medianExactly, then use them in a quicksort manner - first compute the median to segregate values in below/over the median, then make two calls to sortExactly!(n / 2). That way you get to sort n values with median of n values (smaller and simpler) and two sorts of n / 2 values. I think this is great work in the making. We should be able at some point to plug this into std.sort. Andrei
Re: Command line utilities for tab-separated value files
On 4/11/2016 5:50 PM, Jon D wrote: I'd welcome any feedback, either on the apps or the code. Intention is that the code be reasonable example programs. And, I may write a blog post about my D explorations at some point, they'd be referenced in such an article. You've got questions on: https://www.reddit.com/r/programming/comments/4ems6a/commandline_utilities_for_large_tabseparated/ !! As the author, it'd be nice to do an AMA there.
Re: Any usable SIMD implementation?
On 4/13/2016 5:47 AM, Marco Leise wrote: Yes, they are all @property and a substitution with direct access to the globals will work around GDC's lack of cross-module inlining. Otherwise these feature checks which might be used in hot code, are more costly than they should be. I hate when things get in the way of efficiency. :) It doesn't need to be efficient, because such checks should be done at a higher level in the program's logic, not on low level code. Even so, the program could cache the result of the call.
Re: Command line utilities for tab-separated value files
On 04/13/2016 09:48 PM, Jon D wrote: > Right. So, partly what I'm wondering is if during the normal dub > fetch/run cycle there might be an opportunity to print a message the > user with some info to help them add the tools to their path. I haven't > used dub much, so I'll have to look into it more. But there should be > some way to make it reasonably easy and clear. It'll probably be a few > days before I can get to this, but I would like to get them in the > package registry. This is wrong direction. Users of those tools should not even ever need to have dub installed or know about it existence - dub is strictly a developer tool. Instead, whoever distributes the utils should use dub to build them and use generated artifacts to prepare distribution package.
Re: TTS Synthesis: D and vibe.d in Action
Hello Chris, CvDda> Just to inform you that we successfully use D and vibe.d for two CvDda> things: This is just overwhelming! How do you make bindings to NVDA API which is in Python? I'm not an NVDA user (I'm using JAWS, if it matters), but I'm still very interested in the technology. Andre.
Re: DWT Cloning / Build fails
On 2016-04-13 17:23, Jesse Phillips wrote: Looks like your firewall is blocking the git protocol. Checkout dwt without --recursive Modify the .gitmodules file so that https:// urls are used instead of git Run the git submodule update --init Updated to use HTTPS for the submodules. -- /Jacob Carlborg
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 18:22:21 UTC, Dicebot wrote: On Wednesday, 13 April 2016 at 17:21:58 UTC, Jon D wrote: You don't need to put anything on path to run utils from dub packages. `dub run` will take care of setting necessary envionment (without messing with the system): dub fetch package_with_apps dub run package_with_apps:app1 --flags args These are command line utilities, along the lines of unix 'cut', 'grep', etc, intended to be used as part of unix pipeline. It'd be less convenient to be invoking them via dub. They really should be on the path themselves. Sure, that would be beyond dub scope though. Making binary packages is independent of build system or source layout (and is highly platform-specific). The `dun run` feature is mostly helpful when you need to use one such tool as part of a build process for another dub package. Right. So, partly what I'm wondering is if during the normal dub fetch/run cycle there might be an opportunity to print a message the user with some info to help them add the tools to their path. I haven't used dub much, so I'll have to look into it more. But there should be some way to make it reasonably easy and clear. It'll probably be a few days before I can get to this, but I would like to get them in the package registry. --Jon
Re: Strange Loop Conference Call for Presentations
On Wednesday, 13 April 2016 at 15:00:53 UTC, Joakim wrote: On Wednesday, 13 April 2016 at 14:33:01 UTC, Andrei That conference had a strange incident last year where they kicked a guy out for his political views, that had nothing to do with his technical talk: http://www.slate.com/articles/technology/bitwise/2015/06/curtis_yarvin_booted_from_strange_loop_it_s_a_big_big_problem.html I personally wouldn't attend any conference that applied such strange principles. Speaking and unintrusively poking fun at the self-righteousness (by a variable name for example) would also be effective.
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 17:21:58 UTC, Jon D wrote: You don't need to put anything on path to run utils from dub packages. `dub run` will take care of setting necessary envionment (without messing with the system): dub fetch package_with_apps dub run package_with_apps:app1 --flags args These are command line utilities, along the lines of unix 'cut', 'grep', etc, intended to be used as part of unix pipeline. It'd be less convenient to be invoking them via dub. They really should be on the path themselves. Sure, that would be beyond dub scope though. Making binary packages is independent of build system or source layout (and is highly platform-specific). The `dun run` feature is mostly helpful when you need to use one such tool as part of a build process for another dub package.
Re: Command line utilities for tab-separated value files
On 04/11/2016 08:50 PM, Jon D wrote: Hi all, I've open sourced a set of command line utilities for manipulating tab-separated value files. They are complementary to traditional unix tools like cut, grep, etc. They're useful for manipulating large data files. I use them when prepping files for R and similar tools. These tools were part of my 'explore D' programming exercises. The tools are here: https://github.com/eBay/tsv-utils-dlang They are likely of interest primarily to people regularly working with large files, though others might find the performance benchmarks of interest as well (included in the README). I'd welcome any feedback, either on the apps or the code. Intention is that the code be reasonable example programs. And, I may write a blog post about my D explorations at some point, they'd be referenced in such an article. --Jon Looking great. Thanks! https://www.facebook.com/dlang.org/posts/1275477382465940 https://twitter.com/D_Programming/status/720310640531808261 https://www.reddit.com/r/programming/comments/4ems6a/commandline_utilities_for_large_tabseparated/ Andrei
[Issue 15920] std.traits.MemberFunctionsTuple gives a wrong result
https://issues.dlang.org/show_bug.cgi?id=15920 Simen Kjaeraaschanged: What|Removed |Added Keywords||pull CC||simen.kja...@gmail.com --- Comment #1 from Simen Kjaeraas --- MemberFunctionsTuple was unaware that isCovariant(a, b) does not preclude isCovariant(b, a). After a little update, it now knows. Pull: https://github.com/D-Programming-Language/phobos/pull/4195 --
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 12:36:56 UTC, Dejan Lekic wrote: On Tuesday, 12 April 2016 at 00:50:24 UTC, Jon D wrote: I've open sourced a set of command line utilities for manipulating tab-separated value files. I rarely need TSV files, but I deal with CSV files every day. - It would be nice to test your implementation against std.csv (it can use TAB as separator). Did you try to compare the two? No, I didn't try using the std.csv library utilities. The utilities all take a delimiter, so comma can be specified, but that won't handle CSV escaping. For myself, I'd be more inclined to add TSV-CSV converters rather than adding native CSV support to each tool, but if you're working with CSV all the time that'd be nuisance. If you want, you can try rewriting the inner loop of one of the tools to use csvNextToken rather than algorithm.splitter. tsv-select would be the easiest of the tools to try. It'd also be necessary to replace the writeln for the output to properly add CSV escapes. --Jon
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 16:34:16 UTC, Jon D wrote: Thanks Rory, Puming. I'll look into this and see how best to make it fit. I'm realizing also there's one additional capability it'd be nice to have in dub for tools like this, which in an option to install the executables somewhere that can be easily be put on the path. Still, even without this there'd be benefit to having them fetched via dub. You don't need to put anything on path to run utils from dub packages. `dub run` will take care of setting necessary envionment (without messing with the system): dub fetch package_with_apps dub run package_with_apps:app1 --flags args
Re: Getting the current module as a symbol
On Wednesday, 13 April 2016 at 11:36:07 UTC, Mithun Hunsur wrote: Yeah, that also works; you have to define a symbol (if you don't have one you can already use) in order to get to it, so it's a little wasteful. Still useful to know, though! No, it's not necessary. You should be able to walk the chain of __traits(parent) by starting with a local symbol, e.g. a lambda predicate. Have a look at std.traits.moduleName which does most of the work.
Re: Command line utilities for tab-separated value files
On Wednesday, 13 April 2016 at 07:34:11 UTC, Rory McGuire wrote: On Wed, Apr 13, 2016 at 3:41 AM, Puming via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote: On Tuesday, 12 April 2016 at 06:22:55 UTC, Puming wrote: Here is what I know of it, using subPackages: Just tried your suggestion and it works. I just added the below to the parent project to get the apps build: void main() { import std.process : executeShell; executeShell(`dub build :app1`); executeShell(`dub build :app2`); executeShell(`dub build :app3`); } Thanks Rory, Puming. I'll look into this and see how best to make it fit. I'm realizing also there's one additional capability it'd be nice to have in dub for tools like this, which in an option to install the executables somewhere that can be easily be put on the path. Still, even without this there'd be benefit to having them fetched via dub. --Jon
Re: Fixed-Length Array Sorting
On Tuesday, 12 April 2016 at 14:56:00 UTC, Andrei Alexandrescu wrote: Also to avoid cache line thrashing, sort parallel swaps by leftmost index. E.g. this line: 18,19, 20,21, 2,4, 1,3, 0,5, 6,8, 7,9, 10,12, 11,13, becomes: 0,5, 1,3, 2,4, 6,8, 7,9, 10,12, 11,13, 18,19, 20,21, Andrei Done.
Opportunity: Software Execution Time Determinism
I'm currenly in an industry with extremely high demands on software determinism, both in space and time (hard realtime). My conclusion so far is that most safety-critical industries today are in desperate need of better (any) language support for guaranteeing determinism, especially time. The amount of time/money spent/wasted on complicated extra tooling processes and tests to assure time-determinism is just insane, at least in the avionics industry. If D was to attack this problem in the same systematic way it can restrict execution behaviour with `@safe pure nothrow @nogc` D would have yet another killing feature in its feature pack. I'm aware of the lack of absolute time-determinism in the CPU architectures of today. But the industry still uses such architectures, sometimes with memory-caches disabled and forbidding of multi-core/cpu in its products. Have anybody though about adding support for this in D? I assume it would have to integrate with the backend in various complicated ways. Both the frontend and the backend would need to have options for generation of code that promotes deterministic execution over smallest average time-execution (which is currently the default optimization route taken by most compilers and library algorithms). Are there any languages or compilers that tries to attack this problem? Note that this problem is highly related to concept of "cyclomatic complexity". See also: https://en.wikipedia.org/wiki/Cyclomatic_complexity
[Issue 15921] Win64: wrong codegen with array of structs slicing
https://issues.dlang.org/show_bug.cgi?id=15921 ag0ae...@gmail.com changed: What|Removed |Added Keywords||wrong-code CC||ag0ae...@gmail.com --
Re: Weird array setting behaviour on Windows(-m64)
On Wednesday, 13 April 2016 at 15:07:09 UTC, rikki cattermole wrote: Verified that it is a codegen problem for Win64 and not *nix. Please file a bug report. https://issues.dlang.org/show_bug.cgi?id=15921 Done, Thanks
[Issue 15921] Win64: wrong codegen with array of structs slicing
https://issues.dlang.org/show_bug.cgi?id=15921 ref2401changed: What|Removed |Added CC||refacto...@gmail.com --
[Issue 15921] Win64: wrong codegen with array of structs slicing
https://issues.dlang.org/show_bug.cgi?id=15921 ref2401changed: What|Removed |Added Severity|enhancement |major --
[Issue 15921] New: Win64: wrong codegen with array of structs slicing
https://issues.dlang.org/show_bug.cgi?id=15921 Issue ID: 15921 Summary: Win64: wrong codegen with array of structs slicing Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: refacto...@gmail.com Array setting behaviour produces wrong results. OS: Win 8.1 Pro DMD: v2.071.0 Build-cmd: dmd main.d -ofconsole-app.exe -debug -unittest -g -wi -m64 module dmain; import std.stdio; struct Vec { float a; } void main(string[] args) { Vec[] array = new Vec[4]; writeln("before: ", array); // prints [Vec(nan), Vec(nan), Vec(nan), Vec(nan)] array[] = Vec(24); writeln("after: ", array); // prints [Vec(0), Vec(0), Vec(0), Vec(0)] } Seems like slicing is broken in general. All the following variations produce different results but they are all wrong. array[] = Vec(24); array[0 .. 1] = Vec(24); array[0 .. $] = Vec(24); It works as expected if I do one of the following things: 1. Get rid of -m64. If I compile with -m32 flag then I cannot replicate the issue. 2. Changing the type of the Vec.a field from float to real, int, uint, long, ulong fixes the issue. Double still causes the issues. 3. Adding new fields to the Vec struct. 3.1. Vec {float a, b; } still does not work but the result is slightly different. array[] = Vec(24, 5); writeln("after: ", array); // [Vec(5, 0), Vec(5, 0), Vec(5, 0), Vec(5, 0)] 3.2. Vec { float a, b, c; } works fine. 4. Using index operator: array[0] = Vec(24) works fine --
Re: DWT Cloning / Build fails
On Wednesday, 13 April 2016 at 09:01:47 UTC, Chris wrote: On Tuesday, 12 April 2016 at 19:20:44 UTC, Jacob Carlborg wrote: The error messages are below. If I do it step by step (without --recursive) and then "git submodule update --init", I get more or less the same error: Cloning into 'base'... fatal: unable to connect to github.com: github.com[0: 192.30.252.130]: errno=Connection refused Looks like your firewall is blocking the git protocol. Checkout dwt without --recursive Modify the .gitmodules file so that https:// urls are used instead of git Run the git submodule update --init
Re: Weird array setting behaviour on Windows(-m64)
On 14/04/2016 2:49 AM, ref2401 wrote: Hello, I got stuck with a weird array setting behaviour and I need help. Just have a look at the example. OS: Win 8.1 Pro DMD: v2.071.0 Build-cmd: dmd main.d -ofconsole-app.exe -debug -unittest -g -wi -m64 module dmain; import std.stdio; struct Vec { float a; } void main(string[] args) { Vec[] array = new Vec[4]; writeln("before: ", array); // prints [Vec(nan), Vec(nan), Vec(nan), Vec(nan)] array[] = Vec(24); writeln("after: ", array); // prints [Vec(0), Vec(0), Vec(0), Vec(0)] } Seems like slicing is broken in general. All the following variations produce different results but they are all wrong. array[] = Vec(24); array[0 .. 1] = Vec(24); array[0 .. $] = Vec(24); It works as expected if I do one of the following things: 1. Get rid of -m64. If I compile with -m32 flag then I cannot replicate the issue. 2. Changing the type of the Vec.a field from float to real, int, uint, long, ulong fixes the issue. Double still causes the issues. 3. Adding new fields to the Vec struct. 3.1. Vec {float a, b; } still does not work but the result is slightly different. array[] = Vec(24, 5); writeln("after: ", array); // [Vec(5, 0), Vec(5, 0), Vec(5, 0), Vec(5, 0)] 3.2. Vec { float a, b, c; } works fine. 4. Using index operator: array[0] = Vec(24) works fine Verified that it is a codegen problem for Win64 and not *nix. Please file a bug report.
Re: Strange Loop Conference Call for Presentations
On Wednesday, 13 April 2016 at 14:33:01 UTC, Andrei Alexandrescu wrote: http://thestrangeloop.com/cfp.html This edition seems to be a very good fit for us. From the page: "Frequently accepted topics: functional programming, logic programming, dynamic/scripting languages, new or emerging languages, data structures, concurrency, databases, distributed computing, web frameworks, web architecture, performance, virtual machines, security, hardware/software interaction, historical topics" I encourage all DConf session speakers (including the ones we couldn't accept - all were very good!) to submit their talks to Strange Loop. That conference had a strange incident last year where they kicked a guy out for his political views, that had nothing to do with his technical talk: http://www.slate.com/articles/technology/bitwise/2015/06/curtis_yarvin_booted_from_strange_loop_it_s_a_big_big_problem.html I personally wouldn't attend any conference that applied such strange principles.
Weird array setting behaviour on Windows(-m64)
Hello, I got stuck with a weird array setting behaviour and I need help. Just have a look at the example. OS: Win 8.1 Pro DMD: v2.071.0 Build-cmd: dmd main.d -ofconsole-app.exe -debug -unittest -g -wi -m64 module dmain; import std.stdio; struct Vec { float a; } void main(string[] args) { Vec[] array = new Vec[4]; writeln("before: ", array); // prints [Vec(nan), Vec(nan), Vec(nan), Vec(nan)] array[] = Vec(24); writeln("after: ", array); // prints [Vec(0), Vec(0), Vec(0), Vec(0)] } Seems like slicing is broken in general. All the following variations produce different results but they are all wrong. array[] = Vec(24); array[0 .. 1] = Vec(24); array[0 .. $] = Vec(24); It works as expected if I do one of the following things: 1. Get rid of -m64. If I compile with -m32 flag then I cannot replicate the issue. 2. Changing the type of the Vec.a field from float to real, int, uint, long, ulong fixes the issue. Double still causes the issues. 3. Adding new fields to the Vec struct. 3.1. Vec {float a, b; } still does not work but the result is slightly different. array[] = Vec(24, 5); writeln("after: ", array); // [Vec(5, 0), Vec(5, 0), Vec(5, 0), Vec(5, 0)] 3.2. Vec { float a, b, c; } works fine. 4. Using index operator: array[0] = Vec(24) works fine
Re: I want this so badly, please implement
On Wednesday, 13 April 2016 at 13:17:57 UTC, cym13 wrote: There's a world between exceptionnaly getting a user password in order to detect and solve a bug through an error message and knowingly logging every single user password, be it only on the legal side. The latter shouldn't be needed. When you log everything, you just write garbage logs, that are impractical to process.
Strange Loop Conference Call for Presentations
http://thestrangeloop.com/cfp.html This edition seems to be a very good fit for us. From the page: "Frequently accepted topics: functional programming, logic programming, dynamic/scripting languages, new or emerging languages, data structures, concurrency, databases, distributed computing, web frameworks, web architecture, performance, virtual machines, security, hardware/software interaction, historical topics" I encourage all DConf session speakers (including the ones we couldn't accept - all were very good!) to submit their talks to Strange Loop. Andrei
Re: Beta of D language online tour
On Wednesday, 13 April 2016 at 12:45:21 UTC, Bubba wrote: One thing that you should try to run: https://developers.google.com/speed/pagespeed/insights/ on your page. that page shows where and how to fix your site for speed and better user experience. It even compress data like: Images/CSS/JS files where you can download and upload on your server. The user experience for mobile is low there, and exactly what I feel while browsing. Take a look there and try something like: @media screen and (max-width:800px) { } and @media screen and (orientation:portrait) { } For handling new behaviors on Mobile. Thank you for the suggestions! I'll have a look. Regards, André
Re: byte[] to hex string
On Wednesday, 13 April 2016 at 14:22:39 UTC, WebFreak001 wrote: On Wednesday, 13 April 2016 at 14:15:21 UTC, Suliman wrote: Does anybody have any ready to use byte[] to hex convert method? I found only C# examples http://stackoverflow.com/questions/623104/byte-to-hex-string Could anybody help me to convert any of this methods to D? The root of my problem is from here http://stackoverflow.com/questions/36600503/can-i-insert-in-db-binary-blob-data-in-body-of-sql-request-if-driver-do-not-supp I want to try mass hex string as SQL test to insert its in FireBird blob. https://dlang.org/phobos/std_digest_digest.html#toHexString --- import std.digest.digest; ubyte[] data; string hexString = data.toHexString(); Oh, thanks! It's really cool! I expect much more code!
Re: byte[] to hex string
On Wednesday, 13 April 2016 at 14:15:21 UTC, Suliman wrote: Does anybody have any ready to use byte[] to hex convert method? I found only C# examples http://stackoverflow.com/questions/623104/byte-to-hex-string Could anybody help me to convert any of this methods to D? The root of my problem is from here http://stackoverflow.com/questions/36600503/can-i-insert-in-db-binary-blob-data-in-body-of-sql-request-if-driver-do-not-supp I want to try mass hex string as SQL test to insert its in FireBird blob. https://dlang.org/phobos/std_digest_digest.html#toHexString --- import std.digest.digest; ubyte[] data; string hexString = data.toHexString();
byte[] to hex string
Does anybody have any ready to use byte[] to hex convert method? I found only C# examples http://stackoverflow.com/questions/623104/byte-to-hex-string Could anybody help me to convert any of this methods to D? The root of my problem is from here http://stackoverflow.com/questions/36600503/can-i-insert-in-db-binary-blob-data-in-body-of-sql-request-if-driver-do-not-supp I want to try mass hex string as SQL test to insert its in FireBird blob.
Re: Correct way to spawn many and stoping when one finishes ?
On Tuesday, 12 April 2016 at 12:12:19 UTC, Steven Schveighoffer wrote: On 4/10/16 4:59 AM, klimp wrote: On Sunday, 10 April 2016 at 07:48:51 UTC, klimp wrote: Is this corrrect ? Each task searches for the same thing so when once has found the others don't need to run anymore. It looks a bit strange not to stop those who havent find the thing: How can I kill a Tid ? Short answer: don't. This is kind of why there isn't a handy function to do so. If you kill a thread, there is no telling what state it is in, what locks it has held, etc. The best (and really only) way to manage threads is through a loop that checks periodically whether it should quit. -Steve I've solved the problem by atomically reading/writing a shared bool. That works fine, though I don't really need spawn() anymore. core.thread.Thread with a callback is widely enough.
Re: I want this so badly, please implement
On Wednesday, 13 April 2016 at 08:48:56 UTC, Kagamin wrote: On Tuesday, 12 April 2016 at 08:51:23 UTC, Kapps wrote: Amongst other things, you'd log sensitive data like passwords, which should never be stored anywhere in plain text, including log files. This is one of the reasons to not use GET for anything sensitive. With Adam's idea sensitive data can still accidentally leak into this extended diagnostic mechanism. There's a world between exceptionnaly getting a user password in order to detect and solve a bug through an error message and knowingly logging every single user password, be it only on the legal side. In France for example you don't have the right to log most sensitive things. On the security side it's the same thing: the chances for an attacker to retrieve a password by server crashing are quite small, while getting his hands on the log file would be a goldmine.
Re: DConf 2016 registrations have now hit 128!
On 04/12/2016 04:11 PM, WhatMeWorry wrote: On Friday, 8 April 2016 at 22:45:38 UTC, Walter Bright wrote: On 4/8/2016 2:07 PM, Andrei Alexandrescu wrote: On 4/7/16 7:45 PM, Walter Bright wrote: 132 today! There's been quite a surge of interest recently in two items: Tesla Model 3 and DConf 2016 :o). -- Andrei Maybe next year we'll sell 136,000 tickets! How does that compare with previous years? Attendance has more than doubled this year compared to the first three editions (which were all around 60). If we subtract Sociomantic's employees we're looking at >1.5x growth. -- Andrei
Re: Blog post: PGO: Optimizing D's virtual calls
On 04/13/2016 07:34 AM, Johan Engelen wrote: Hi all, I've written an article about how I implemented profile-guided optimization (PGO) of virtual calls to direct calls (a micro-micro-optimization, expected performance gain of just a few percent if any!). I hope it's interesting for those of you who like to read about compiler internals. https://johanengelen.github.io/ldc/2016/04/13/PGO-in-LDC-virtual-calls.html It's my first programming article, please be gentle with your comments :-) cheers, Johan Noice. https://twitter.com/D_Programming/status/720236648034877440 https://www.facebook.com/dlang.org/posts/1275322695814742 https://www.reddit.com/r/programming/comments/4elfok/profile_guided_optimization_optimizing_ds_virtual/ http://hackerne.ws Andrei
Re: Any usable SIMD implementation?
Am Wed, 13 Apr 2016 04:14:48 -0700 schrieb Walter Bright: > On 4/13/2016 3:58 AM, Marco Leise wrote: > > How about this style as an alternative?: > > > > immutable bool mmx; > > immutable bool hasPopcnt; > > > > shared static this() > > { > > import gcc.builtins; > > mmx = __builtin_cpu_supports("mmx" ) > 0; > > hasPopcnt = __builtin_cpu_supports("popcnt") > 0; > > } > > > > Please do not invent an alternative interface, use the one in core.cpuid: > > http://dlang.org/phobos/core_cpuid.html#.mmx Yes, they are all @property and a substitution with direct access to the globals will work around GDC's lack of cross-module inlining. Otherwise these feature checks which might be used in hot code, are more costly than they should be. I hate when things get in the way of efficiency. :) -- Marco
Re: Beta of D language online tour
On Saturday, 9 April 2016 at 17:12:44 UTC, André wrote: Hi, After months of hard work (okay exaggerated) I'd like to announce the beta version of the D language online tour: http://tour.dlang.io/ ... One thing that you should try to run: https://developers.google.com/speed/pagespeed/insights/ on your page. that page shows where and how to fix your site for speed and better user experience. It even compress data like: Images/CSS/JS files where you can download and upload on your server. The user experience for mobile is low there, and exactly what I feel while browsing. Take a look there and try something like: @media screen and (max-width:800px) { } and @media screen and (orientation:portrait) { } For handling new behaviors on Mobile. Overall this is nice resource for D. Bubbasaur.
Re: Command line utilities for tab-separated value files
On Tuesday, 12 April 2016 at 00:50:24 UTC, Jon D wrote: Hi all, I've open sourced a set of command line utilities for manipulating tab-separated value files. They are complementary to traditional unix tools like cut, grep, etc. They're useful for manipulating large data files. I use them when prepping files for R and similar tools. These tools were part of my 'explore D' programming exercises. The tools are here: https://github.com/eBay/tsv-utils-dlang They are likely of interest primarily to people regularly working with large files, though others might find the performance benchmarks of interest as well (included in the README). I'd welcome any feedback, either on the apps or the code. Intention is that the code be reasonable example programs. And, I may write a blog post about my D explorations at some point, they'd be referenced in such an article. --Jon I rarely need TSV files, but I deal with CSV files every day. - It would be nice to test your implementation against std.csv (it can use TAB as separator). Did you try to compare the two?
Re: Dub and derelict-allegro5 "Could not find a valid dependency tree configuration"
On Wednesday, 13 April 2016 at 11:21:25 UTC, Pedro Lopes wrote: In the second paragraph I meant to say: The first library that Derelict-Allegro (not dub) looks for is called: "liballegro_image-5.0.11.so" ... I know dub has nothing to do with this at this point it already compile and linked it just couldn't execute for not finding the library. Should be fixed now in version 0.0.6. Glad to see someone is reporting issues with this binding so I can iron out the kinks. I want to give it more attention and add support for 5.2, it's just always been low on my priority list. Please post any further issues you find at the github issue tracker [1], if you don't mind. [1] https://github.com/DerelictOrg/DerelictAllegro5/issues
[Issue 15910] Prevent mismatch of VERSION information in dmd releases
https://issues.dlang.org/show_bug.cgi?id=15910 --- Comment #3 from Joseph Rushton Wakeling--- Unfortunately, the proposed workaround didn't work for me when I tried it. If when trying to build phobos I use, make -f posix.mak VERSION=2.071 then I wind up with generated library files: libphobos2.so -> libphobos2.so.0.. libphobos2.so.0. -> libphobos2.so.0.. libphobos2.so.0.. libphobos2.so.0..o ... when obviously I'd expect the names to be so.0.71.0 etc. Tweaking to e.g. VERSION=2.071.0 makes no difference, it looks like phobos' build scripts just can't handle a custom VERSION override like this. --
Re: Getting the current module as a symbol
On Wednesday, 13 April 2016 at 05:30:27 UTC, Vladimir Panteleev wrote: On Tuesday, 12 April 2016 at 13:44:07 UTC, Mithun Hunsur wrote: Hi all, I'm looking for the equivalent of `typeof(this)` in module scope (so that it gets the current module). My use-case is iterating over the members of the module - right now I'm doing `mixin(iterateOverModule!(module.name.here));` but in the interests of keeping the code simple to maintain, I'd like to be able to get the current module automatically. Is this possible? A cursory Google search didn't turn up anything, and `this` has no meaning in module scope. Have you tried __traits(parent, someTopLevelSymbol)? Walking the __traits(parent) chain should get you to a module either way, I think. Yeah, that also works; you have to define a symbol (if you don't have one you can already use) in order to get to it, so it's a little wasteful. Still useful to know, though!
Re: Dub and derelict-allegro5 "Could not find a valid dependency tree configuration"
In the second paragraph I meant to say: The first library that Derelict-Allegro (not dub) looks for is called: "liballegro_image-5.0.11.so" ... I know dub has nothing to do with this at this point it already compile and linked it just couldn't execute for not finding the library.
Re: Dub and derelict-allegro5 "Could not find a valid dependency tree configuration"
On Tuesday, 12 April 2016 at 13:01:59 UTC, Mike Parker wrote: On Tuesday, 12 April 2016 at 09:19:14 UTC, Pedro Lopes wrote: I changed the dub.sdl dependency to version 0.0.5, but dub cant recognize that version: "Root package allegrotest contains reference to invalid package derelict-allegro5 0.0.5" My fault. I forgot to 'git push --tags'. Once the dub registry picks it up, 0.0.5 should work. Thank you, initially It compiled, but then another error showed up, don't worry, Is not difficult to solve, and probably this has nothing to do with allegro. First it compiled (because I had not loaded any allegro library nor added any allegro code to my allegrotest project), whenever I tried to load the library "DerelictAllegro5.load();" the error showed up. But I know exactly what th problem is. The first library that dub looks for is called: "liballegro_image-5.0.11.so", but in my system (Arch repository allegro package) allegro's library is called:"liballegro_image.so.5.0.11" the difference lies in the extension ".so" that comes first, the version comes latter in arch. here is the error: «Linking... Running ./allegrotest derelict.util.exception.SharedLibLoadException@../../../.dub/packages/derelict-util-2.0.5/source/derelict/util/exception.d(35): Failed to load one or more shared libraries: liballegro_image-5.0.11.so - liballegro_image-5.0.11.so: cannot open shared object file: No such file or directory liballegro_image-5.0.so - liballegro_image-5.0.so: cannot open shared object file: No such file or directory ../../../.dub/packages/derelict-util-2.0.5/source/derelict/util/exception.d:66 void derelict.util.exception.SharedLibLoadException.throwNew(immutable(char)[][], immutable(char)[][]) [0x444043] ../../../.dub/packages/derelict-util-2.0.5/source/derelict/util/sharedlib.d:155 void derelict.util.sharedlib.SharedLib.load(immutable(char)[][]) [0x44392c] ../../../.dub/packages/derelict-util-2.0.5/source/derelict/util/loader.d:196 void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) [0x44155d] ../../../.dub/packages/derelict-util-2.0.5/source/derelict/util/loader.d:142 void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) [0x44145b] ../../../.dub/packages/derelict-util-2.0.5/source/derelict/util/loader.d:82 void derelict.util.loader.SharedLibLoader.load() [0x4412dd] source/app.d:20 _Dmain [0x43d297] ??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x449dde] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x449d28] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x449d9a] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x449d28] ??:? _d_run_main [0x449c99] ??:? main [0x43d77f] ??:? __libc_start_main [0xd425870f] Program exited with code 1 » If I cannot have a break, I guess I'm the bug stumbler. Sorry for the trouble.
Re: Any usable SIMD implementation?
On 4/13/2016 3:58 AM, Marco Leise wrote: How about this style as an alternative?: immutable bool mmx; immutable bool hasPopcnt; shared static this() { import gcc.builtins; mmx = __builtin_cpu_supports("mmx" ) > 0; hasPopcnt = __builtin_cpu_supports("popcnt") > 0; } Please do not invent an alternative interface, use the one in core.cpuid: http://dlang.org/phobos/core_cpuid.html#.mmx
Re: Release D 2.071.0
On Tuesday, 5 April 2016 at 22:43:05 UTC, Martin Nowak wrote: Glad to announce D 2.071.0. http://dlang.org/download.html This release fixes many long-standing issues with imports and the module system. See the changelog for more details. http://dlang.org/changelog/2.071.0.html -Martin Apologies for the delay for homebrew users, all sorted now, 2.071.0 is now dmd stable.
Re: Any usable SIMD implementation?
Am Wed, 13 Apr 2016 11:21:35 +0200 schrieb Iain Buclaw via Digitalmars-d: > Yes, cpu_supports is a good way to do it as we only need to invoke > __builtin_cpu_init once and cache all values when running 'shared > static this()'. I was under the assumption that GCC already emits an 'early' static ctor with a call to __builtin_cpu_init(). It is also likely that we don't need extra code to copy GCC's cache to core.cpuids cache (unless the cached data is publicly exposed somehow). What is your stance on the cross module inlining issue? Stuff like hasPopcnt etc. wont be inlined unless you turn them into compiler recognised builtins, right? It's not a blocker, but something to keep in mind when not accessing global variables directly. How about this style as an alternative?: immutable bool mmx; immutable bool hasPopcnt; shared static this() { import gcc.builtins; mmx = __builtin_cpu_supports("mmx" ) > 0; hasPopcnt = __builtin_cpu_supports("popcnt") > 0; } -- Marco
Re: Dynamic library
On Tuesday, 12 April 2016 at 10:11:27 UTC, Russel Winder wrote: Did you solve this problem? Does it go away using a newer JDK, e.g. 8_77? Have you tried the Oracle or Azul builds? If you have a small project you can send me that exhibits the problem for you, I can take a look at it. I could get it to work with 8_77. However, I get this message ("12" is the result I want): - 12 pure virtual method called terminate called without an active exception Aborted (core dumped) - As soon as I use any phobos relates stuff in the module, I get this error (libpthread.so is the issue): # JRE version: Java(TM) SE Runtime Environment (8.0_77-b03) (build 1.8.0_77-b03) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.77-b03 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libpthread.so.0+0x9c84] pthread_mutex_lock+0x4 I wonder is it a bug in Java?
Re: Any usable SIMD implementation?
On 13 April 2016 at 11:13, Marco Leise via Digitalmars-dwrote: > Am Wed, 13 Apr 2016 09:51:25 +0200 > schrieb Iain Buclaw via Digitalmars-d > : > >> On 13 April 2016 at 07:59, Walter Bright via Digitalmars-d >> wrote: >> > But core.cpuid needs to be made to work in GDC, whatever it takes to do so. >> > >> >> Indeed, it's been on my TODO list for a long time, among many other things. >> :-) > > Would you want to implement this in the compiler like the > checkedint functions? I guess that's the only way to guarantee > cross-module inlining with GDC. Otherwise I would use > __builtin_cpu_supports (const char *feature). (GCC practically > has its own internal core.cpuid implementation made of > intrinsics.) > > -- > Marco > Yes, cpu_supports is a good way to do it as we only need to invoke __builtin_cpu_init once and cache all values when running 'shared static this()'. I would also like to be able to support other processes too. ARM is a high priority one which should follow suit.
Re: Any usable SIMD implementation?
Am Wed, 13 Apr 2016 09:51:25 +0200 schrieb Iain Buclaw via Digitalmars-d: > On 13 April 2016 at 07:59, Walter Bright via Digitalmars-d > wrote: > > But core.cpuid needs to be made to work in GDC, whatever it takes to do so. > > > > Indeed, it's been on my TODO list for a long time, among many other things. > :-) Would you want to implement this in the compiler like the checkedint functions? I guess that's the only way to guarantee cross-module inlining with GDC. Otherwise I would use __builtin_cpu_supports (const char *feature). (GCC practically has its own internal core.cpuid implementation made of intrinsics.) -- Marco
Re: DWT Cloning / Build fails
On Tuesday, 12 April 2016 at 19:20:44 UTC, Jacob Carlborg wrote: The error messages are below. If I do it step by step (without --recursive) and then "git submodule update --init", I get more or less the same error: Cloning into 'base'... fatal: unable to connect to github.com: github.com[0: 192.30.252.130]: errno=Connection refused I use `git 2.5.0` There's always something with github, isn't there? On 2016-04-12 17:32, Chris wrote: This doesn't work: $ git clone --recursive git://github.com/d-widget-toolkit/dwt.git Error: git clone --recursive git://github.com/d-widget-toolkit/dwt.git Cloning into 'dwt'... fatal: unable to connect to github.com: github.com[0: 192.30.252.123]: errno=Connection refused $ git clone --recursive https://github.com/d-widget-toolkit/dwt.git Cloning into 'dwt'... remote: Counting objects: 119, done. remote: Total 119 (delta 0), reused 0 (delta 0), pack-reused 119 Receiving objects: 100% (119/119), 75.20 KiB | 0 bytes/s, done. Resolving deltas: 100% (54/54), done. Checking connectivity... done. Submodule 'base' (git://github.com/d-widget-toolkit/base.git) registered for path 'base' Submodule 'org.eclipse.swt.gtk.linux.x86' (git://github.com/d-widget-toolkit/org.eclipse.swt.gtk.linux.x86.git) registered for path 'org.eclipse.swt.gtk.linux.x86' Submodule 'org.eclipse.swt.snippets' (git://github.com/d-widget-toolkit/org.eclipse.swt.snippets.git) registered for path 'org.eclipse.swt.snippets' Submodule 'org.eclipse.swt.win32.win32.x86' (git://github.com/d-widget-toolkit/org.eclipse.swt.win32.win32.x86.git) registered for path 'org.eclipse.swt.win32.win32.x86' Cloning into 'base'... fatal: unable to connect to github.com: github.com[0: 192.30.252.123]: errno=Connection refused
Re: I want this so badly, please implement
On Tuesday, 12 April 2016 at 14:35:25 UTC, Adam D. Ruppe wrote: Of course, these can be filtered out of an error log... but with the file upload, wouldn't it be nice to know where the error occurred so you can filter around it? If you have the file, there's no need for overly smart logging and filtering. You can just reproduce the whole scenario. I'm just gonna fork the language eventually. A compiler option would be probably less intrusive :)
Re: I want this so badly, please implement
On Tuesday, 12 April 2016 at 08:51:23 UTC, Kapps wrote: Amongst other things, you'd log sensitive data like passwords, which should never be stored anywhere in plain text, including log files. This is one of the reasons to not use GET for anything sensitive. With Adam's idea sensitive data can still accidentally leak into this extended diagnostic mechanism.
[Issue 15920] New: std.traits.MemberFunctionsTuple gives a wrong result
https://issues.dlang.org/show_bug.cgi?id=15920 Issue ID: 15920 Summary: std.traits.MemberFunctionsTuple gives a wrong result Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: goldmax3...@gmail.com module start; import std.traits; import std.typetuple; class A { void f(){} void f(int){} } class B : A { override void f(){} override void f(int){} } pragma(msg, staticMap!(fullyQualifiedName, MemberFunctionsTuple!(B,"f"))); prints tuple("start.B.f", "start.A.f") --
[Issue 15919] Undetected spell miss in ndslice.selection.reshape()
https://issues.dlang.org/show_bug.cgi?id=15919 greenifychanged: What|Removed |Added CC||greeen...@gmail.com --- Comment #1 from greenify --- Development for Ndslice happens at mir.dlang.io - you probably want to open your bug there ;-) --
[Issue 15898] [REG2.069] Internal error: backend\cgcod.c 1651
https://issues.dlang.org/show_bug.cgi?id=15898 Walter Brightchanged: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #2 from Walter Bright --- https://github.com/D-Programming-Language/dmd/pull/5656 --
Re: Any usable SIMD implementation?
On 13 April 2016 at 08:22, Walter Bright via Digitalmars-dwrote: > On 4/12/2016 4:29 PM, Marco Leise wrote: >> In practice GDC will just replace the invokation with a single >> 'mul' instruction while DMD will emit a call to this 18 >> instructions long function. Now you keep telling me extended >> assembly is a step backwards. :) > > > DMD version: > > DblWord bigMul(ulong x, ulong y) { > naked asm { >mov RAX,RDI; >mul RSI; >ret; > } > } > Infact the "correct" version of "mul eax" is. asm { "mul{l} {%%}eax" : "=a" var : "a" var; } - Works with both dialects (Intel and ATT) - Compiler knows the first register ("a") is read and written to, so doesn't keep temporaries stored there. - Compiler loads the variable "var" into EAX before the statement is executed. - Compiler knows that the value of "var" in EAX after the statement is finished. http://goo.gl/64SSD5 Just toggle on/off intel syntax to see the difference. :-) I can agree that the way that instruction (or insn) templates look are pretty ugly. But IMO, for the most part on x86 their ugliness is attributed to having to support two types of assembler syntax at once.
Re: Any usable SIMD implementation?
On 13 April 2016 at 07:59, Walter Bright via Digitalmars-dwrote: > On 4/12/2016 4:35 PM, Iain Buclaw via Digitalmars-d wrote: >> - What dialect am I writing in? (Do I emit mul or mull? eax or %eax?) >> - Some opcodes in IASM have a different name in the assembler (Emitted >> fdivrp as fdivp, and fdivp as fdivrp. No idea why but I recall >> std.math didn't work without the translation). > > > DMD's iasm uses the opcodes as written in the Intel CPU manuals. There is no > MULL opcode in the manual, so no MULL in DMD's iasm. It figures out which > opcode by looking at the operands, using the Intel CPU manual as a guide. > > It's a bit of a pain as there are a lot of special cases, but the end result > is pretty straightforward if you're using the Intel CPU manual as a > reference guide. > My only point was that in GDC, the translation of opcodes to machine code is done in two steps by two separate processes, rather than one. DMD is proof that the benefit of having unified syntax is a big win. >> - Some opcodes are actually directives in disguise (db, ds, dw, ...) >> - Frame-relative addressing/displacement of a symbol before the >> backend has decided where incoming parameters will land is a good way >> to get hit by a truck. >> - GCC backend doesn't support naked functions on x86. >> - Or even in the sense that DMD supports naked functions where there >> is support (only plain text assembler allowed) >> - Want to support ARM? MIPS? PPC? At the time when GDC supported >> DMD-style IASM for x86, the implementation was over 3000 LOC, adding >> platform support just looked like an unmanageable nightmare. > > > I understand that GDC has special challenges because it writes to an > assembler rather than direct to object code. I understand it is not easy to > replicate DMD's iasm functionality. Which is why I haven't given you a hard > time about it :-) and it is not terribly important. > > But core.cpuid needs to be made to work in GDC, whatever it takes to do so. > Indeed, it's been on my TODO list for a long time, among many other things. :-) > > > Personally, I strongly dislike the fact that the GAS syntax is the reverse > of Intel's. It isn't just GAS, it's GDB and everything else. It just sux. It > makes my eyeballs hurt looking at it. It's like giving me a car with the > brake and gas pedals reversed. Nothing but accidents result :-) And I don't > like that they use different opcodes than the Intel manuals. That just sux, > too. > Like riding a backwards bicycle. :-) https://www.youtube.com/watch?v=MFzDaBzBlL0 > But I know that the GNU world is stuck with that, and GDC should behave like > the rest of GCC. > Yeah, and I'm glad that you do.
Re: Swiss Ephemeris / Nelder-Mead simplex
very nice post.. waleeed
Re: Beta of D language online tour
On Monday, 11 April 2016 at 20:27:38 UTC, Mark Isaacson wrote: Still awesome! Good work. An easy(?) suggestion that would make this easier to browse: make the left/right arrow keys control advancing to the next page. That should be fairly easy. Added an issue on GitHub for that: https://github.com/stonemaster/dlang-tour/issues/31 Thanks & regards, André
Re: Any usable SIMD implementation?
On 4/12/2016 4:29 PM, Marco Leise wrote: Am Tue, 12 Apr 2016 13:22:12 -0700 schrieb Walter Bright: On 4/12/2016 9:53 AM, Marco Leise wrote: LDC implements InlineAsm_X86_Any (DMD style asm), so core.cpuid works. GDC is the only compiler that does not implement it. We agree that core.cpuid should provide this information, but what we have now - core.cpuid in a mix with GDC's lack of DMD style asm - does not work in practice for the years to come. Years? Anyone who needs core.cpuid could translate it to GDC's inline asm style in an hour or so. It could even be simply written separately in GAS and linked in. Since this has not been done, I can only conclude that core.cpuid has not been an actual blocker. You mean it is ok, if I duplicated most of the asm in there and created a pull request ? It's Boost licensed, and Boost licensed code can be shipped with GPL'd code as far as I know. "mulq %[y]" : "=a" tmp.lo, "=d" tmp.hi : "a" x, [y] "rm" y; I don't see anything elegant about those lines, starting with "mulq" is not in any of the AMD or Intel CPU manuals. The assembler should notice that 'y' is a ulong and select the 64 bit version of the MUL opcode automatically. I can see nothing to recommend the: "=a" tmp.lo syntax. How about something comprehensible like "tmp.lo = EAX"? I bet people could even figure that out without consulting stackoverflow! :-) I have no idea what: "a" x and: [y] "rm" y mean, nor why the ":" appears sometimes and the "," other times. It does look like it was designed by the same guy who invented TECO macros: https://www.reddit.com/r/programming/comments/4e07lo/last_night_in_a_fit_of_boredom_far_away_from_my/d1xlbh7 but that's not much of a compliment. In practice GDC will just replace the invokation with a single 'mul' instruction while DMD will emit a call to this 18 instructions long function. Now you keep telling me extended assembly is a step backwards. :) DMD version: DblWord bigMul(ulong x, ulong y) { naked asm { mov RAX,RDI; mul RSI; ret; } } GCC's inline assembler apparently has no knowledge of what the opcodes actually do. Agreed. This is the basis of my assertion it is a step backwards. Granted, it has some nice capability as you've demonstrated. But it sure makes you suffer to get it.
Re: Any usable SIMD implementation?
On 4/12/2016 4:35 PM, Iain Buclaw via Digitalmars-d wrote: It's a step backwards because I can't just say "MUL EAX". I have to tell GCC what register the result gets put in. This is, to my mind, ridiculous. GCC's inline assembler apparently has no knowledge of what the opcodes actually do. asm { "mul eax"; } - That wasn't so difficult. :-) My understanding is that is not sufficient if you want gcc to track register usage, etc. I could be wrong, I found the documentation on how the gcc inline assembler works to be impossible to figure out what was required and what wasn't. I'd just look at existing examples and modify to suit :-( I don't know if D data and calling functions from DMD-IASM is safe I don't know what you mean by 'safe' in this context. If you follow the ABI it should work. (it is in GDC extended IASM). But I have always chosen the path that requires the least amount of maintenance burden/overhead. And I'm sorry to say that supporting GCC-style extended assembler both comes for free (handling is managed by the middle-end), and requires no platform-specific support on the language implementation side. Your decision makes sense. However, I have always considered comparing the two a bit like apples and oranges. DMD compiles to object code, so it makes sense to me that you have an entire assembler embedded in. However GDC compiles to assembly, and I expect that GNU As will know a lot more about what opcodes actually do on, say a Motorola 68k, than the poor mans parser I would be able to write. There were a lot of challenges supporting DMD-style IASM, all non-existent in DMD. Drawing a list off the top of my head - I'll let you decide whether IASM is pro or con in this area, but again bear in mind that DMD doesn't have to deal with calling an external assembler. - What dialect am I writing in? (Do I emit mul or mull? eax or %eax?) - Some opcodes in IASM have a different name in the assembler (Emitted fdivrp as fdivp, and fdivp as fdivrp. No idea why but I recall std.math didn't work without the translation). DMD's iasm uses the opcodes as written in the Intel CPU manuals. There is no MULL opcode in the manual, so no MULL in DMD's iasm. It figures out which opcode by looking at the operands, using the Intel CPU manual as a guide. It's a bit of a pain as there are a lot of special cases, but the end result is pretty straightforward if you're using the Intel CPU manual as a reference guide. - Some opcodes are actually directives in disguise (db, ds, dw, ...) - Frame-relative addressing/displacement of a symbol before the backend has decided where incoming parameters will land is a good way to get hit by a truck. - GCC backend doesn't support naked functions on x86. - Or even in the sense that DMD supports naked functions where there is support (only plain text assembler allowed) - Want to support ARM? MIPS? PPC? At the time when GDC supported DMD-style IASM for x86, the implementation was over 3000 LOC, adding platform support just looked like an unmanageable nightmare. I understand that GDC has special challenges because it writes to an assembler rather than direct to object code. I understand it is not easy to replicate DMD's iasm functionality. Which is why I haven't given you a hard time about it :-) and it is not terribly important. But core.cpuid needs to be made to work in GDC, whatever it takes to do so. Personally, I strongly dislike the fact that the GAS syntax is the reverse of Intel's. It isn't just GAS, it's GDB and everything else. It just sux. It makes my eyeballs hurt looking at it. It's like giving me a car with the brake and gas pedals reversed. Nothing but accidents result :-) And I don't like that they use different opcodes than the Intel manuals. That just sux, too. But I know that the GNU world is stuck with that, and GDC should behave like the rest of GCC.