Re: DUB 0.9.20

2013-12-08 Thread Jacob Carlborg
On 2013-12-06 22:55, Mathias Lang wrote: Did you ever consider letting users add their own recipe (in Makefile terminology). ie, let them extend dub the same way you can extend git: one would put a bash / D / FancyScriptLanguage script under [~/].dub/whatever/deploy, and calling dub deploy

Re: derelict_extras-lua

2013-12-08 Thread Kelet
On Monday, 2 December 2013 at 03:32:52 UTC, Kelet wrote: Hello all, I am new to the D community, although I've been a lurker for years, and have only recently started embracing the language. As I understand, Derelict3[1] is migrating to separate bindings in DerelictOrg[2]. This will help

Re: derelict_extras-lua

2013-12-08 Thread qznc
On Sunday, 8 December 2013 at 17:12:06 UTC, Kelet wrote: On Monday, 2 December 2013 at 03:32:52 UTC, Kelet wrote: I am aware of Jakob Ovrum's most excellent Lua binding and wrapper[5] and recommend that anyone considering using D with Lua checks it out. What is the reason you picked

Re: How do you deal with scoped allocations?

2013-12-08 Thread Dmitry Olshansky
08-Dec-2013 02:32, Namespace пишет: Since my last thread doesn't get much attention I like to ask here: How did you deal with temporary memory? Let's assume that the size is only known at runtime. I have this situation e.g. in Dgame in the capture method: I get the pixel data from my Window with

Re: How do you deal with scoped allocations?

2013-12-08 Thread John Colvin
On Saturday, 7 December 2013 at 22:32:59 UTC, Namespace wrote: Since my last thread doesn't get much attention I like to ask here: How did you deal with temporary memory? Let's assume that the size is only known at runtime. I have this situation e.g. in Dgame in the capture method: I get the

Re: How do you deal with scoped allocations?

2013-12-08 Thread Namespace
On Sunday, 8 December 2013 at 00:17:48 UTC, Adam D. Ruppe wrote: On Sunday, 8 December 2013 at 00:16:46 UTC, Adam D. Ruppe wrote: the same general pattern there of static array up to a certain size. static array being T[max_size], not static T[max_size] just so it uses the stack for most

Re: How do you deal with scoped allocations?

2013-12-08 Thread Namespace
On Sunday, 8 December 2013 at 09:14:44 UTC, Dmitry Olshansky wrote: 08-Dec-2013 02:32, Namespace пишет: Since my last thread doesn't get much attention I like to ask here: How did you deal with temporary memory? Let's assume that the size is only known at runtime. I have this situation e.g.

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Timon Gehr
On 12/08/2013 06:35 AM, H. S. Teoh wrote: ... Or maybe this is just another one of those cultural old age indicators? Has the term refactoring shifted to mean variable renaming among the younger coders these days? Genuine question. I'm baffled that these two things could even remotely be

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread John Colvin
On Sunday, 8 December 2013 at 05:27:12 UTC, H. S. Teoh wrote: Once I hacked up a script (well, a little D program :P) that disassembles D executables and builds a reference graph of its symbols. Do you still have that somewhere? I've never attempted such a thing and would like to see what it

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 06:25, H. S. Teoh wrote: Yeah, this part bothers me too. Once I hacked up a script (well, a little D program :P) that disassembles D executables and builds a reference graph of its symbols. I ran this on a few small test programs, and was quite dismayed to discover that the mere act

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 01:46, Manu wrote: True as compared to C, but I wouldn't say this is true in general. Let's give praise where praise is due -- with D, the ease of refactoring is _entirely_ down to the language. You get it without needing an IDE to support you. It's a very impressive

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Araq
On Friday, 6 December 2013 at 22:20:19 UTC, Walter Bright wrote: there is no way proper C code can be slower than those languages. -- http://www.reddit.com/r/programming/comments/1s5ze3/benchmarking_d_vs_go_vs_erlang_vs_c_for_mqtt/cduwwoy comes up now and then. I think it's incorrect, D

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread John Colvin
On Sunday, 8 December 2013 at 10:11:20 UTC, Joseph Rushton Wakeling wrote: On 08/12/13 06:25, H. S. Teoh wrote: Yeah, this part bothers me too. Once I hacked up a script (well, a little D program :P) that disassembles D executables and builds a reference graph of its symbols. I ran this on a

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 11:24, John Colvin wrote: std.stdio - std.algorithm - std.random - std.numeric - std.complex. I'd forgotten that std.algorithm pulled in std.random. Glancing through, I'm not sure it uses it apart from for unittests? So it might be possible to strip out the dependency ... I'll

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread John Colvin
On Sunday, 8 December 2013 at 10:31:49 UTC, Joseph Rushton Wakeling wrote: On 08/12/13 11:24, John Colvin wrote: std.stdio - std.algorithm - std.random - std.numeric - std.complex. I'd forgotten that std.algorithm pulled in std.random. Glancing through, I'm not sure it uses it apart from

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread John Colvin
On Sunday, 8 December 2013 at 10:13:58 UTC, Araq wrote: On Friday, 6 December 2013 at 22:20:19 UTC, Walter Bright wrote: there is no way proper C code can be slower than those languages. --

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 11:34, John Colvin wrote: This was just from a quick grepping session. I'm sure there are other paths from std.stdio to std.complex. You should run DGraph on it :p Nice thought, must get round to it :-)

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 11:31, Joseph Rushton Wakeling wrote: I'd forgotten that std.algorithm pulled in std.random. Glancing through, I'm not sure it uses it apart from for unittests? On closer look, it's used for std.algorithm.topN. I guess it could be relegated to being imported inside that function

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread bearophile
Araq: Interestingly, things that are encouraged in Ada (this is an array of integers of range 0..30, see value range propagation) are much harder to recompute with whole program optimization and D lacks them. I am currently thinking about related topics. What do you mean? I don't

Re: Lambda syntax for methods and functions

2013-12-08 Thread bearophile
The relative Reddit thread explains another small feature of the next C#: http://www.reddit.com/r/programming/comments/1sbkxl/a_quick_highlight_of_upcoming_c_language_changes/cdwedrh If I understand that, it's similar to allowing D code like this: bool foo(out int x) { x = 10;

Re: How do you deal with scoped allocations?

2013-12-08 Thread John Colvin
On Sunday, 8 December 2013 at 09:25:41 UTC, Namespace wrote: On Sunday, 8 December 2013 at 09:14:44 UTC, Dmitry Olshansky wrote: 08-Dec-2013 02:32, Namespace пишет: Since my last thread doesn't get much attention I like to ask here: How did you deal with temporary memory? Let's assume that the

Re: How do you deal with scoped allocations?

2013-12-08 Thread Dmitry Olshansky
08-Dec-2013 13:25, Namespace пишет: On Sunday, 8 December 2013 at 09:14:44 UTC, Dmitry Olshansky wrote: 08-Dec-2013 02:32, Namespace пишет: [snip] And what do you use? Because it's more D'ish. There is no such objective quality as being D'ish. GC.malloc/GC.free are no better then

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread ponce
I work all day with C++ optimization and deal closely with the Intel compiler, here is what I have to say. I agree with all points but I think 1, 3 and 7 are slightly innacurate. 1. D knows when data is immutable. C has to always make worst case assumptions, and assume indirectly accessed

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread ponce
And I agree that all these points are not very important anyway since a D program will usually be so much faster to make and to refactor anyway.

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 13:35, ponce wrote: I work all day with C++ optimization and deal closely with the Intel compiler, here is what I have to say. I agree with all points but I think 1, 3 and 7 are slightly innacurate. How is icc doing these days? I used it years ago (almost 10 years ago!) when it

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread ponce
On Sunday, 8 December 2013 at 13:00:26 UTC, Joseph Rushton Wakeling wrote: How is icc doing these days? I used it years ago (almost 10 years ago!) when it produced significantly faster executables than gcc, but I had the impression that more recent gcc releases either matched its performance

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Araq
How does a coding convention allow you to create a high-performance regex engine at compile time? How does it allow you to do pretty much any of what CTFE can do? Well you can always pretend the output of re2c or flex was your hand-written C code. ;-) But sure, code conventions is not the

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Araq
On Sunday, 8 December 2013 at 11:17:15 UTC, bearophile wrote: Araq: Interestingly, things that are encouraged in Ada (this is an array of integers of range 0..30, see value range propagation) are much harder to recompute with whole program optimization and D lacks them. I am currently

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread John Colvin
On Sunday, 8 December 2013 at 13:02:56 UTC, ponce wrote: On Sunday, 8 December 2013 at 13:00:26 UTC, Joseph Rushton Wakeling wrote: How is icc doing these days? I used it years ago (almost 10 years ago!) when it produced significantly faster executables than gcc, but I had the impression that

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread qznc
On Sunday, 8 December 2013 at 12:35:45 UTC, ponce wrote: 1. D knows when data is immutable. C has to always make worst case assumptions, and assume indirectly accessed data mutates. ICC (and other C++ compilers) has plenty of way to disambiguate aliasing: - a pragma to let the optimizer

Re: How do you deal with scoped allocations?

2013-12-08 Thread Andrei Alexandrescu
On 12/8/13 4:29 AM, Dmitry Olshansky wrote: 08-Dec-2013 13:25, Namespace пишет: On Sunday, 8 December 2013 at 09:14:44 UTC, Dmitry Olshansky wrote: 08-Dec-2013 02:32, Namespace пишет: [snip] And what do you use? Because it's more D'ish. There is no such objective quality as being D'ish.

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread H. S. Teoh
On Sun, Dec 08, 2013 at 10:30:37AM +0100, Timon Gehr wrote: On 12/08/2013 06:35 AM, H. S. Teoh wrote: ... Or maybe this is just another one of those cultural old age indicators? Has the term refactoring shifted to mean variable renaming among the younger coders these days? Genuine

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Timon Gehr
On 12/08/2013 04:37 PM, H. S. Teoh wrote: On Sun, Dec 08, 2013 at 10:30:37AM +0100, Timon Gehr wrote: On 12/08/2013 06:35 AM, H. S. Teoh wrote: ... Or maybe this is just another one of those cultural old age indicators? Has the term refactoring shifted to mean variable renaming among the

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Timon Gehr
On 12/08/2013 03:13 PM, Araq wrote: On Sunday, 8 December 2013 at 11:17:15 UTC, bearophile wrote: Araq: Interestingly, things that are encouraged in Ada (this is an array of integers of range 0..30, see value range propagation) are much harder to recompute with whole program optimization and

Re: Publication of the French traduction on ddili

2013-12-08 Thread Philippe Sigaud
First, kudos for translating all this! I'm sure that'll be a good reference and maybe pave the way for other translations (Spanish, German Japanese come to mind). I have a few questions: - why did you use this whata! language instead of a standard format, like markdown or even ddoc? At least

Re: Lambda syntax for methods and functions

2013-12-08 Thread Jesse Phillips
On Sunday, 8 December 2013 at 06:58:59 UTC, Marco Leise wrote: But the verbose D syntax is just too distracting: bool function(T a, T b) { return a b; }) I think you mean the verbose D syntax: (a, b) { return a b; }

Re: HTOD: Low hanging fruit

2013-12-08 Thread Jacob Carlborg
On 2013-12-07 18:53, Andre wrote: If DStep is the prefered solution would it be possible to also provide a pre compiled binary for windows? This would make DStep more user friendly. = Just trying to find out what is needed to compile DStep on a windows machine, whether I need mambo/tango/s.th.

Re: How do you deal with scoped allocations?

2013-12-08 Thread thedeemon
On Saturday, 7 December 2013 at 22:32:59 UTC, Namespace wrote: Since my last thread doesn't get much attention I like to ask here: How did you deal with temporary memory? I just use scope(exit) delete buf; Your solution seems to do a GC every time some buffer goes out of scope, which is

Re: How do you deal with scoped allocations?

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 19:18, thedeemon wrote: I just use scope(exit) delete buf; Deprecated or at least disapproved of, no?

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Walter Bright
On 12/8/2013 6:26 AM, qznc wrote: On Sunday, 8 December 2013 at 12:35:45 UTC, ponce wrote: 1. D knows when data is immutable. C has to always make worst case assumptions, and assume indirectly accessed data mutates. ICC (and other C++ compilers) has plenty of way to disambiguate aliasing: - a

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Walter Bright
On 12/8/2013 4:35 AM, ponce wrote: 3. Function inlining has generally been shown to be of tremendous value in optimization. D has access to all the source code in the program, or at least as much as you're willing to show it, and can inline across modules. C cannot inline functions unless they

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Walter Bright
On 12/8/2013 2:13 AM, Araq wrote: From this list only (7) is a valid point. All the others can be trivially dealt with whole program optimization (1,2,3) If it's trivial, it's not happening. (1) would require solving the halting problem. (2) is impractical because there's no way for the

Re: How do you deal with scoped allocations?

2013-12-08 Thread Namespace
On Sunday, 8 December 2013 at 18:33:39 UTC, Joseph Rushton Wakeling wrote: On 08/12/13 19:18, thedeemon wrote: I just use scope(exit) delete buf; Deprecated or at least disapproved of, no? Sadly yes.

Re: How do you deal with scoped allocations?

2013-12-08 Thread Namespace
I just use scope(exit) delete buf; Your solution seems to do a GC every time some buffer goes out of scope, which is slooow. I don't need scoped allocations that often. Otherwise I wouldn't use GC.minimize ;) or wouldn't use the GC at all. John Colvin: Well, for a start you're

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Simen Kjærås
On 07.12.2013 00:58, H. S. Teoh wrote: On Sat, Dec 07, 2013 at 12:40:35AM +0100, bearophile wrote: [...] Regarding Java performance matters, from my experience another significant source of optimization in the JavaVM that is often overlooked is that the JavaVM is able to partially unroll even

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Simen Kjærås
On 07.12.2013 08:38, Maxim Fomin wrote: On Friday, 6 December 2013 at 23:30:45 UTC, Walter Bright wrote: On 12/6/2013 3:06 PM, Maxim Fomin wrote: and what about holes in immutable, pure and rest type system? If there are bugs in the type system, then that optimization breaks. Bad news:

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Timon Gehr
On 12/08/2013 07:53 PM, Walter Bright wrote: On 12/8/2013 2:13 AM, Araq wrote: From this list only (7) is a valid point. All the others can be trivially dealt with whole program optimization (1,2,3) If it's trivial, it's not happening. (1) would require solving the halting problem. ... No

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Walter Bright
On 12/8/2013 12:06 PM, Timon Gehr wrote: On 12/08/2013 07:53 PM, Walter Bright wrote: On 12/8/2013 2:13 AM, Araq wrote: From this list only (7) is a valid point. All the others can be trivially dealt with whole program optimization (1,2,3) If it's trivial, it's not happening. (1) would

Re: Publication of the French translation of Ali's Programming in D book

2013-12-08 Thread Raphaël Jakse
Le 08/12/2013 18:05, Philippe Sigaud a écrit : First, kudos for translating all this! I'm sure that'll be a good reference and maybe pave the way for other translations (Spanish, German Japanese come to mind). I have a few questions: - why did you use this whata! language instead of a

Re: Publication of the French translation of Ali's Programming in D book

2013-12-08 Thread Andrei Alexandrescu
On 12/8/13 1:22 PM, Raphaël Jakse wrote: To be fair, I used Whata! mainly because I am the author of this syntax and I'm used to it. I'd say that's a perfectly reasonable answer. I can try to explain why I wrote Whata! instead of Markdown. Does Whata! have a good macro system? After much

Typos in std.process.execute documentation?

2013-12-08 Thread Nikhil Padmanabhan
Hi, I just noticed what looks like two typos in the std.process.execute documentation : 1/ auto dmd = execute(dmd, myapp.d); should be auto dmd = execute([dmd, myapp.d]); 2/ if (status ==0) should be if (status !=0) Should I file a bug report, or is there a way I can simply submit

Re: Publication of the French translation of Ali's Programming in D book

2013-12-08 Thread Philippe Sigaud
On Sun, Dec 8, 2013 at 10:29 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 12/8/13 1:22 PM, Raphaël Jakse wrote: To be fair, I used Whata! mainly because I am the author of this syntax and I'm used to it. I'd say that's a perfectly reasonable answer. Well, using Ddoc

Re: Lambda syntax for methods and functions

2013-12-08 Thread Marco Leise
Am Sun, 08 Dec 2013 18:15:40 +0100 schrieb Jesse Phillips jesse.k.phillip...@gmail.com: On Sunday, 8 December 2013 at 06:58:59 UTC, Marco Leise wrote: But the verbose D syntax is just too distracting: bool function(T a, T b) { return a b; }) I think you mean the verbose D syntax:

Re: Publication of the French translation of Ali's Programming in D book

2013-12-08 Thread Raphaël Jakse
Le 08/12/2013 22:29, Andrei Alexandrescu a écrit : On 12/8/13 1:22 PM, Raphaël Jakse wrote: To be fair, I used Whata! mainly because I am the author of this syntax and I'm used to it. I'd say that's a perfectly reasonable answer. I can try to explain why I wrote Whata! instead of Markdown.

Re: Publication of the French translation of Ali's Programming in D book

2013-12-08 Thread Raphaël Jakse
Le 08/12/2013 22:41, Philippe Sigaud a écrit : On Sun, Dec 8, 2013 at 10:29 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 12/8/13 1:22 PM, Raphaël Jakse wrote: To be fair, I used Whata! mainly because I am the author of this syntax and I'm used to it. I'd say that's a

Re: Publication of the French translation of Ali's Programming in D book

2013-12-08 Thread Ali Çehreli
On 12/08/2013 03:03 PM, Raphaël Jakse wrote: Le 08/12/2013 22:41, Philippe Sigaud a écrit : What format used Ali? HTML? DDoc ;-) I wanted to use what D offered partly to also learn DDoc. DDoc has some issues and apparently some limitations but it worked for me. Ali

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Timon Gehr
On 12/08/2013 09:42 PM, Walter Bright wrote: On 12/8/2013 12:06 PM, Timon Gehr wrote: On 12/08/2013 07:53 PM, Walter Bright wrote: On 12/8/2013 2:13 AM, Araq wrote: From this list only (7) is a valid point. All the others can be trivially dealt with whole program optimization (1,2,3) If

Re: Publication of the French traduction on ddili

2013-12-08 Thread Ali Çehreli
On 12/06/2013 09:21 AM, Raphaël Jakse wrote: I published the current state of my translation on Gitorious: Thank you and the future reviewers for their work. What an honor to see it in another language! I especially liked it that you carried some of my rare silly jokes to French e.g. Ce

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread bearophile
Walter Bright: You can do these in D with a library type. We'll discuss much better about similar topics in another specific thread. Bye, bearophile

Re: Inherent code performance advantages of D over C?

2013-12-08 Thread Walter Bright
On 12/8/2013 4:47 PM, Timon Gehr wrote: Static analysis will tell you where a pointer might point to (more importantly, it may exclude aliasing) and what values the variable 'i' might have in it. How precise this information is hinges on the details of the analysis and the program it is applied

Advertisements on the D site

2013-12-08 Thread Robert Nagel
I was browsing the site for the first time and I am put off somewhat by the use of advertisements on the bottom of the site pages. I understand that it can help to raise money but I feel it somewhat hurts the professional appearance of the site. Didn't know where else to post this, just

Re: Advertisements on the D site

2013-12-08 Thread ed
On Monday, 9 December 2013 at 04:33:34 UTC, Robert Nagel wrote: I was browsing the site for the first time and I am put off somewhat by the use of advertisements on the bottom of the site pages. I understand that it can help to raise money but I feel it somewhat hurts the professional

Re: Advertisements on the D site

2013-12-08 Thread ed
On Monday, 9 December 2013 at 04:46:41 UTC, ed wrote: On Monday, 9 December 2013 at 04:33:34 UTC, Robert Nagel wrote: I was browsing the site for the first time and I am put off somewhat by the use of advertisements on the bottom of the site pages. I understand that it can help to raise money

Re: Advertisements on the D site

2013-12-08 Thread Robert Nagel
I followed the link and I do not see any ads. Could it be that you are using an adblocker? It is there. div id=google_ad !-- Google ad -- script type=text/javascript!-- /**/google_ad_client = pub-5628673096434613; /**/google_ad_width = 728; /**/google_ad_height = 90; /**/google_ad_format =

Re: Advertisements on the D site

2013-12-08 Thread Robert Nagel
But it appears the ad parameters are commented out with a !-- .. -- so I don't know why it appears for you and not me. Cheers, ed Interesting, I am using Firefox and it does not recognize that as a valid comment it appears. I tried again on Chrome and still saw the ad. Which browser are you

Re: Advertisements on the D site

2013-12-08 Thread Robert Nagel
On Monday, 9 December 2013 at 04:58:26 UTC, Robert Nagel wrote: But it appears the ad parameters are commented out with a !-- .. -- so I don't know why it appears for you and not me. Cheers, ed Interesting, I am using Firefox and it does not recognize that as a valid comment it appears. I

Re: Advertisements on the D site

2013-12-08 Thread ed
On Monday, 9 December 2013 at 04:52:49 UTC, Robert Nagel wrote: I followed the link and I do not see any ads. Could it be that you are using an adblocker? It is there. div id=google_ad !-- Google ad -- script type=text/javascript!-- /**/google_ad_client = pub-5628673096434613;

Re: Advertisements on the D site

2013-12-08 Thread Adam Wilson
On Sun, 08 Dec 2013 20:33:33 -0800, Robert Nagel rcna...@gmail.com wrote: I was browsing the site for the first time and I am put off somewhat by the use of advertisements on the bottom of the site pages. I understand that it can help to raise money but I feel it somewhat hurts the

Re: Help Finding Strange Memory Bug (Code linked to C library)

2013-12-08 Thread Craig Dillabaugh
On Saturday, 7 December 2013 at 23:11:39 UTC, Rémy Mouëza wrote: My strategy here would be to: A. run the program in a debugger, say GDB, to get a exhaustive stacktrace for hints about where to look at. B. have a quick look at the library directly (the Use the Source Luke strategy). Since I

Re: Help Finding Strange Memory Bug (Code linked to C library)

2013-12-08 Thread Craig Dillabaugh
On Saturday, 7 December 2013 at 23:35:49 UTC, Ali Çehreli wrote: On 12/07/2013 03:11 PM, Rémy Mouëza wrote: the last pointer, `double * padfMaxBound` is actually a pointer to an array of 4 elements: Great sleuthing! :) This thread is a good example of C's Biggest Mistake:

the Result Type

2013-12-08 Thread seany
std.algorithm.splitter seems to return all its return values as a type Result, without quotes, and i dont not seem to be able to cast it to string[] or int[] with cast(string[]) ( or even cast (string) - i tried that too). I tried to use a function void function(T, R)(T arr, out R output) {

Re: the Result Type

2013-12-08 Thread Ali Çehreli
On 12/08/2013 12:24 AM, seany wrote: std.algorithm.splitter seems to return all its return values as a type Result, without quotes, and i dont not seem to be able to cast it to string[] or int[] with cast(string[]) ( or even cast (string) - i tried that too). I tried to use a function

Re: Equality == comparisons with floating point numbers

2013-12-08 Thread Abdulhaq
... I thought I did, but now I'm up against an interesting conundrum: while equality == comparison can fail here for 32-bit, isIdentical comparison can fail even for 64-bit, although only for the release-mode build. What's particularly odd is that if before calling assert(isIdentical(

Re: the Result Type

2013-12-08 Thread seany
O_O with that knowledge, would also be possible to define new types (not aliases, but new encapsulated types) representing things such as Graph, Ring, Topology, surreal number, etc? I dont find this in your book, would you consider either adding this Volodemrot types, or in case they

Re: the Result Type

2013-12-08 Thread Marco Leise
Am Sun, 08 Dec 2013 09:24:53 +0100 schrieb seany se...@uni-bonn.de: std.algorithm.splitter seems to return all its return values as a type Result, without quotes, and i dont not seem to be able to cast it to string[] or int[] with cast(string[]) ( or even cast (string) - i tried that

Re: File Picker

2013-12-08 Thread Marco Leise
Am Sun, 08 Dec 2013 05:49:34 +0100 schrieb Malkierian rhyd...@gmail.com: On Saturday, 7 December 2013 at 23:18:18 UTC, Adam D. Ruppe wrote: On Saturday, 7 December 2013 at 23:00:00 UTC, Malkierian wrote: Is there anything in D that currently brings up a window to find and choose a file,

Re: the Result Type

2013-12-08 Thread Marco Leise
Am Sun, 08 Dec 2013 09:59:55 +0100 schrieb seany se...@uni-bonn.de: O_O with that knowledge, would also be possible to define new types (not aliases, but new encapsulated types) representing things such as Graph, Ring, Topology, surreal number, etc? All these Result types are simply

Re: Threading methodology

2013-12-08 Thread Marco Leise
Am Sat, 07 Dec 2013 17:53:06 +0100 schrieb Frustrated c1514...@drdrb.com: I have to process n arrays in some partial order. Instead of all working only on the n arrays and reusing them, [...] Wait, what partial order and how is it relevant? Who is all in all working? Why only the n arrays, I

Re: the Result Type

2013-12-08 Thread Ali Çehreli
On 12/08/2013 12:59 AM, seany wrote: I dont find this in your book, would you consider either adding this Volodemrot types, I think at least a short mention is in order. :) There are two reasons why they don't appear in the book (yet): 1) They are not a proper language feature, rather a

Re: the Result Type

2013-12-08 Thread bearophile
Ali Çehreli: When you eagerly need an actual array of the elements, call std.array.array on Result: import std.array; import std.algorithm; void main() { auto input = hello world; auto splittedWords = input.splitter(' ').array; Or just use the eager split() function. Bye,

Re: iterate over enum name:value pairs

2013-12-08 Thread bearophile
Jay Norwood: enum Suit { spades, hearts=4, diamonds=10, clubs } foreach (i, member; EnumMembers!Suit) Here 'i' is the index of the enumeration type tuple. This code lacks the [] I added in my code, so your foreach is a static one. To tell them apart when I read the code I sometimes

Re: Equality == comparisons with floating point numbers

2013-12-08 Thread Ali Çehreli
On 12/08/2013 01:55 AM, Joseph Rushton Wakeling wrote: back to my original solution of approxEqual I don't know whether it helps here but just to complete the picture, there is also std.math.feqrel: http://dlang.org/phobos/std_math.html#.feqrel Ali

Re: Help Finding Strange Memory Bug (Code linked to C library)

2013-12-08 Thread Ali Çehreli
On 12/08/2013 12:16 AM, Craig Dillabaugh wrote: I cannot for the life of me figure out why I didn't think to check that! D has already ruined your mind! :p Ali

Re: the Result Type

2013-12-08 Thread seany
On Sunday, 8 December 2013 at 11:02:40 UTC, Ali Çehreli wrote: (I remember Andrei's original newsgroup post about this discovery but I cannot find it at this time.) http://www.digitalmars.com/d/archives/digitalmars/D/announce/Voldemort_Types_in_D_23511.html this?

array question

2013-12-08 Thread seany
consider the follwoing: import tango.io.Stdout, tango.io.Path, tango.text.Util; import std.algorithm, std.string , std.stdio, std.array, std.conv, std.regex, std.typecons; //i know al imports are not necessary for this example, just ^c^v from my actual code alias string[] surSegments

Re: Equality == comparisons with floating point numbers

2013-12-08 Thread Joseph Rushton Wakeling
On 08/12/13 12:13, Ali Çehreli wrote: I don't know whether it helps here but just to complete the picture, there is also std.math.feqrel: http://dlang.org/phobos/std_math.html#.feqrel Thanks! :-) Checking the value of feqrel followed by isIdentical looks like it might work. (OK,

Running DMD tests

2013-12-08 Thread Dmitry Olshansky
I'm trying my hand at a simple pesky bug in DMD. About to run test suite but must be doing something wrong. Any help would be appreciated. I followed this: http://wiki.dlang.org/Building_DMD#How_to_run_the_test_suite_in_dmd.2Ftest And here is what I get (I'm on 64-bit Ubuntu):

Re: array question

2013-12-08 Thread Ali Çehreli
On 12/08/2013 03:51 AM, seany wrote: consider the follwoing: import tango.io.Stdout, tango.io.Path, tango.text.Util; import std.algorithm, std.string , std.stdio, std.array, std.conv, std.regex, std.typecons; //i know al imports are not necessary for this example, just ^c^v from my

Re: the Result Type

2013-12-08 Thread Ali Çehreli
On 12/08/2013 03:41 AM, seany wrote: On Sunday, 8 December 2013 at 11:02:40 UTC, Ali Çehreli wrote: (I remember Andrei's original newsgroup post about this discovery but I cannot find it at this time.)

Re: Unresolvable references to dlopen, dlclose etc

2013-12-08 Thread Mike Parker
On 12/8/2013 6:12 AM, Mafi wrote: On Friday, 6 December 2013 at 16:54:14 UTC, Jacob Carlborg wrote: I would say that linking order shouldn't matter. But for some reason it does. This not really my area of expertise but I know that others have had the same problem. You can try and search the

Re: array question

2013-12-08 Thread seany
On Sunday, 8 December 2013 at 13:47:43 UTC, Ali Çehreli wrote: On 12/08/2013 03:51 AM, seany wrote: consider the follwoing: import tango.io.Stdout, tango.io.Path, tango.text.Util; import std.algorithm, std.string , std.stdio, std.array, std.conv, std.regex, std.typecons; //i know al

Re: the Result Type

2013-12-08 Thread Philippe Sigaud
On Sun, Dec 8, 2013 at 9:59 AM, seany se...@uni-bonn.de wrote: O_O with that knowledge, would also be possible to define new types (not aliases, but new encapsulated types) representing things such as Graph, Ring, Topology, surreal number, etc? Other posters already answered your questions

Re: File Picker

2013-12-08 Thread Malkierian
On Sunday, 8 December 2013 at 09:17:37 UTC, Marco Leise wrote: Maybe it requires a working Windows® event loop in your application, as is typical for GUI applications on any platform. Windows typically generate all sorts of events, like mouse clicks, key strokes, resize events etc. They add up

Re: Shared library: loading doesn't call shared static this

2013-12-08 Thread Ellery Newcomer
On Sunday, 8 December 2013 at 10:31:32 UTC, Mathias LANG wrote: Thank you, and yazd, it did the trick. May I ask why I don't want to call it multiple time though ? From the sentence If the runtime was already successfully initialized this returns true., I though this was handled in some way.

Only const or immutable class thread local variables are allowed

2013-12-08 Thread Joseph Rushton Wakeling
Hello all, I have a challenge, which is this: I'd like to have a public property which will return a reference to an internally stored class instance. ref MyClass myProperty() @property { ... } However, this runs into a problem: I can't use static to internally store a

Re: how to compose delegate type

2013-12-08 Thread Ellery Newcomer
On Sunday, 8 December 2013 at 00:43:51 UTC, Jesse Phillips wrote: What is wrong with the current template which returns an immutable delegate type? It still store you're immutable member function. It composes the wrong type. It composes a type that has different constness than the target

Re: File Picker

2013-12-08 Thread Adam D. Ruppe
On Sunday, 8 December 2013 at 04:49:35 UTC, Malkierian wrote: Any idea why it doesn't work the first time, but then does the second and freezes? Could be a missing argument to the function, I did a quick test on Windows XP and it looks like you're on Vista. Later today, I'll be on my other

Re: iterate over enum name:value pairs

2013-12-08 Thread Jay Norwood
I see comments about enums being somehow implemented as tuples, and comments about tuples somehow being implemented as structs, but I couldn't find examples of static initialization of arrays of either. Finally after playing around with it for a while, it appears this example below works for

Re: iterate over enum name:value pairs

2013-12-08 Thread bearophile
Jay Norwood: I see comments about enums being somehow implemented as tuples, Enums are usually implemented as ints, unless you specify a different type. and comments about tuples somehow being implemented as structs, Phobos Tuples are implemented with structs. but I couldn't find

Re: Only const or immutable class thread local variables are allowed

2013-12-08 Thread Ali Çehreli
On 12/08/2013 10:00 AM, Joseph Rushton Wakeling wrote: I have a challenge, which is this: I'd like to have a public property which will return a reference to an internally stored class instance. ref MyClass myProperty() @property { ... } First, the usual question:

  1   2   >