Re: Get all files imported by a D source file

2016-09-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-08 07:39, Yuxuan Shui wrote: Hi, I wonder if there's standardized way to gather which files are imported by a source file. I know I can run "dmd -v" and look for lines start with "import", but I don't know if this is the best way to do it. You can use the "-deps" flag. -- /Jacob Ca

Get all files imported by a D source file

2016-09-07 Thread Yuxuan Shui via Digitalmars-d-learn
Hi, I wonder if there's standardized way to gather which files are imported by a source file. I know I can run "dmd -v" and look for lines start with "import", but I don't know if this is the best way to do it.

Re: Performance issue with GC

2016-09-07 Thread Yuxuan Shui via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 22:54:14 UTC, Basile B. wrote: On Wednesday, 7 September 2016 at 21:20:30 UTC, Yuxuan Shui wrote: I have a little data processing program which makes heavy use of associative arrays, and GC almost doubles the runtime of it (~2m with GC disabled -> ~4m). I jus

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:41:20 UTC, data pulverizer wrote: Yes, but from a usability point of view this would be very poor - forcing the user to create a new variable each time they modified a table. I am aware that databases do this but it is hidden away. To be fair, you can

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:33:25 UTC, pineapple wrote: Fuck it, I took an hour to document the most significant modules. https://github.com/pineapplemachine/mach.d/tree/master/mach/range Looks like a step in the right direction!

Re: Performance issue with GC

2016-09-07 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:20:30 UTC, Yuxuan Shui wrote: I have a little data processing program which makes heavy use of associative arrays, and GC almost doubles the runtime of it (~2m with GC disabled -> ~4m). I just want to ask what's the best practice in this situation? Do I ju

Re: Templates problem

2016-09-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 22:11:05 UTC, data pulverizer wrote: On Wednesday, 7 September 2016 at 20:57:15 UTC, bachmeier wrote: I too come from the R world and I have been playing the game of flitting between R and C++; using C++ (through RCpp) to speed up slow things in R for some time

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:57:15 UTC, bachmeier wrote: I too come from the R world and I have been playing the game of flitting between R and C++; using C++ (through RCpp) to speed up slow things in R for some time and I have been looking for a better solution. What are you doing wi

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:25:30 UTC, jmh530 wrote: Consider a potential use case. You have an existing data frame and you want to add a column of data to it that has a different type than the existing frame. I imagine the function call would look something like: auto newFrame = oldF

Re: Templates problem

2016-09-07 Thread pineapple via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:29:42 UTC, jmh530 wrote: Thanks for the reply. It looks like an interesting idea. You might consider adding this (or a modified version) to a read me in the range subfolder. Fuck it, I took an hour to document the most significant modules. https://github.c

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:49:42 UTC, data pulverizer wrote: You're quite right that D doesn't need to change at all to implement something like pandas or dataframes in R, but I am thinking of how to got further. Very often in data science applications types will turn up that are re

Performance issue with GC

2016-09-07 Thread Yuxuan Shui via Digitalmars-d-learn
I have a little data processing program which makes heavy use of associative arrays, and GC almost doubles the runtime of it (~2m with GC disabled -> ~4m). I just want to ask what's the best practice in this situation? Do I just use GC.disable and manually run GC.collect periodically?

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:07:20 UTC, data pulverizer wrote: Don't get me wrong, I still think Julia is a very cool language. My opinion is that we should have more languages. Let me correct myself ... I think that hyper-meta-programming as in Sparrow could certainly revolutionize co

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:01:59 UTC, deXtoRious wrote: That's just typical press nonsense, and even they quote Bezanson saying how Julia isn't at all suited to a whole host of applications. Julia certainly has (justifiable, imho, though only time will tell) aspirations of being use

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:01:59 UTC, deXtoRious wrote: That's just typical press nonsense, and even they quote Bezanson saying how Julia isn't at all suited to a whole host of applications. Julia certainly has (justifiable, imho, though only time will tell) ... Don't get me wrong,

Re: Templates problem

2016-09-07 Thread deXtoRious via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:57:03 UTC, data pulverizer wrote: On Wednesday, 7 September 2016 at 20:29:51 UTC, deXtoRious wrote: On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer wrote: The "One language to rule them all" motif of Julia has hit the rocks; one reason is bec

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:57:15 UTC, bachmeier wrote: What are you doing with Rcpp that you can't do with D? That's a very good point, there's nothing that R + C++ can do that is out of D's reach. But, I wander if we can go further

Re: Templates problem

2016-09-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer wrote: On Wednesday, 7 September 2016 at 15:04:38 UTC, jmh530 wrote: On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder wrote: I really don't see what's not working in this. Trying to get new D users from Python user

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:29:51 UTC, deXtoRious wrote: On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer wrote: The "One language to rule them all" motif of Julia has hit the rocks; one reason is because they now realize that their language is being held back because th

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:37:50 UTC, jmh530 wrote: On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer I don't see any reason why D can't implement pandas DataFrames without needing to change the language at all http://pandas.pydata.org/pandas-docs/stable/generated/pandas

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:37:50 UTC, jmh530 wrote: On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer wrote: For some time I have been considering a problem to do with creating tables with unbounded types, one of the failed attempts is here: https://forum.dlang.org/th

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer wrote: For some time I have been considering a problem to do with creating tables with unbounded types, one of the failed attempts is here: https://forum.dlang.org/thread/gdjaoxypicsxlfvzw...@forum.dlang.org?page=1 I then exchang

Re: Templates problem

2016-09-07 Thread deXtoRious via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer wrote: The "One language to rule them all" motif of Julia has hit the rocks; one reason is because they now realize that their language is being held back because the compiler cannot infer certain types for example: http://www.joh

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 18:55:41 UTC, pineapple wrote: So the first difference you're likely to notice is that it's not as well documented. (Sorry. I'm a busy woman. I'll get around to it.) I try to make up for it with copious unit tests, which should provide a good example for how

Re: VisualD core.exception.RangeError@pipedmd(286): Range violation

2016-09-07 Thread Rainer Schuetze via Digitalmars-d-learn
On 07.09.2016 19:28, Rainer Schuetze wrote: On 06.09.2016 06:38, Tofu Ninja wrote: I get "core.exception.RangeError@pipedmd(286): Range violation" whenever I try to build from visual D. Is there any workaround for this? It was reported[1] almost 9 months ago, does not seem like it's going t

Re: Templates problem

2016-09-07 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 15:04:38 UTC, jmh530 wrote: On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder wrote: I really don't see what's not working in this. Trying to get new D users from Python users is the main problem. I came to D from Python/R/Matlab. The bigges

Re: Templates problem

2016-09-07 Thread pineapple via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 18:22:39 UTC, jmh530 wrote: On Wednesday, 7 September 2016 at 18:10:45 UTC, pineapple wrote: You might want to check out the ranges package of the library I'm working on. https://github.com/pineapplemachine/mach.d/tree/master/mach/range There's a lot of s

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 18:10:45 UTC, pineapple wrote: You might want to check out the ranges package of the library I'm working on. https://github.com/pineapplemachine/mach.d/tree/master/mach/range There's a lot of stuff there. Do you mind giving a TL;DR version of what your ra

Re: Templates problem

2016-09-07 Thread pineapple via Digitalmars-d-learn
On Tuesday, 6 September 2016 at 14:38:54 UTC, Russel Winder wrote: and I have no idea just now why it is complaining, nor what to do to fix it. You might want to check out the ranges package of the library I'm working on. https://github.com/pineapplemachine/mach.d/tree/master/mach/range Thi

Re: Unicode function name? ∩

2016-09-07 Thread Illuminati via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 07:39:53 UTC, Jesper Tholstrup wrote: On Tuesday, 6 September 2016 at 20:26:01 UTC, Illuminati wrote: Ok, continue your game I see you are quite involved with it. For what it's worth I was actually trying to learn something. I apologize if I contributed

Re: VisualD core.exception.RangeError@pipedmd(286): Range violation

2016-09-07 Thread Rainer Schuetze via Digitalmars-d-learn
On 06.09.2016 06:38, Tofu Ninja wrote: I get "core.exception.RangeError@pipedmd(286): Range violation" whenever I try to build from visual D. Is there any workaround for this? It was reported[1] almost 9 months ago, does not seem like it's going to be fixed anytime soon. Visual D is completely

forwarding build type to dependencies with dub

2016-09-07 Thread Johannes Loher via Digitalmars-d-learn
Is it possible to forward the build type to the dependencies of a dub project? For example, if I build my project with dub build -b unittest is it possible to make dub build the dependencies of my project also with the unittest build type? Even better would be a way to specify for which dependenc

Re: Templates problem

2016-09-07 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder wrote: The real problem though is the terrifying error message. I am having a hard time finding a way of pitching them to Pythonistas. Do they use single assignment a lot?

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder wrote: I really don't see what's not working in this. Trying to get new D users from Python users is the main problem. I came to D from Python/R/Matlab. The biggest issue for me wasn't error messages so much as the lack of good

Re: Templates problem

2016-09-07 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder wrote: I'd prefer immutable, but const sometimes has to do. The idea is to find out how to enforce single assignment in D. Everything depends on what you mean by "single assignment". If you mean "I can't use opAssign", then const is

Re: Templates problem

2016-09-07 Thread ketmar via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 11:33:08 UTC, Russel Winder wrote: C++, error messages sorry, i loled hard.

Re: Templates problem

2016-09-07 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2016-09-07 at 09:04 +, Lodovico Giaretta via Digitalmars-d- learn wrote: > […] > You have your const fixed-length array. You slice it and you  > obtain a const range to feed map. Now map will not return you an  > array. Because most of the time you don't need it. It will return  > you

Re: Templates problem

2016-09-07 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2016-09-07 at 09:03 +, ketmar via Digitalmars-d-learn wrote: > […] > > alas, no jokes here. within the current D sytnax there is simply  > no way to make that error less cryptic. :-( Well that will be the end of any traction for D then. C++, Java, Groovy, etc. error messages prove tha

Re: Templates problem

2016-09-07 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2016-09-07 at 20:32 +1200, rikki cattermole via Digitalmars-d- learn wrote: > […] > Ok, I have it mostly compiling. > > void run_mean() {} > void run_mode() {} > void run_stdDev() {} For my code the functions have to be declared within the main function rather than being at module level.

Re: Templates problem

2016-09-07 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2016-09-07 at 08:42 +, Kagamin via Digitalmars-d-learn wrote: > https://dpaste.dzfl.pl/0b436b240e3c But now try adding the writeln function. Then you get the errors. -- Russel. = Dr Russel Winder t: +44

Re: Templates problem

2016-09-07 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 08:19:39 UTC, Russel Winder wrote: On Tue, 2016-09-06 at 14:50 +, Lodovico Giaretta via Digitalmars-d- learn wrote: […]  From a quick look, it looks like `results` is a `const(TickDuration[3])`, that is a fixed-length array. And fixed-length arrays aren'

Re: Templates problem

2016-09-07 Thread ketmar via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 08:30:51 UTC, Russel Winder wrote: On Tue, 2016-09-06 at 14:53 +, ketmar via Digitalmars-d-learn wrote: […] exactly. static arrays doesn't have `popFront`, hence `isInputRange` fails. yet there is no way to tell that to user, so one should just learn wha

Re: UFCS not working with alias

2016-09-07 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 08:35:26 UTC, rikki cattermole wrote: On 07/09/2016 8:26 PM, Andre Pany wrote: [...] People have tried, this is the behavior as designed. The workaround is simple, don't use UFCS. I won't repeat the explanation or reasoning here, plenty of posts on it ;)

Re: Templates problem

2016-09-07 Thread Kagamin via Digitalmars-d-learn
https://dpaste.dzfl.pl/0b436b240e3c

Re: UFCS not working with alias

2016-09-07 Thread rikki cattermole via Digitalmars-d-learn
On 07/09/2016 8:26 PM, Andre Pany wrote: On Wednesday, 7 September 2016 at 08:08:34 UTC, rikki cattermole wrote: On 07/09/2016 8:06 PM, Andre Pany wrote: Should I open an enhancement request? No. It works outside of the function (part of lookup rules). I simplified my example too much. Yes

Re: Templates problem

2016-09-07 Thread rikki cattermole via Digitalmars-d-learn
On 07/09/2016 2:38 AM, Russel Winder via Digitalmars-d-learn wrote: The code fragment: const results = benchmark!(run_mean, run_mode, run_stdDev)(1); const times = map!((TickDuration t) { return (to!Duration(t)).total!"seconds"; })(results); seems entirely reasonable to me. How

Re: Templates problem

2016-09-07 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2016-09-06 at 14:53 +, ketmar via Digitalmars-d-learn wrote: > […] > exactly. static arrays doesn't have `popFront`, hence  > `isInputRange` fails. yet there is no way to tell that to user,  > so one should just learn what those cryptic error messages really  > means. I shall assume a

Re: UFCS not working with alias

2016-09-07 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 08:08:34 UTC, rikki cattermole wrote: On 07/09/2016 8:06 PM, Andre Pany wrote: Should I open an enhancement request? No. It works outside of the function (part of lookup rules). I simplified my example too much. Yes in the example above I can move the alia

Re: Templates problem

2016-09-07 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2016-09-06 at 14:50 +, Lodovico Giaretta via Digitalmars-d- learn wrote: > […] >  From a quick look, it looks like `results` is a  > `const(TickDuration[3])`, that is a fixed-length array. And  > fixed-length arrays aren't ranges. If you explicitly slice them,  > they become dynamic ar

Re: UFCS not working with alias

2016-09-07 Thread rikki cattermole via Digitalmars-d-learn
On 07/09/2016 8:06 PM, Andre Pany wrote: Should I open an enhancement request? No. It works outside of the function (part of lookup rules).

UFCS not working with alias

2016-09-07 Thread Andre Pany via Digitalmars-d-learn
Hi, I just noticed ufcs does not work with alias. Is this limitation needed? void foo(int a) {} void main() { alias bar = foo; 3.foo(); 3.bar(); } Last line fails with "no property 'bar' for type int. Should I open an enhancement request? Kind regards André

Re: Unicode function name? ∩

2016-09-07 Thread Jesper Tholstrup via Digitalmars-d-learn
On Tuesday, 6 September 2016 at 20:26:01 UTC, Illuminati wrote: Ok, continue your game I see you are quite involved with it. For what it's worth I was actually trying to learn something. I apologize if I contributed to sidetracking the discussion.