Re: Programming in D book is about 88% translated

2013-06-29 Thread Ali Çehreli
On 06/28/2013 08:16 PM, Rob T wrote: On Saturday, 29 June 2013 at 02:02:26 UTC, Ali Çehreli wrote: http://ddili.org/ders/d.en/index.html Awesome! I continue to make use of your online book, so having these new chapters in a language I can read is very much welcome news. teşekkür

Re: Programming in D book is about 88% translated

2013-06-29 Thread Joshua Niehus
On Saturday, 29 June 2013 at 02:02:26 UTC, Ali Çehreli wrote: I have continued with the translation of the book [snip] excellent. Keep up the good work Ali!

Re: Programming in D book is about 88% translated

2013-06-29 Thread Walter Bright
On 6/28/2013 7:35 PM, Ali Çehreli wrote: Thinking that it is free enough, I had chosen this: http://creativecommons.org/licenses/by-nc-sa/3.0/us/ Just let me know if it is limiting in any way. This is just awesome! Thank you, Ali!

Re: dlibgit updated to libgit2 v0.19.0

2013-06-29 Thread Walter Bright
On 6/28/2013 9:10 AM, Dicebot wrote: On Friday, 28 June 2013 at 16:00:57 UTC, Andrej Mitrovic wrote: Deimos is an overhead which provides no benefits. It was supposed to be used to make discovery easy, but discovery can be done through a wiki, or dlang.org, or an automated process (dub).

Re: Announcing bottom-up-build - a build system for C/C++/D

2013-06-29 Thread Graham St Jack
On Sat, 29 Jun 2013 00:59:15 +0200, John Colvin wrote: On Thursday, 27 June 2013 at 00:10:37 UTC, Graham St Jack wrote: Having side-by-side comparisons of D against bash scripts and C++ modules had the effect of turning almost all the other team members into D advocates. Any chance we

Re: Programming in D book is about 88% translated

2013-06-29 Thread Johannes Pfau
Am Fri, 28 Jun 2013 19:02:25 -0700 schrieb Ali Çehreli acehr...@yahoo.com: I have continued with the translation of the book. There are 82 of the 718 pages still to be translated. (However, I still need to write the UDA chapter.) Ali Nice work! BTW: The link to wiki4d on this page

Re: DConf 2013 Closing Keynote: Quo Vadis by Andrei Alexandrescu

2013-06-29 Thread Walter Bright
I agree with your post, I just want to make a couple of minor corrections. On 6/27/2013 4:58 AM, Leandro Lucarella wrote: Do you really think C++ took off because there are commercial implementations? I got into the C++ fray in the 1987-88 time frame. At the time, there was a great debate

Re: Programming in D book is about 88% translated

2013-06-29 Thread Paulo Pinto
Am 29.06.2013 04:35, schrieb Ali Çehreli: On 06/28/2013 07:15 PM, MattCoder wrote: I'm really thinking about translate to portuguese That sounds great! :) Somebody else had started a translation last year to Brazilian Portuguese. I have just emailed the author to see how much they have

Bugfix release 0.9.16

2013-06-29 Thread Sönke Ludwig
Am 22.06.2013 13:04, schrieb Sönke Ludwig: Two additional notes: - There is a known bug that causes multiple DUB invocations to be required until all indirect dependencies are installed (watch out for a There are still some actions to perform: message). The current git master

Re: Announcing bottom-up-build - a build system for C/C++/D

2013-06-29 Thread Clive Hobson
On Saturday, 29 June 2013 at 07:54:30 UTC, Graham St Jack wrote: On Sat, 29 Jun 2013 00:59:15 +0200, John Colvin wrote: On Thursday, 27 June 2013 at 00:10:37 UTC, Graham St Jack wrote: Having side-by-side comparisons of D against bash scripts and C++ modules had the effect of turning almost

Re: Programming in D book is about 88% translated

2013-06-29 Thread MattCodr
On Saturday, 29 June 2013 at 02:35:27 UTC, Ali Çehreli wrote: That sounds great! :) Somebody else had started a translation last year to Brazilian Portuguese. I have just emailed the author to see how much they have advanced. Please let me know later how the translation is going, if I can

Re: DConf 2013 Closing Keynote: Quo Vadis by Andrei Alexandrescu

2013-06-29 Thread Joseph Rushton Wakeling
On Saturday, 29 June 2013 at 08:37:48 UTC, Walter Bright wrote: The bottom line was the open source movement was not a very significant force in the 1980's when C++ gained traction. Open source really exploded around 2000, along with the internet. I wonder if open source perhaps needed the

Re: DConf 2013 Closing Keynote: Quo Vadis by Andrei Alexandrescu

2013-06-29 Thread Leandro Lucarella
Walter Bright, el 29 de June a las 01:37 me escribiste: The bottom line was the open source movement was not a very significant force in the 1980's when C++ gained traction. Open source really exploded around 2000, along with the internet. I wonder if open source perhaps needed the internet in

Re: Programming in D book is about 88% translated

2013-06-29 Thread Geancarlo Rocha
On Saturday, 29 June 2013 at 08:47:14 UTC, Paulo Pinto wrote: Maybe some help from proper Portuguese as well? :) -- Paulo Ei gajo, did you mean weird portuguese? :P

Re: DConf 2013 Closing Keynote: Quo Vadis by Andrei Alexandrescu

2013-06-29 Thread CJS
On Saturday, 29 June 2013 at 08:37:48 UTC, Walter Bright wrote: I agree with your post, I just want to make a couple of minor corrections. On 6/27/2013 4:58 AM, Leandro Lucarella wrote: Do you really think C++ took off because there are commercial implementations? I got into the C++ fray in

Re: DConf 2013 Closing Keynote: Quo Vadis by Andrei Alexandrescu

2013-06-29 Thread Walter Bright
On 6/29/2013 5:08 AM, Joseph Rushton Wakeling wrote: On Saturday, 29 June 2013 at 08:37:48 UTC, Walter Bright wrote: The bottom line was the open source movement was not a very significant force in the 1980's when C++ gained traction. Open source really exploded around 2000, along with the

Re: DConf 2013 Closing Keynote: Quo Vadis by Andrei Alexandrescu

2013-06-29 Thread Walter Bright
On 6/29/2013 7:56 PM, CJS wrote: Wow. That's interesting reading. Thanks for the history lesson! There are other versions of this history, none of which mention the role ZTC++ played in C++ attaining critical mass, so I like to repeat my version now and then :-)

Re: DMD under 64-bit Windows 7 HOWTO

2013-06-29 Thread Jonathan Dunlap
Thanks! Adding those libs to the path worked. However, now I get the below error about a missing entry point. LINK : fatal error LNK1561: entry point must be defined --- errorlevel 1561 Exit code 1561 Build complete -- 1 error, 0 warnings

Re: DMD under 64-bit Windows 7 HOWTO

2013-06-29 Thread Jonathan Dunlap
Never mind, I fixed that linker error (had a minor issue with the main D entry point). I'm now building x64!

Re: DLang Spec rewrite (?)

2013-06-29 Thread Borden
On Monday, 27 May 2013 at 02:11:00 UTC, Andrei Alexandrescu wrote: I think it would be great. In particular, an ebook format would be good. You may want to wait until https://github.com/D-Programming-Language/dlang.org/pull/271 is in. It systematizes macros a lot and it may offer answers to

What about to add costume projects to D autotester?

2013-06-29 Thread Denis Shelomovskij
As dmd is actively developed approximately every 2 weeks (since May) I have to find a cause for a regression which takes few hours and is a bit annoying as it looks like a needless job. What about to introduce some benefit criteria (regressions discovered by the project e.g.) relying on which

Re: stack trace on linux amd64 ?

2013-06-29 Thread Iain Buclaw
On 29 June 2013 06:42, deadalnix deadal...@gmail.com wrote: On Friday, 28 June 2013 at 20:00:52 UTC, Johannes Pfau wrote: Am Fri, 28 Jun 2013 11:12:25 -0700 schrieb Sean Kelly s...@invisibleduck.org: If I remember correctly, the issue there was that the runtime would need to open the

Re: Problem with Variant

2013-06-29 Thread develop32
On Saturday, 29 June 2013 at 00:14:19 UTC, Andrei Alexandrescu wrote: Could you please paste your note into a bug report? In a perfect world you may want to also submit a pull request! Filled a bug http://d.puremagic.com/issues/show_bug.cgi?id=10500 And I'll try to make world a better place

Re: DLang Spec rewrite (?)

2013-06-29 Thread Daniel Murphy
Borden 2...@bordenrhodes.com wrote in message news:qglzffgfawrzjguvt...@forum.dlang.org... I would still like to work on compiling the DLangSpec into HTML5, but I've noticed that pull request 271 hasn't been touched in over 4 months. Further, I sent in a pull request to move the DLangSpec

DIP43 - D/Objective-C

2013-06-29 Thread Jacob Carlborg
I have created a DIP for making D ABI compatible with Objective-C. This idea has already been announced, what I've done now is created a proper DIP. The DIP is basically Michel Fortin's original designed document properly formatted and put next to the other DIP's. DIP link:

Compiler could elide many more postblit constructor calls

2013-06-29 Thread TommiT
Disclaimer: The discovery I'm about to describe here seems so obvious that I'm inclined to think that I've made some mistake. The sole purpose of postblit constructors is to provide value semantics to structs which have mutable indirection (variables which have only immutable indirection have

Re: SIMD on Windows

2013-06-29 Thread Jonathan Dunlap
Alright, I'm now officially building for Windows x64 (amd64). I've created this early benchmark http://dpaste.dzfl.pl/eae0233e to explore SIMD performance. As you can see below, on my machine there is almost zero difference. Am I missing something? //===SIMD=== 0 1.#INF 5 1.#INF -- vector

Re: DIP42 - Add enum E(T) = expression; eponymous template support

2013-06-29 Thread Denis Shelomovskij
26.06.2013 20:35, Andrej Mitrovic пишет: On 6/26/13, Denis Shelomovskij verylonglogin@gmail.com wrote: which will look better this way: --- static if (...) enum template = ...; else static if (...) enum template = ...; else ... --- Yeah I agree, this is more important than

Add static code analyzing to dmd

2013-06-29 Thread Denis Shelomovskij
IMHO it's an important enhancement as I see no reasons for the compiler to not inform about may-be-an-error situations if the user asks as it will save a lot people time. Original issue: http://d.puremagic.com/issues/show_bug.cgi?id=9811 Description: There are things which may or may not

Re: DIP43 - D/Objective-C

2013-06-29 Thread Michel Fortin
On 2013-06-29 12:58:45 +, Jacob Carlborg d...@me.com said: I have created a DIP for making D ABI compatible with Objective-C. This idea has already been announced, what I've done now is created a proper DIP. The DIP is basically Michel Fortin's original designed document properly

Re: DIP43 - D/Objective-C

2013-06-29 Thread David Gileadi
On 6/29/13 5:58 AM, Jacob Carlborg wrote: I have created a DIP for making D ABI compatible with Objective-C. This idea has already been announced, what I've done now is created a proper DIP. The DIP is basically Michel Fortin's original designed document properly formatted and put next to the

Regarding warnings

2013-06-29 Thread bearophile
I suggest to remove the -w switch from the list of dmd/ldc2 switches, and later to remove that functionality too. It's better to keep only the informational warnings. I keep seeing people in D.learn that miss warnings because they don't active them, so I suggest to activate informational

Re: SIMD on Windows

2013-06-29 Thread jerro
On Saturday, 29 June 2013 at 14:39:44 UTC, Jonathan Dunlap wrote: Alright, I'm now officially building for Windows x64 (amd64). I've created this early benchmark http://dpaste.dzfl.pl/eae0233e to explore SIMD performance. As you can see below, on my machine there is almost zero difference. Am

Re: DIP43 - D/Objective-C

2013-06-29 Thread Michel Fortin
On 2013-06-29 15:51:11 +, David Gileadi gilea...@nspmgmail.com said: It's probably an obvious observation, but why not use an annotation like: @selector(insertItemWithObjectValue:atIndex:) void insertItem(ObjcObject object, NSInteger value); instead of the DIP's proposal of: void

Re: SIMD on Windows

2013-06-29 Thread Kiith-Sa
See Manu's talk and google how to use it. If you don't know what you're doing you are unlikely to see performance improvements. I'm not even sure if you're benchmarking SIMD performance or function call overhead there.

SCons D tooling patch

2013-06-29 Thread H. S. Teoh
Hi Russel, After the latest hg pull from your SCons D tooling, bootstrap.py was broken, and aborts with an error upon startup. Since I've been using bootstrap.py to do all my D builds, this was a rather major inconvenience. But today, I managed to figure out the problem, so I've attached the

Octal enums don't work anymore in git HEAD

2013-06-29 Thread H. S. Teoh
http://d.puremagic.com/issues/show_bug.cgi?id=10503 :-( T -- If Java had true garbage collection, most programs would delete themselves upon execution. -- Robert Sewell

Re: Compiler could elide many more postblit constructor calls

2013-06-29 Thread TommiT
On Saturday, 29 June 2013 at 13:47:36 UTC, TommiT wrote: [..] Example: struct S { int[] values; this(this) { values = values.dup; } } void foo(const S) { } void main() { const S s; foo(s); // No need to call postblit } One important related detail: If

Re: SIMD on Windows

2013-06-29 Thread Jonathan Dunlap
I've updated the project with your suggestions at http://dpaste.dzfl.pl/fce2d93b but still get the same performance. Vectors defined in the benchmark function body, no function calling overhead, etc. See some of my comments below btw: First of all, calcSIMD and calcScalar are virtual

Re: SIMD on Windows

2013-06-29 Thread Iain Buclaw
On 29 June 2013 18:57, Jonathan Dunlap jad...@gmail.com wrote: I've updated the project with your suggestions at http://dpaste.dzfl.pl/fce2d93b but still get the same performance. Vectors defined in the benchmark function body, no function calling overhead, etc. See some of my comments below

Re: SIMD on Windows

2013-06-29 Thread jerro
On Saturday, 29 June 2013 at 17:57:20 UTC, Jonathan Dunlap wrote: I've updated the project with your suggestions at http://dpaste.dzfl.pl/fce2d93b but still get the same performance. Vectors defined in the benchmark function body, no function calling overhead, etc. See some of my comments

Re: SIMD on Windows

2013-06-29 Thread jerro
For the dlang docs: Member functions which are private or package are never virtual, and hence cannot be overridden. The call to calcScalar compiles to this: movrax,QWORD PTR [r12] rex.W call QWORD PTR [rax+0x40] so I think the implementation doesn't conform to the spec in this case.

Re: SIMD on Windows

2013-06-29 Thread Jonathan Dunlap
modern x86-64 processors can execute them in parallel. Because of that, the speed of your program is limited by instruction latency and not throughput. It seems like auto-vectorization to SIMD code may be an ideal strategy (e.g. Java) since it seems that the conditions to get any performance

Re: DIP42 - Add enum E(T) = expression; eponymous template support

2013-06-29 Thread TommiT
I've been wondering if we could have parameterized named enumS. The syntax for it would look somewhat similar: enum Fruit(T) : T { apple, banana = -42 } void main() { auto shortFruit = Fruit!(short).apple; auto longFruit = Fruit!(long).banana; longFruit = shortFruit; // OK:

Re: Regarding warnings

2013-06-29 Thread w0rp
On Saturday, 29 June 2013 at 16:07:57 UTC, bearophile wrote: I suggest to remove the -w switch from the list of dmd/ldc2 switches, and later to remove that functionality too. It's better to keep only the informational warnings. I keep seeing people in D.learn that miss warnings because they

Re: Automatic typing

2013-06-29 Thread Ary Borenszweig
On 6/27/13 9:34 PM, JS wrote: Would it be possible for a language(specifically d) to have the ability to automatically type a variable by looking at its use cases without adding too much complexity? It seems to me that most compilers already can infer type mismatchs which would allow them to

Re: Regarding warnings

2013-06-29 Thread bearophile
w0rp: This might increase knowledge like you say. Plus, you'd have warnings about stuff like implicit switch case fall-through as the default. I think this idea sounds okay. I think a strong, silent type of D compiler is not the best. Maybe Walter can offer an opinion, even negative :-)

Re: DLang Spec rewrite (?)

2013-06-29 Thread Borden
On Saturday, 29 June 2013 at 11:33:16 UTC, Daniel Murphy wrote: To be honest, you just have to keep bugging people. I mostly review compiler pulls, and I am much much more likely to review something that shows up in my inbox than something that sits patiently in the list. If you make enough

Re: auto type for defaulted arguments? [Repost]

2013-06-29 Thread bearophile
In the meantime I have opened an enhancement request: http://d.puremagic.com/issues/show_bug.cgi?id=10491 Henning Pohl has written a patch: https://github.com/D-Programming-Language/dmd/pull/2270 And Kenji has written some comments in Bugzilla, explaining why he doesn't like this ER. I

Re: SIMD on Windows

2013-06-29 Thread jerro
It seems like auto-vectorization to SIMD code may be an ideal strategy (e.g. Java) since it seems that the conditions to get any performance improvement have to be very particular and situational... which is something the compiler may be best suited to handle. Thoughts? The things is that

Re: Regarding warnings

2013-06-29 Thread Jonathan M Davis
On Saturday, June 29, 2013 18:07:55 bearophile wrote: I suggest to remove the -w switch from the list of dmd/ldc2 switches, and later to remove that functionality too. It's better to keep only the informational warnings. I keep seeing people in D.learn that miss warnings because they don't

Re: SIMD on Windows

2013-06-29 Thread Jonathan Dunlap
I did watch Manu's a few days ago which inspired me to start this project. With the updates in http://dpaste.dzfl.pl/fce2d93b, I'm still a bit clueless as to why there is almost zero performance difference... considering that is seems like an ideal setup to benefit from SIMD. I feel that if I

Re: Regarding warnings

2013-06-29 Thread John Colvin
On Saturday, 29 June 2013 at 16:07:57 UTC, bearophile wrote: I suggest to remove the -w switch from the list of dmd/ldc2 switches, and later to remove that functionality too. It's better to keep only the informational warnings. I keep seeing people in D.learn that miss warnings because they

Re: Automatic typing

2013-06-29 Thread Walter Bright
On 6/29/2013 12:18 PM, Ary Borenszweig wrote: What you are asking is essentially what Crystal does for all variables (and types): https://github.com/manastech/crystal/wiki/Introduction#type-inference Your example would be written like this: x = 3 y = f() x = 3.9 But since Crystal transforms

Re: SIMD on Windows

2013-06-29 Thread Michael
versioning on Win32/Win64 no longer works. Why? or What exactly? Details please)

Re: Automatic typing

2013-06-29 Thread Ary Borenszweig
On 6/29/13 6:01 PM, Walter Bright wrote: On 6/29/2013 12:18 PM, Ary Borenszweig wrote: What you are asking is essentially what Crystal does for all variables (and types): https://github.com/manastech/crystal/wiki/Introduction#type-inference Your example would be written like this: x = 3 y =

Re: Regarding warnings

2013-06-29 Thread bearophile
John Colvin: I've been using D heavily for well over a year now and I've never used -w (facepalm) That's good anecdotal evidence that it should be opt-out not opt-in. Brb... Recompiling all my code with -w to find out my stupid mistakes :p If you seem my first point, I am suggesting to

Re: Automatic typing

2013-06-29 Thread Walter Bright
On 6/29/2013 2:53 PM, Ary Borenszweig wrote: On 6/29/13 6:01 PM, Walter Bright wrote: On 6/29/2013 12:18 PM, Ary Borenszweig wrote: What you are asking is essentially what Crystal does for all variables (and types): https://github.com/manastech/crystal/wiki/Introduction#type-inference Your

Re: Automatic typing

2013-06-29 Thread Steven Schveighoffer
On Sat, 29 Jun 2013 17:01:54 -0400, Walter Bright newshou...@digitalmars.com wrote: On 6/29/2013 12:18 PM, Ary Borenszweig wrote: What you are asking is essentially what Crystal does for all variables (and types): https://github.com/manastech/crystal/wiki/Introduction#type-inference Your

Re: Regarding warnings

2013-06-29 Thread Andrej Mitrovic
On 6/30/13, bearophile bearophileh...@lycos.com wrote: If you seem my first point, I am suggesting to remove -w from the switches and to use -wi (actually I am suggesting -wi to become the default compilation mode). Regardless of any FR's I still want to ability for compilation to halt on a

Re: Automatic typing

2013-06-29 Thread Ary Borenszweig
On 6/29/13 7:30 PM, Walter Bright wrote: On 6/29/2013 2:53 PM, Ary Borenszweig wrote: On 6/29/13 6:01 PM, Walter Bright wrote: On 6/29/2013 12:18 PM, Ary Borenszweig wrote: What you are asking is essentially what Crystal does for all variables (and types):

Re: Regarding warnings

2013-06-29 Thread bearophile
Andrej Mitrovic: I still want to ability for compilation to halt on a warning, It's a fair desire, but for it probably the problems in Issue 10321 need to be faced first. As for the whole -w/-wi thing, why can't people just read the list of switches? I have seen tens of times that this

Re: Regarding warnings

2013-06-29 Thread bearophile
Jonathan M Davis: http://d.puremagic.com/issues/show_bug.cgi?id=10147 I have aggregated a request of mine to your issue 10147. Are you OK with this? (What I am asking in addition to your request is for informational warnings to be active on default and to be disabled on request.) Bye,

Re: Automatic typing

2013-06-29 Thread Walter Bright
On 6/29/2013 4:08 PM, Ary Borenszweig wrote: That's a really good example you gave :-) Thanks. I remember seeing it somewhere before, but can't recall just where.

Re: Regarding warnings

2013-06-29 Thread Andrej Mitrovic
On 6/30/13, bearophile bearophileh...@lycos.com wrote: Andrej Mitrovic: I still want to ability for compilation to halt on a warning, It's a fair desire, but for it probably the problems in Issue 10321 need to be faced first. I've added a reply to the bugzilla issue, I think I might not

DMD ICE (issue 10401)

2013-06-29 Thread H. S. Teoh
I've managed to locate the commit that introduced bug 10401, using git bisect: http://d.puremagic.com/issues/show_bug.cgi?id=10401 But I don't have the DMD know-how to figure out what exactly is going on. Any takers? :) T -- Not all rumours are as misleading as this one.

Re: SIMD on Windows

2013-06-29 Thread Manu
You should probably watch my talk again ;) Most of the points I make towards the end when I make the claim almost everyone who tries to use SIMD will see the same or slower performance, and the reason is they have simply revealed other bottlenecks. And I also made the point only by strictly

Re: Compiler could elide many more postblit constructor calls

2013-06-29 Thread Diggory
On Saturday, 29 June 2013 at 17:57:33 UTC, TommiT wrote: On Saturday, 29 June 2013 at 13:47:36 UTC, TommiT wrote: [..] Example: struct S { int[] values; this(this) { values = values.dup; } } void foo(const S) { } void main() { const S s; foo(s); // No need to

Interacting between two different programs

2013-06-29 Thread Jeremy DeHaan
I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem to wrap my head around is how programs like Code Blocks and Visual Studio, and various other IDE's interact with

Re: Get body of a function as string

2013-06-29 Thread Namespace
Oh, hey! I remember participating in writing some of that :) Only Involved? You've written it. I've added only a few things. :)

Re: Interacting between two different programs

2013-06-29 Thread yaz
On Saturday, 29 June 2013 at 06:08:28 UTC, Jeremy DeHaan wrote: I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem to wrap my head around is how programs like Code

Re: Interacting between two different programs

2013-06-29 Thread Anthony J Bonkoski
On Saturday, 29 June 2013 at 06:08:28 UTC, Jeremy DeHaan wrote: I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem to wrap my head around is how programs like Code

Re: Opaque structs

2013-06-29 Thread Johannes Pfau
Am Fri, 28 Jun 2013 22:16:33 +0200 schrieb Andrej Mitrovic andrej.mitrov...@gmail.com: On 6/28/13, Johannes Pfau nos...@example.com wrote: A naive question: Why isn't struct S {} enough? This should be a struct with size 0 so why do we need to disable the constructor and postblit

Re: Opaque structs

2013-06-29 Thread Maxim Fomin
On Saturday, 29 June 2013 at 08:01:17 UTC, Johannes Pfau wrote: Am Fri, 28 Jun 2013 22:16:33 +0200 schrieb Andrej Mitrovic andrej.mitrov...@gmail.com: On 6/28/13, Johannes Pfau nos...@example.com wrote: A naive question: Why isn't struct S {} enough? This should be a struct with size 0 so

Re: zip vs. lockstep -- problems accessing elements by ref

2013-06-29 Thread Joseph Rushton Wakeling
On 06/28/2013 03:19 PM, Joseph Rushton Wakeling wrote: Consider the following equivalent code using zip and lockstep respectively to iterate over the entries in an array and set their values: auto arr1 = new double[10]; foreach(i, ref x; zip(iota(10), arr1)) { x = i;

Re: Get body of a function as string

2013-06-29 Thread Jacob Carlborg
On 2013-06-28 14:46, John Colvin wrote: Is there any way of getting the body of a function as a string? (Obviously only when the source code is available to the compiler) I remember someone someone modified DMD and added a .codeof property or similar. It was fairly easy. -- /Jacob Carlborg

Re: Get body of a function as string

2013-06-29 Thread bearophile
Jacob Carlborg: I remember someone someone modified DMD and added a .codeof property or similar. It was fairly easy. If there are enough use cases for it, then perhaps it's worth putting both the enhancement request for .codeof and its relative patch in Bugzilla. Bye, bearophile

SO Answer - Review

2013-06-29 Thread David
Could someone read over http://stackoverflow.com/a/17379444/969534 and tell me if I missed something and point out any grammatical mistakes and fix them (if you have enough reputation to edit posts) or point them out to me? Thanks

test[0u] of type bool[1u] does not have a boolean value

2013-06-29 Thread Namespace
Is this a bug or is it just me? It seems that the compiler dereference wrong. import std.stdio; void foo(bool[1]* test) { if (test[0]) test[0] = false; } void main() { bool[1] test = false; foo(test); } prints: Error: expression test[0u] of

Re: sort error

2013-06-29 Thread snow
On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: On 06/28/2013 07:00 AM, snow wrote: Hello there, Ive got the following code http://dpaste.dzfl.pl/e391a268 This code throws me a Range Exception in Algorithm.d. If I use a lower number of random vectors, like 100, the code

Re: test[0u] of type bool[1u] does not have a boolean value

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 12:41:12 UTC, Namespace wrote: Is this a bug or is it just me? It seems that the compiler dereference wrong. import std.stdio; void foo(bool[1]* test) { if (test[0]) test[0] = false; } void main() { bool[1] test = false;

Re: test[0u] of type bool[1u] does not have a boolean value

2013-06-29 Thread Namespace
I get this with -wi: bug.d(5): Warning: explicit element-wise assignment (test[0u])[] = false is bett er than test[0u] = false That helps a bit. But I thought that D dereferences automatically? ;)

Re: Opaque structs

2013-06-29 Thread Johannes Pfau
Am Sat, 29 Jun 2013 10:54:32 +0200 schrieb Maxim Fomin ma...@maxim-fomin.ru: On Saturday, 29 June 2013 at 08:01:17 UTC, Johannes Pfau wrote: Am Fri, 28 Jun 2013 22:16:33 +0200 schrieb Andrej Mitrovic andrej.mitrov...@gmail.com: On 6/28/13, Johannes Pfau nos...@example.com wrote: A

Re: test[0u] of type bool[1u] does not have a boolean value

2013-06-29 Thread bearophile
monarch_dodra: Related: I think this might actually give you a compiler warning about doing a range assign without slicing? Bearophile had suggested this shouldn't work unless you actually type: test[0][] = false; But I prefer: test[0] []= false; I can't test right now: Does your code emit

Re: test[0u] of type bool[1u] does not have a boolean value

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 13:11:10 UTC, bearophile wrote: monarch_dodra: Related: I think this might actually give you a compiler warning about doing a range assign without slicing? Bearophile had suggested this shouldn't work unless you actually type: test[0][] = false; But I prefer:

Re: test[0u] of type bool[1u] does not have a boolean value

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 12:57:07 UTC, Namespace wrote: I get this with -wi: bug.d(5): Warning: explicit element-wise assignment (test[0u])[] = false is bett er than test[0u] = false That helps a bit. But I thought that D dereferences automatically? ;) Only when making a function call

Re: sort error

2013-06-29 Thread Ali Çehreli
On 06/29/2013 05:46 AM, snow wrote: On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: Your opCmp does not provide a complete ordering of objects: int opCmp(ref const Vector3D vec) { if (this.x vec.x this.y vec.y this.z vec.z) return 1; if

Re: Opaque structs

2013-06-29 Thread Andrej Mitrovic
On 6/29/13, Johannes Pfau nos...@example.com wrote: Shouldn't doing anything value-related on an empty struct be invalid anyway? Maybe, maybe not. I could imagine it would cause problems if we simply disallowed it, e.g. if you want to copy attributes from one declaration to another.

Re: sort error

2013-06-29 Thread snow
On Saturday, 29 June 2013 at 14:20:05 UTC, Ali Çehreli wrote: On 06/29/2013 05:46 AM, snow wrote: On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: Your opCmp does not provide a complete ordering of objects: int opCmp(ref const Vector3D vec) { if (this.x vec.x

Re: sort error

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 14:20:05 UTC, Ali Çehreli wrote: Not knowing whether it applies to your case, the following is one almost correct way of writing opCmp: int opCmp(ref const Vector3D vec) { return cast(int)(x != vec.x ? x - vec.x

Unable to compile Phobos using wiki's instruction

2013-06-29 Thread Geod24
Hi folks, As I'm learning phobos, I wanted a more inside look and did a co of the libs + dmd. DMD compiles fine (using dmc), as well as druntime. But when it comes to phobos, I'm not able to compile, I get: [...] DMD v2.064-devel-42b668b-dirty DEBUG std.md5 is scheduled for deprecation. Please

Re: Unable to compile Phobos using wiki's instruction

2013-06-29 Thread Andrej Mitrovic
On Saturday, 29 June 2013 at 15:03:05 UTC, Geod24 wrote: Hi folks, As I'm learning phobos, I wanted a more inside look and did a co of the libs + dmd. Try getting the latest druntime from git-head, since these symbols were moved from phobos into druntime a few pull requests ago.

Re: Unable to compile Phobos using wiki's instruction

2013-06-29 Thread Andrej Mitrovic
On Saturday, 29 June 2013 at 15:15:08 UTC, Andrej Mitrovic wrote: On Saturday, 29 June 2013 at 15:14:19 UTC, Andrej Mitrovic wrote: On Saturday, 29 June 2013 at 15:03:05 UTC, Geod24 wrote: Hi folks, As I'm learning phobos, I wanted a more inside look and did a co of the libs + dmd. Try

Re: Unable to compile Phobos using wiki's instruction

2013-06-29 Thread Andrej Mitrovic
On Saturday, 29 June 2013 at 15:14:19 UTC, Andrej Mitrovic wrote: On Saturday, 29 June 2013 at 15:03:05 UTC, Geod24 wrote: Hi folks, As I'm learning phobos, I wanted a more inside look and did a co of the libs + dmd. Try getting the latest druntime from git-head, since these symbols were

Re: Opaque structs

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 08:01:17 UTC, Johannes Pfau wrote: Shouldn't doing anything value-related on an empty struct be invalid anyway? Why ? The fact that the struct has no members is an implementation detail which should have no impact on the user of the struct.

Re: sort error

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 14:54:13 UTC, snow wrote: On Saturday, 29 June 2013 at 14:20:05 UTC, Ali Çehreli wrote: Not knowing whether it applies to your case, the following is one almost correct way of writing opCmp: int opCmp(ref const Vector3D vec) { return cast(int)(x != vec.x

Re: Unable to compile Phobos using wiki's instruction

2013-06-29 Thread Geod24
On Saturday, 29 June 2013 at 15:15:49 UTC, Andrej Mitrovic wrote: On Saturday, 29 June 2013 at 15:15:08 UTC, Andrej Mitrovic wrote: On Saturday, 29 June 2013 at 15:14:19 UTC, Andrej Mitrovic wrote: On Saturday, 29 June 2013 at 15:03:05 UTC, Geod24 wrote: Hi folks, As I'm learning phobos, I

Re: Interacting between two different programs

2013-06-29 Thread Jeremy DeHaan
On Saturday, 29 June 2013 at 07:45:01 UTC, yaz wrote: On Saturday, 29 June 2013 at 06:08:28 UTC, Jeremy DeHaan wrote: I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem

Error: this for method name needs to be type S not type MapResult!...

2013-06-29 Thread Peter Neubauer
Please explain why this error happens in the following code: import std.algorithm; struct S { void foo () { int f1 (int a) { return conv(a); } int delegate (int) f2 = conv; int[] x = [1, 2, 3]; x.map!conv;// ERROR x.map!f1; // fine x.map!f2; // also

Cryptic Error message with scope(failure) and AA

2013-06-29 Thread Anthony Goins
Is this known? I've heard there are many problems with associative arrays. dmd 2.063 --- module scopefailtest; int[char] AAarray; void main(string[] args) { AAarray = ['a':1, 'b':2, 'c':3]; foreach(aa; AAarray) { scope(failure)continue; aa = 32; } } ---

  1   2   >