Re: Best practice and module declarations

2010-07-15 Thread Philippe Sigaud
I was wondering what the general consesus was (if there is one) on whether >> it's >> valuable to always put module declarations in each module. >> > > I can't think of any particularly strong reasons to have it or not to have >> it. >> My first reaction is to just always use it, but thinking abou

style sheets for a2ps

2010-07-15 Thread Helmut Jarausch
Hi, does any know where to get style sheets for a2ps for D. Many thanks, Helmut.

Re: Is synchronized(mutex) == mutex.lock()?

2010-07-15 Thread Steven Schveighoffer
On Wed, 14 Jul 2010 23:22:20 -0400, Heywood Floyd wrote: Hi! Breakfast toast: Is there any chance a) and b) below are identical in what they do? auto mutex = new Mutex(); auto cond = new Condition(mutex); // a) synchronized(mutex){ cond.wait(); } // b) mutex.lock(); cond.wait();

Re: Multi dimensional array question.

2010-07-15 Thread Lars T. Kyllingstad
On Wed, 14 Jul 2010 16:57:13 -0400, Heywood Floyd wrote: > Lars T. Kyllingstad Wrote: > > >> But then arrays would be different from all other types! If you have >> an array of 3 Ts, that is written T[3], regardless of what T is. Now >> consider these two cases: >> >>A. T is an int. Then

Re: Multi dimensional array question.

2010-07-15 Thread bearophile
Jonathan M Davis: > [5](int) const a; Go language uses something similar, and I find it a bit better than D syntax. Bye, bearophile

Re: Is synchronized(mutex) == mutex.lock()?

2010-07-15 Thread Heywood Floyd
Steven Schveighoffer Wrote: > On Wed, 14 Jul 2010 23:22:20 -0400, Heywood Floyd > wrote: > > > Hi! > > > > Breakfast toast: Is there any chance a) and b) below are identical in > > what they do? > > > > > > auto mutex = new Mutex(); > > auto cond = new Condition(mutex); > > > > // a) > > syn

Re: Best practice and module declarations

2010-07-15 Thread Rory McGuire
On Thu, 15 Jul 2010 00:22:34 +0200, Jonathan M Davis wrote: I was wondering what the general consesus was (if there is one) on whether it's valuable to always put module declarations in each module. Obviously, if you need the module to have a name other than the file name, then you need

Re: Best practice and module declarations

2010-07-15 Thread torhu
On 15.07.2010 21:59, Rory McGuire wrote: From what I remember in TDPL: Can be used to rename a module if you have it in a different directory structure than how you use it. E.g. implementation and "headers" in separate folders. If you use *.di files (headers), you would normally just keep the

Re: Best practice and module declarations

2010-07-15 Thread Rory McGuire
On Thu, 15 Jul 2010 23:08:07 +0200, torhu wrote: On 15.07.2010 21:59, Rory McGuire wrote: From what I remember in TDPL: Can be used to rename a module if you have it in a different directory structure than how you use it. E.g. implementation and "headers" in separate folders. If you use *.

Re: Best practice and module declarations

2010-07-15 Thread torhu
On 15.07.2010 23:28, Rory McGuire wrote: On Thu, 15 Jul 2010 23:08:07 +0200, torhu wrote: On 15.07.2010 21:59, Rory McGuire wrote: From what I remember in TDPL: Can be used to rename a module if you have it in a different directory structure than how you use it. E.g. implementation and

Overzealous immutable and classes

2010-07-15 Thread Gareth Charnock
So having got a collectors' edition TDPL, I though I'd have a try at writing some concurrent code. The idea was a worker thread(s) would do some work and write the results to some immutable objects. These would get passed to an indexer thread that would do neat stuff like indexing the reference

Re: Is the memory address of classinfo the same for all instances of a class?

2010-07-15 Thread Gareth Charnock
On 02/07/10 15:18, Heywood Floyd wrote: On Jul 2, 2010, at 15:34 , Steven Schveighoffer wrote: On Fri, 02 Jul 2010 09:32:39 -0400, Steven Schveighoffer wrote: On Fri, 02 Jul 2010 09:24:20 -0400, Heywood Floyd wrote: Good day! Consider // - - - - class Foo{} auto one = new Foo(); aut

Re: Overzealous immutable and classes

2010-07-15 Thread Jonathan M Davis
On Thursday, July 15, 2010 17:40:26 Gareth Charnock wrote: > So having got a collectors' edition TDPL, I though I'd have a try at > writing some concurrent code. The idea was a worker thread(s) would do > some work and write the results to some immutable objects. These would > get passed to an inde

Re: Overzealous immutable and classes

2010-07-15 Thread Gareth Charnock
On 16/07/10 02:08, Jonathan M Davis wrote: On Thursday, July 15, 2010 17:40:26 Gareth Charnock wrote: So having got a collectors' edition TDPL, I though I'd have a try at writing some concurrent code. The idea was a worker thread(s) would do some work and write the results to some immutable obje

Re: Overzealous immutable and classes

2010-07-15 Thread bearophile
Jonathan M Davis: > It's not terribly pretty, but apparently no one could come up with a > satistfactory way of doing it in the language itself given the syntax for > references. So, Rebindable!(T) is the solution. A helper function can help: import std.stdio, std.typecons, std.traits; templat

Re: CT usage only in executable

2010-07-15 Thread strtr
== Quote from strtr (st...@sp.am)'s article > == Quote from bearophile (bearophileh...@lycos.com)'s article > > strtr: > > > Not that the memory is really significant compared to the rest of my > > > program, > > > but I have a few fairly large arrays I use only in compile time and I was > > > won

Re: Multi dimensional array question.

2010-07-15 Thread bearophile
Jonathan M Davis: > Personally, I'd advise you to just use dynamic arrays unless you do > some profiling and find that a static array is better in a particular case. To program you need a less naive view. I sometimes start using dynamic arrays everywhere because they are handy, then I profile cod

Re: CT usage only in executable

2010-07-15 Thread bearophile
strtr: > Too busy reading TDPL? ;) I have not answered because my answer is not useful: I am sure that constant is present in the binary, you probably need LDC with Link-Time Optimization activated to remove them. > btw. how long until runtime mixins? :D D compiler contains an interpreter. It

Re: Multi dimensional array question.

2010-07-15 Thread Jonathan M Davis
On Thursday 15 July 2010 22:20:17 bearophile wrote: > Jonathan M Davis: > > Personally, I'd advise you to just use dynamic arrays unless you do > > some profiling and find that a static array is better in a particular > > case. > > To program you need a less naive view. I sometimes start using dyn