Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Lutger
Jeremie Pelletier wrote: > Tom S Wrote: ... >> Sweet :D As for a place, there are plenty of options, e.g. >> http://dsource.org/projects/scrapple/ or a separate dsource project. > > I thought of that, but I don't feel like opening a project for just a few > random code snippets or standalone clas

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Nick B
Jeremie Pelletier wrote: Tom S Wrote: Jeremie Pelletier wrote: Tom S Wrote: Jeremie Pelletier wrote: I myself allocate all my meshes and textures directly on the GC and I'm pretty sure its faster than C's malloc and much safer. Hm, why would it be faster with the GC than malloc? I'm pretty

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Tom S
Jeremie Pelletier wrote: Tom S Wrote: Jeremie Pelletier wrote: Tom S Wrote: Jeremie Pelletier wrote: I myself allocate all my meshes and textures directly on the GC and I'm pretty sure its faster than C's malloc and much safer. Hm, why would it be faster with the GC than malloc? I'm pretty

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Jeremie Pelletier
Tom S Wrote: > Jeremie Pelletier wrote: > > Tom S Wrote: > > > >> Jeremie Pelletier wrote: > >>> I myself allocate all my meshes and textures directly on the GC and I'm > >>> pretty sure its faster than C's malloc and much safer. > >> Hm, why would it be faster with the GC than malloc? I'm prett

Re: shared adventures in the realm of thread-safety.

2009-09-13 Thread Robert Jacques
On Sun, 13 Sep 2009 18:08:57 -0400, Jeremie Pelletier wrote: Robert Jacques Wrote: On Sun, 13 Sep 2009 15:04:57 -0400, Jeremie Pelletier wrote: [snip] > Unique data could only be used for aggregate properties, const/immutable > data would also be implicitly unique. This qualifier alon

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Tom S
Jeremie Pelletier wrote: Tom S Wrote: Jeremie Pelletier wrote: I myself allocate all my meshes and textures directly on the GC and I'm pretty sure its faster than C's malloc and much safer. Hm, why would it be faster with the GC than malloc? I'm pretty sure it's the opposite :P Plus, I could

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Jeremie Pelletier
Tom S Wrote: > Jeremie Pelletier wrote: > > Tom S Wrote: > > > >> Jeremie Pelletier wrote: > >>> I haven't had to use the C heap whatsoever so far in D, could you give me > >>> an example of where you need it? In fact, the *only* place I use the C > >>> heap is in my garbage collector's interna

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Tom S
Jeremie Pelletier wrote: Tom S Wrote: Jeremie Pelletier wrote: I haven't had to use the C heap whatsoever so far in D, could you give me an example of where you need it? In fact, the *only* place I use the C heap is in my garbage collector's internals, for pool structs and mark ranges. I use

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Walter Bright
bearophile wrote: An important purpose of a not bug-prone language is remove as many undefined situations as possible. That's right. If you add that to D2 specs, can the compiler catch at compile time all cases of violations to that rule? Unlikely. But that has to be weighed against the for

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Jeremie Pelletier
Tom S Wrote: > Jeremie Pelletier wrote: > > I haven't had to use the C heap whatsoever so far in D, could you give me > > an example of where you need it? In fact, the *only* place I use the C heap > > is in my garbage collector's internals, for pool structs and mark ranges. I > > use pointers

Re: shared adventures in the realm of thread-safety.

2009-09-13 Thread Michel Fortin
On 2009-09-13 18:08:57 -0400, Jeremie Pelletier said: foo1.foo(); // ok, synchronized call synchronized(foo1) foo1.foo(); // warning: recursive synchronization Why a warning? Monitors are designed to handle recursive synchronization. Its a performance issue that can easily be avoided, but s

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Tom S
Jeremie Pelletier wrote: I haven't had to use the C heap whatsoever so far in D, could you give me an example of where you need it? In fact, the *only* place I use the C heap is in my garbage collector's internals, for pool structs and mark ranges. I use pointers to GC memory all the time too,

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread bearophile
Walter Bright: > Don: > > PROPOSAL: > > Change the spec by adding the line to float.html: > > "If the floating-point rounding mode is changed within a function, it > > must be restored before the function exits. If this rule is violated > > (for example, by the use of inline asm), the rounding m

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Jeremie Pelletier
bearophile Wrote: > Justin Johansson: > > >would you mind saying what salient things there are about D that presumably > >attracts to the language. It just helps to know why others are here as one > >ventures into new territory.< > > That's not an easy question. This is a personal answer, oth

Re: Incremental compilation with DMD

2009-09-13 Thread Tom S
Don wrote: Walter Bright wrote: Tom S wrote: Walter Bright wrote: What you can try is creating a database that is basically a lib (call it A.lib) of all the modules compiled with -lib. Then recompile all modules that depend on changed modules in one command, also with -lib, call it B.lib. Th

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Stewart Gordon
Don wrote: Floating point settings are just another case of the same thing, except that currently violations in relation to the former are allowed. There's a fundamental difference between them: the floating point settings are a hardware feature and it is IMPOSSIBLE to avoid them. Actually,

Re: shared adventures in the realm of thread-safety.

2009-09-13 Thread Jeremie Pelletier
Robert Jacques Wrote: > On Sun, 13 Sep 2009 15:04:57 -0400, Jeremie Pelletier > wrote: > [snip] > > Unique data could only be used for aggregate properties, const/immutable > > data would also be implicitly unique. This qualifier alone would > > simplify shared quite a lot, allowing the use

Re: Template Metaprogramming Made Easy (Huh?)

2009-09-13 Thread Justin Johansson
> - If programs run quickly it saves some time. > > A good language has to try to save time in all those ways and more. Tks bearophile for that extensive writeup. A good read. btw. Downloaded the Bud tool (on linux) but couldn't get it to compile. First had to rename usage of "macro" to "makr

Re: shared adventures in the realm of thread-safety.

2009-09-13 Thread Robert Jacques
On Sun, 13 Sep 2009 15:04:57 -0400, Jeremie Pelletier wrote: [snip] Unique data could only be used for aggregate properties, const/immutable data would also be implicitly unique. This qualifier alone would simplify shared quite a lot, allowing the use of unshared objects in shared context

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Walter Bright
Don wrote: PROPOSAL: Change the spec by adding the line to float.html: "If the floating-point rounding mode is changed within a function, it must be restored before the function exits. If this rule is violated (for example, by the use of inline asm), the rounding mode used for subsequent calcu

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Walter Bright
Walter Bright wrote: Don wrote: PROPOSAL: Change the spec by adding the line to float.html: "If the floating-point rounding mode is changed within a function, it must be restored before the function exits. If this rule is violated (for example, by the use of inline asm), the rounding mode used

Re: shared adventures in the realm of thread-safety.

2009-09-13 Thread Jason House
Jeremie Pelletier Wrote: > Jason House Wrote: > > > I'm glad to see I'm not the only one trying to use shared. I tried to use > > it with 2.031 and rapidly hit bug after bug... I submitted several bug > > reports for basic functionality, and none of it appeared in the changelog. > > > > http:/

Re: shared adventures in the realm of thread-safety.

2009-09-13 Thread Jeremie Pelletier
Graham St Jack Wrote: > I'm also having the same problems. > > As Jeremie said, as soon as you start introducing shared methods (via > synchronized for example), you rapidly get into trouble that can only be > overcome by excessive casting. > > It may be possible to contain the problem by refa

Re: Incremental compilation with DMD

2009-09-13 Thread Don
Walter Bright wrote: Tom S wrote: Walter Bright wrote: What you can try is creating a database that is basically a lib (call it A.lib) of all the modules compiled with -lib. Then recompile all modules that depend on changed modules in one command, also with -lib, call it B.lib. Then for all t

Re: shared adventures in the realm of thread-safety.

2009-09-13 Thread Jeremie Pelletier
Jason House Wrote: > I'm glad to see I'm not the only one trying to use shared. I tried to use it > with 2.031 and rapidly hit bug after bug... I submitted several bug reports > for basic functionality, and none of it appeared in the changelog. > > http://d.puremagic.com/issues/show_bug.cgi?id=

Re: std.string phobos

2009-09-13 Thread Don
pc wrote: dsimcha Wrote: == Quote from pc (peng2che...@yahoo.com)'s article Is there a way to make the functions in std.string, such as replace, pure? Many pure functions are going to want to use these. [snip] Here's the catch -- I could not make csvSplit pure. The inner functions were r

Re: Incremental compilation with DMD

2009-09-13 Thread Walter Bright
Tom S wrote: Walter Bright wrote: What you can try is creating a database that is basically a lib (call it A.lib) of all the modules compiled with -lib. Then recompile all modules that depend on changed modules in one command, also with -lib, call it B.lib. Then for all the obj's in B, replace

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Don
Michel Fortin wrote: On 2009-09-13 06:14:02 -0400, Don said: double foo() { return x() + y(); } x() and y() can use whichever rounding modes they like, and if they are impure, they can affect one another, but under this proposal, they cannot change the meaning of the addition inside foo()

Re: std.string phobos

2009-09-13 Thread pc
pc Wrote: > dsimcha Wrote: > > > == Quote from pc (peng2che...@yahoo.com)'s article > > > Is there a way to make the functions in std.string, such as replace, > > > pure? Many > > pure functions are going to want to use these. Also, could some of them be > > executable at compile time? > > > Fo

Re: std.string phobos

2009-09-13 Thread pc
dsimcha Wrote: > == Quote from pc (peng2che...@yahoo.com)'s article > > Is there a way to make the functions in std.string, such as replace, pure? > > Many > pure functions are going to want to use these. Also, could some of them be > executable at compile time? > > For me, using D2.032, this di

Re: XML ecosystem wrt D

2009-09-13 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jarrett Billingsley wrote: > On Sat, Sep 12, 2009 at 8:34 PM, div0 wrote: >> It seems on causal thought that it ought to be possible to machine >> translate it into D, unless Java has under gone massive change since the >> last time I played with it.

Re: Modern Windows GUI visual styles

2009-09-13 Thread Christopher Wright
Tim M wrote: Daniel Keep Wrote: Tim M wrote: Microsoft says to use Application.EnableVisualStyles http://msdn.microsoft.com/en-us/library/system.windows.forms.application.enablevisualstyles.aspx Umm... you do realise that's for .NET, right? Run it through a debugger and you will probably

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Michel Fortin
On 2009-09-13 06:14:02 -0400, Don said: double foo() { return x() + y(); } x() and y() can use whichever rounding modes they like, and if they are impure, they can affect one another, but under this proposal, they cannot change the meaning of the addition inside foo(). Problems still may

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Don
Stewart Gordon wrote: Don wrote: LISTING ONE: real x = foo(1) + foo(2) + foo(3); LISTING TWO: real x1 = foo(1); real x2 = foo(2); real x3 = foo(3); real x = x1 + x2 + x3; In C and C++ (and currently in D), they are NOT equivalent! foo() is allowed to change the floating-point rounding mode,

Re: Floating point rounding modes: we should restrict them slightly

2009-09-13 Thread Don
Walter Bright wrote: Don wrote: PROPOSAL: Change the spec by adding the line to float.html: "If the floating-point rounding mode is changed within a function, it must be restored before the function exits. If this rule is violated (for example, by the use of inline asm), the rounding mode used

Re: Incremental compilation with DMD

2009-09-13 Thread Tom S
Walter Bright wrote: What you can try is creating a database that is basically a lib (call it A.lib) of all the modules compiled with -lib. Then recompile all modules that depend on changed modules in one command, also with -lib, call it B.lib. Then for all the obj's in B, replace the correspon

Re: Incremental compilation with DMD

2009-09-13 Thread Walter Bright
Tom S wrote: Walter Bright wrote: Tom S wrote: Walter Bright wrote: I don't really understand why the -lib approach is not working for your needs. I'm not sure what you mean by "the -lib approach". Just how do you exactly apply it to incremental compilation? If my project has a few hundred

Re: Incremental compilation with DMD

2009-09-13 Thread Tom S
Walter Bright wrote: Tom S wrote: Walter Bright wrote: I don't really understand why the -lib approach is not working for your needs. I'm not sure what you mean by "the -lib approach". Just how do you exactly apply it to incremental compilation? If my project has a few hundred modules and I