Re: D syntax checker for Vim's plugin Syntastic

2012-06-09 Thread Alfredo Di Napoli
you are wrong ldc and gdc are really stable many linux distro embed ldc or gdc Ok, I have to admit that stable was not the best adjective to use. What I wanted to say, actually, is that dmd comes shipped with D (at least here on Mac OS) so for me it seemed to most logical choice. However,

Review of std.uuid is going on!

2012-06-09 Thread Dmitry Olshansky
Cross-posting to cover a wider audience. The review for inclusion of a new module std.uuid into Phobos is in the process in the general .D newsgroup. Links: Code: https://github.com/jpf91/phobos/blob/std.uuid/std/uuid.d API-Docs: http://dl.dropbox.com/u/24218791/d/src/uuid.html Let's keep

Re: Review Queue

2012-06-09 Thread SomeDude
On Friday, 8 June 2012 at 15:44:06 UTC, Jonathan M Davis wrote: So, where do things stand with the review queue now? I thought that we were getting ready to review std.benchmark, but that doesn't appear to have materialized for whatever reason (and I get the impression that Andrei is busy

Re: Rational numbers in D

2012-06-09 Thread SomeDude
On Saturday, 9 June 2012 at 01:11:49 UTC, Stewart Gordon wrote: On 07/06/2012 18:49, Joseph Rushton Wakeling wrote: Sorry for the double-post -- I already asked this in d-learn, but this may be a better place to ask. What's the current state of affairs and roadmap for inclusion of rational

Re: Review Queue

2012-06-09 Thread Johannes Pfau
Am Fri, 08 Jun 2012 23:18:24 +0400 schrieb Dmitry Olshansky dmitry.o...@gmail.com: I recall std.uuid was about to get reviewed. I'd vote for it, as it's nice and short module originating from C++ Boost. I just updated my std.uuid branch to latest phobos/dmd. Seems this time nothing broke,

Re: Review Queue

2012-06-09 Thread Jonathan M Davis
On Saturday, June 09, 2012 09:34:51 Johannes Pfau wrote: I think the changes to opEquals were rolled back, but what are the correct signatures for opEquals and opCmp now? For the moment, the correct way is to declare two overloads, both with const parameters, with one being ref: bool

Re: Review Queue

2012-06-09 Thread Jens Mueller
Jonathan M Davis wrote: So, where do things stand with the review queue now? I thought that we were getting ready to review std.benchmark, but that doesn't appear to have materialized for whatever reason (and I get the impression that Andrei is busy enough at the moment, that it's

Re: Review Queue

2012-06-09 Thread Dmitry Olshansky
On 09.06.2012 11:34, Johannes Pfau wrote: Am Fri, 08 Jun 2012 23:18:24 +0400 schrieb Dmitry Olshanskydmitry.o...@gmail.com: I recall std.uuid was about to get reviewed. I'd vote for it, as it's nice and short module originating from C++ Boost. I just updated my std.uuid branch to latest

Code layout for range-intensive D code

2012-06-09 Thread bearophile
The introduction of UFCS in D offers new ways to format D code, especially when your code uses many high order functions. What is a good layout of the D code in such situations? I have tried several alternative layouts, and in the end I found to appreciate a layout similar to the one used in

Segmented Ranges?

2012-06-09 Thread bearophile
Often enough you have to perform operations on some non-flat sequence, like on a 2D matrix: import std.stdio; void main() { auto m1 = [[], [2, 5], [], [10, 20], [], [], [30, 40, 50]]; foreach (row; m1) foreach (x; row) writeln(x); } Such multi-level ranges are

Re: Segmented Ranges?

2012-06-09 Thread Alex Rønne Petersen
On 09-06-2012 12:45, bearophile wrote: Often enough you have to perform operations on some non-flat sequence, like on a 2D matrix: import std.stdio; void main() { auto m1 = [[], [2, 5], [], [10, 20], [], [], [30, 40, 50]]; foreach (row; m1) foreach (x; row) writeln(x); } Such multi-level

Re: valid uses of shared

2012-06-09 Thread Artur Skawina
On 06/09/12 04:01, mta`chrono wrote: private static shared int counter; // shared across all instances auto i = ++counter; What would you expect to happen here? Every thread to receive an unique value, at least until the counter wraps around? Then evaluating '++counter' needs to

Re: valid uses of shared

2012-06-09 Thread Mike Wey
On 06/09/2012 04:01 AM, mta`chrono wrote: Would this be legal? class A { private static shared int counter; // shared across all instances this() { auto i = ++counter; pragma(msg, typeof(i)); // prints int } } Would it also be legal if the

Re: Segmented Ranges?

2012-06-09 Thread bearophile
In the paper Segmented Iterators and Hierarchical Algorithms Matthew H. Austern offers a solution to regain the lost efficiency: http:// Sorry: http://lafstern.org/matt/segmented.pdf Bye, bearophile

Re: Segmented Ranges?

2012-06-09 Thread Denis Shelomovskij
09.06.2012 19:06, bearophile пишет: In the paper Segmented Iterators and Hierarchical Algorithms Matthew H. Austern offers a solution to regain the lost efficiency: ... http://lafstern.org/matt/segmented.pdf Wow, didn't know there is an article about this. Looks like we all think about same

Re: Review Queue

2012-06-09 Thread Johannes Pfau
Am Sat, 09 Jun 2012 13:01:06 +0400 schrieb Dmitry Olshansky dmitry.o...@gmail.com: On 09.06.2012 11:34, Johannes Pfau wrote: Am Fri, 08 Jun 2012 23:18:24 +0400 schrieb Dmitry Olshanskydmitry.o...@gmail.com: I recall std.uuid was about to get reviewed. I'd vote for it, as it's nice

Re: Rational numbers in D

2012-06-09 Thread bearophile
SomeDude: I've never had any use for rational numbers as have 99% of developers I believe. Maybe I'm overlooking something, but I see only two possible usages of them: math packages and length quotations in the english system. Because of this, I'd rather see them in Deimos than in Phobos.

Re: Code layout for range-intensive D code

2012-06-09 Thread Denis Shelomovskij
09.06.2012 14:43, bearophile пишет: The introduction of UFCS in D offers new ways to format D code, especially when your code uses many high order functions. I have to mention that one shouldn't write range-intensive D code for now. It's too risky to use high level functions in D because it

Re: Review Queue

2012-06-09 Thread Martin Nowak
On Fri, 08 Jun 2012 17:43:47 +0200, Jonathan M Davis jmdavisp...@gmx.com wrote: So, where do things stand with the review queue now? The last change to the ReviewQueue is two month old. http://prowiki.org/wiki4d/wiki.cgi?action=archivecmd=listid=ReviewQueue

Re: Review Queue

2012-06-09 Thread Dmitry Olshansky
On 09.06.2012 20:21, Johannes Pfau wrote: Am Sat, 09 Jun 2012 13:01:06 +0400 schrieb Dmitry Olshanskydmitry.o...@gmail.com: On 09.06.2012 11:34, Johannes Pfau wrote: Am Fri, 08 Jun 2012 23:18:24 +0400 schrieb Dmitry Olshanskydmitry.o...@gmail.com: I recall std.uuid was about to get

Review: std.uuid

2012-06-09 Thread Dmitry Olshansky
The review process stalled long enough, let's kick start it with a small yet a valuable module that was there for quite some time. std.uuid by Johannes Pfau is a rehash of it's C++ twin from well known Boost library. The review cycle takes the usual 2 weeks starting today 9th June, ending

Re: Rational numbers in D

2012-06-09 Thread Joseph Rushton Wakeling
On Saturday, 9 June 2012 at 01:11:49 UTC, Stewart Gordon wrote: Including it in D seems very unlikely. Including it in Phobos, OTOH, is another matter. My bad phrasing. Of course in Phobos. On 09/06/12 08:25, SomeDude wrote: I've never had any use for rational numbers as have 99% of

Re: Rational numbers in D

2012-06-09 Thread Dmitry Olshansky
On 09.06.2012 21:47, Joseph Rushton Wakeling wrote: On Saturday, 9 June 2012 at 01:11:49 UTC, Stewart Gordon wrote: Including it in D seems very unlikely. Including it in Phobos, OTOH, is another matter. My bad phrasing. Of course in Phobos. On 09/06/12 08:25, SomeDude wrote: I've never

Re: Rational numbers in D

2012-06-09 Thread Joseph Rushton Wakeling
On 09/06/12 06:44, Jonathan M Davis wrote: AFAIK, dsimcha has never proposed that it be added to the review queue or Phobos. I, for one, didn't know he was working on anything of the sort. Presumably, if he has the time to work on it and thinks that it's worth adding to Phobos, he'll submit it

Re: Rational numbers in D

2012-06-09 Thread Joseph Rushton Wakeling
On 09/06/12 16:08, bearophile wrote: I have had to use Rational nunbers in D two or three times (once during simplification of expressions that contain operations among integer numbers, to not lose exact precision with floating point numbers). I have written a rationals module for D1 and later I

Re: Segmented Ranges?

2012-06-09 Thread Andrei Alexandrescu
On 6/9/12 5:45 AM, bearophile wrote: Often enough you have to perform operations on some non-flat sequence, Would joiner help? Andrei

Re: synchronized (this[.classinfo]) in druntime and phobos

2012-06-09 Thread Christophe Travert
deadalnix , dans le message (digitalmars.D:169136), a écrit : It open door for stuff like : ReadWriteLock rw; synchronized(rw.read) { } synchronized(rw.write) { } And many types of lock : spin lock, interprocesses locks, semaphores, . . . And all can be used with the synchronized

Re: Rational numbers in D

2012-06-09 Thread Jonathan M Davis
On Saturday, June 09, 2012 18:55:14 Joseph Rushton Wakeling wrote: What do you think of the idea of a priority wish list of functionality for D and/or Phobos? Do you think it would be a useful way to guide contributors to where they might be useful? (I would view the priorities as being set

static array literal syntax request: auto x=[1,2,3]S;

2012-06-09 Thread timotheecour
(apologies for cross-posting here, I feel this is a better place to ask than in my original post where I only received 1 answer that seemed in favor of this: http://d.puremagic.com/issues/show_bug.cgi?id=8008 which was 2 months ago). Please see to the original post above to see the proposal

Re: static array literal syntax request: auto x=[1,2,3]S;

2012-06-09 Thread Timon Gehr
On 06/10/2012 12:05 AM, timotheecour wrote: (apologies for cross-posting here, I feel this is a better place to ask than in my original post where I only received 1 answer that seemed in favor of this: http://d.puremagic.com/issues/show_bug.cgi?id=8008 which was 2 months ago). Please see to the

Re: static array literal syntax request: auto x=[1,2,3]S;

2012-06-09 Thread Jonathan M Davis
On Sunday, June 10, 2012 00:15:01 Timon Gehr wrote: D static array literals don't perform a costly heap allocation. It is simply a bug in the implementation. This is not a compelling reason to add new syntax. D doesn't _have_ static array literals. It only has dynamic array literals. int[5] a

Re: static array literal syntax request: auto x=[1,2,3]S;

2012-06-09 Thread Timon Gehr
On 06/10/2012 12:34 AM, Jonathan M Davis wrote: On Sunday, June 10, 2012 00:15:01 Timon Gehr wrote: D static array literals don't perform a costly heap allocation. It is simply a bug in the implementation. This is not a compelling reason to add new syntax. D DMD doesn't _have_ static

Mersenne Twister Seeding and UUIDs

2012-06-09 Thread Andrew Talbot
Forgive what may be the unintelligible ramblings of an ignorant hobbyist, but, if I am not mistaken, the Mersenne Twister implementation in std.random currently can be seeded only with a 32-bit unsigned integer, which I presume gives it 2^32 starting points, whereas I believe there should also

Re: Rational numbers in D

2012-06-09 Thread Stewart Gordon
On 09/06/2012 18:47, Joseph Rushton Wakeling wrote: On Saturday, 9 June 2012 at 01:11:49 UTC, Stewart Gordon wrote: Including it in D seems very unlikely. Including it in Phobos, OTOH, is another matter. My bad phrasing. Of course in Phobos. On 09/06/12 08:25, SomeDude wrote: I've never

Re: static array literal syntax request: auto x=[1,2,3]S;

2012-06-09 Thread Alex Rønne Petersen
On 10-06-2012 01:02, Timon Gehr wrote: On 06/10/2012 12:34 AM, Jonathan M Davis wrote: On Sunday, June 10, 2012 00:15:01 Timon Gehr wrote: D static array literals don't perform a costly heap allocation. It is simply a bug in the implementation. This is not a compelling reason to add new

Re: toImpl deprecated, use opCast instead?

2012-06-09 Thread timotheecour
What is the recommended approach when we have no control over classes A or B (cf from 3rd party) to convert A to B? It seems UFCS doesn't work in that case. Could you please provide an example code? Thanks!

Re: static array literal syntax request: auto x=[1,2,3]S;

2012-06-09 Thread Jonathan M Davis
On Sunday, June 10, 2012 01:02:40 Timon Gehr wrote: On 06/10/2012 12:34 AM, Jonathan M Davis wrote: On Sunday, June 10, 2012 00:15:01 Timon Gehr wrote: D static array literals don't perform a costly heap allocation. It is simply a bug in the implementation. This is not a compelling reason

Re: toImpl deprecated, use opCast instead?

2012-06-09 Thread Jonathan M Davis
On Sunday, June 10, 2012 02:26:36 timotheecour wrote: What is the recommended approach when we have no control over classes A or B (cf from 3rd party) to convert A to B? It seems UFCS doesn't work in that case. Could you please provide an example code? Thanks! If you want to convert between

Re: Rational numbers in D

2012-06-09 Thread Joseph Rushton Wakeling
On 10/06/12 00:52, Stewart Gordon wrote: By using an integer type to store pitches in such a way that the semitone is the basic unit. Do you compose music that makes use of demisemitones, thirds of tones, and so on? Yes, I use quarter-tones. Other people use other intervals (e.g. in Turkish

Re: Rational numbers in D

2012-06-09 Thread dsimcha
A long time ago, this was discussed on this forum. I wrote the current candidate for std.rational, and there was talk of Don Clugston integrating the GCD function into std.bigint to take advantage of knowing BigInt's internals. According to Don, using a general algorithm here results in

Re: const version for foreach/opApply

2012-06-09 Thread Matthias Walter
On 2012-06-08 22:47, Era Scarecrow wrote: On Friday, 8 June 2012 at 16:33:28 UTC, Matthias Walter wrote: Hi, trying to traverse the entries of a std.bitmanip.BitArray I stumbled upon the following problem: In case I want to accept const(BitArray) objects, it shall look like the following

Re: Segmentation fault hell in D

2012-06-09 Thread Dejan Lekic
On Fri, 08 Jun 2012 19:57:47 -0700, Andrew Wiley wrote: On Fri, Jun 8, 2012 at 11:29 AM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Friday, June 08, 2012 19:30:57 Jarl André jarl.an...@gmail.com@puremagic.com wrote: Evry single time I encounter them I yawn. It means using the next

Using keyword as package name

2012-06-09 Thread Roman D. Boiko
I generate bindings to a c library, and one of folders is named `shared`, which is a keyword and thus cannot be used as a package name. One option is to remove this package and put files to a parent directory, or simply rename it. Is there any way to avoid this and keep the name as is? What

Re: Is D actually |-----------this-----powerful-----------|?

2012-06-09 Thread David Piepgrass
Oops, forgot the code. 4. Unit inference engine: Given some notation for optionally indicating units, e.g. unit(value), could a D metaprogram examine the following code, infer the correct units, and issue an error message on the last line? auto mass = kg(2.0); auto accel = 1.0; auto force =

Re: Segmentation fault hell in D

2012-06-09 Thread Andrew Wiley
On Sat, Jun 9, 2012 at 6:09 AM, Dejan Lekic dejan.le...@gmail.com wrote: On Fri, 08 Jun 2012 19:57:47 -0700, Andrew Wiley wrote: On Fri, Jun 8, 2012 at 11:29 AM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Friday, June 08, 2012 19:30:57 Jarl André jarl.an...@gmail.com@puremagic.com wrote:

Re: floats default to NaN... why?

2012-06-09 Thread Minas
With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to something else like -infinity is still not a good choice. I think that

Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Chris Saunders
Hi -- I've been trying to learn more about D's purity features after reading David Nadlinger's interesting post on this topic. While 'purifying' some existing code I discovered that I can't use roundTo in a pure function, and I don't understand why. Is this a general problem with most

Re: floats default to NaN... why?

2012-06-09 Thread Kevin
On 09/06/12 14:42, Minas wrote: With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to something else like -infinity is still

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 09/06/12 20:48, Kevin wrote: On 09/06/12 14:42, Minas wrote: With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to

Re: floats default to NaN... why?

2012-06-09 Thread Kevin
On Sat 09 Jun 2012 14:59:21 EDT, Jerome BENOIT wrote: On 09/06/12 20:48, Kevin wrote: On 09/06/12 14:42, Minas wrote: With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 09/06/12 20:42, Minas wrote: With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to something else like -infinity is still

Re: Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Jonathan M Davis
On Saturday, June 09, 2012 20:43:42 Chris Saunders wrote: Hi -- I've been trying to learn more about D's purity features after reading David Nadlinger's interesting post on this topic. While 'purifying' some existing code I discovered that I can't use roundTo in a pure function, and I don't

Re: const version for foreach/opApply

2012-06-09 Thread Era Scarecrow
On Saturday, 9 June 2012 at 10:09:25 UTC, Matthias Walter wrote: First, thank you for your answer. I've already made some tiny modifications in order to make BitArray work for my purposes: https://github.com/xammy/phobos/commit/eb46d99217f2bf1e6d173964e2954248b08146d6 If you plan to create

Re: floats default to NaN... why?

2012-06-09 Thread Andrew Wiley
On Sat, Jun 9, 2012 at 4:53 PM, Andrew Wiley wiley.andre...@gmail.com wrote: On Sat, Jun 9, 2012 at 11:57 AM, Kevin kevincox...@gmail.com wrote: On Sat 09 Jun 2012 14:59:21 EDT, Jerome BENOIT wrote: On 09/06/12 20:48, Kevin wrote: On 09/06/12 14:42, Minas wrote: With ints, the best

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
Hello: On 10/06/12 01:57, Andrew Wiley wrote: On Sat, Jun 9, 2012 at 4:53 PM, Andrew Wileywiley.andre...@gmail.com wrote: On Sat, Jun 9, 2012 at 11:57 AM, Kevinkevincox...@gmail.com wrote: On Sat 09 Jun 2012 14:59:21 EDT, Jerome BENOIT wrote: On 09/06/12 20:48, Kevin wrote: On

Re: floats default to NaN... why?

2012-06-09 Thread Jonathan M Davis
On Sunday, June 10, 2012 02:32:18 Jerome BENOIT wrote: I see. So the alternative, to get a kind of NaN effect, would be to set integers to their hardware extremum (INT_MAX,SIZE_MAX,...). But this option is hardware dependent, so zero as default for integers sounds the best option. ??? All

Re: Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Chris Saunders
On Saturday, 9 June 2012 at 19:33:55 UTC, Jonathan M Davis wrote: On Saturday, June 09, 2012 20:43:42 Chris Saunders wrote: Hi -- I've been trying to learn more about D's purity features after reading David Nadlinger's interesting post on this topic. While 'purifying' some existing code I

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 10/06/12 02:49, Jonathan M Davis wrote: On Sunday, June 10, 2012 02:32:18 Jerome BENOIT wrote: I see. So the alternative, to get a kind of NaN effect, would be to set integers to their hardware extremum (INT_MAX,SIZE_MAX,...). But this option is hardware dependent, so zero as default for

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 10/06/12 02:49, Jonathan M Davis wrote: On Sunday, June 10, 2012 02:32:18 Jerome BENOIT wrote: I see. So the alternative, to get a kind of NaN effect, would be to set integers to their hardware extremum (INT_MAX,SIZE_MAX,...). But this option is hardware dependent, so zero as default for

Re: Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Jonathan M Davis
On Sunday, June 10, 2012 04:06:03 Chris Saunders wrote: Thanks Jonathan. Sounds like a practical issue rather than some theoretical problem -- good to know. The vast majority of purity issues with Phobos are purely an implementation issue and not any kind of limit in the language. Obviously

[Issue 8211] ICE: Compiling two files with main functions

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8211 Don clugd...@yahoo.com.au changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 8213] New: Incorrect error message with pointer to ubyte[] and front

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8213 Summary: Incorrect error message with pointer to ubyte[] and front Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity:

[Issue 8195] Segfault when comparing a VariantN to a non-variant type which it holds

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8195 --- Comment #2 from github-bugzi...@puremagic.com 2012-06-09 02:32:41 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos

[Issue 8195] Segfault when comparing a VariantN to a non-variant type which it holds

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8195 --- Comment #3 from github-bugzi...@puremagic.com 2012-06-09 02:35:10 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/phobos

[Issue 8195] Segfault when comparing a VariantN to a non-variant type which it holds

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8195 Jonathan M Davis jmdavisp...@gmx.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 8214] New: blocking option for TaskPool.finish()

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8214 Summary: blocking option for TaskPool.finish() Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2

[Issue 8214] blocking option for TaskPool.finish()

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8214 John Belmonte j...@neggie.net changed: What|Removed |Added CC||dsim...@yahoo.com ---

[Issue 8214] blocking option for TaskPool.finish()

2012-06-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8214 --- Comment #2 from John Belmonte j...@neggie.net 2012-06-09 20:39:07 PDT --- I do prefer this being an option to finish() rather than a separate join() function. We all understand what finish() does and it's not a stretch at all to accept