Re: string initialization question.

2010-07-30 Thread Justin Spahr-Summers
On Fri, 30 Jul 2010 16:30:17 -0700, Jonathan M Davis wrote: > On Friday, July 30, 2010 14:13:15 dcoder wrote: > > If I'm writing a program that pretty prints tree data, or output of sql, > > like Oracle's sqlplus, or postgres equivalent, I find having such a > > utility function/constructor a pre

Re: string initialization question.

2010-07-30 Thread Justin Spahr-Summers
On Fri, 30 Jul 2010 11:35:15 -0400, Steven Schveighoffer wrote: > > On Fri, 30 Jul 2010 11:24:41 -0400, dcoder wrote: > > > Hello. > > > > Is there anyway in D to convenient fill a string variable with a char > > say X times? > > > > So, I'd like to do something like: > > > > string divider(

Re: Single "alias this"

2010-07-25 Thread Justin Spahr-Summers
On Sun, 25 Jul 2010 10:53:51 -0400, bearophile wrote: > Deokjae Lee: > > > //interfaces first, base class last > > class Foo : I1, I2, Base {} > > > > This doesn't compile. > > I didn't know the order of base class and interfaces matter. > > If not already present, that looks good for Bugzilla

Re: Grokking concurrency, message passing and Co

2010-07-12 Thread Justin Spahr-Summers
On Mon, 12 Jul 2010 00:03:53 +0200, BLS wrote: > > On 11/07/2010 21:29, Philippe Sigaud wrote: > > I tried this because I was reading an article on Scala's actors, where > > they talk about millions of actors. I guess they are quite different. > > Google for fibers or have a look at the dreactor

Re: Any special linking for _NSGetExecutablePath on OSX?

2010-07-08 Thread Justin Spahr-Summers
On Thu, 8 Jul 2010 19:24:52 -0400, Nick Sabalausky wrote: > > I need to use OSX's _NSGetExecutablePath, and I've declared it: > > extern(C) int _NSGetExecutablePath(char* buf, uint* bufsize); > > I don't have access to a OSX box to test it on ATM, so I need to know: Is > there anything I need

Re: Class knowing its own Class

2010-06-30 Thread Justin Spahr-Summers
On Wed, 30 Jun 2010 22:59:50 +0200, Tomek Sowinski wrote: > > Dnia 30-06-2010 o 00:13:28 strtr napisal(a): > > > == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > >> On Tue, 29 Jun 2010 17:59:37 -0400, strtr wrote: > >> > What is the pretty way to do something like this? > >

Re: A module comprehensive template-specialization

2010-06-28 Thread Justin Spahr-Summers
On Sun, 27 Jun 2010 18:51:35 +0200, Matthias Walter wrote: > > Hi list, > > I tried to write a traits class comparable to iterator_traits in C++ STL > or graph_traits in Boost Graph Library in D 2.0, but failed to do so via > template specialization which is put into different modules. Putting

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-18 Thread Justin Spahr-Summers
On Fri, 18 Jun 2010 08:41:17 -0700, Justin Spahr-Summers wrote: > > On Fri, 18 Jun 2010 01:25:32 -0400, Chick Corea > wrote: > > Those are the result of code that I pulled directly from the D v1 docs from > > > >     http://www.digitalmars.com/d/1.0/arrays.html

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-18 Thread Justin Spahr-Summers
On Fri, 18 Jun 2010 01:25:32 -0400, Chick Corea wrote: > Those are the result of code that I pulled directly from the D v1 docs from > >     http://www.digitalmars.com/d/1.0/arrays.html > > Specifically, the code is this. > >         int* p; >         int[3] s; >         int[] a; >         p =

Re: Minimize lock time

2010-06-10 Thread Justin Spahr-Summers
On Thu, 10 Jun 2010 12:42:09 +0200, Simen kjaeraas wrote: > > Kagamin wrote: > > > Let's consider the following code: > > > > synchronized(syncRoot) > > { > > if(condition)opSuccess(); > > else writeln(possibly,slow); > > } > > > > Suppose the else close doesn't need to be executed in lock

Re: Minimize lock time

2010-06-10 Thread Justin Spahr-Summers
On Thu, 10 Jun 2010 02:54:37 -0400, Kagamin wrote: > > Let's consider the following code: > > synchronized(syncRoot) > { > if(condition)opSuccess(); > else writeln(possibly,slow); > } > > Suppose the else close doesn't need to be executed in lock domain and can be > slow. How to minimize l

Re: metaprogramming question

2010-04-18 Thread Justin Spahr-Summers
On Mon, 19 Apr 2010 07:28:09 +0200, Philippe Sigaud wrote: > > On Mon, Apr 19, 2010 at 05:21, Justin Spahr-Summers < > justin.spahrsumm...@gmail.com> wrote: > > > You can use some expression tuple magic to accomplish something like > > that: >

Re: metaprogramming question

2010-04-18 Thread Justin Spahr-Summers
On Mon, 19 Apr 2010 00:12:28 + (UTC), Graham Fawcett wrote: > > Hi folks, > > I'd like to wrap a family of C functions that look like this: > > gboolean fooXXX(arg1, ..., argN, GError** err) > > Their signatures and arities vary, but they all have a GError** as > their last argument

Re: ^^ implementation [Was: Re: Code speed]

2010-04-14 Thread Justin Spahr-Summers
On Wed, 14 Apr 2010 05:58:55 -0400, bearophile wrote: > > Don: > > >Raising to a float power is really a niche feature.< > > Used it as x^^0.5 to perform the square root is not a niche feature, square > roots are common enough. > And sqrt is an intrinsic, it doesn't need all std.math. I thin

Re: Confused about class equality

2010-04-07 Thread Justin Spahr-Summers
On Tue, 06 Apr 2010 23:35:01 -0400, strtr wrote: > > Justin Spahr-Summers Wrote: > > > > Hmm, that is pretty weird. Are you doing any casts anywhere, or any > > pointer arithmetic/tricks? > A search for cast didn't show any related casts. > Do you maybe k

Re: Confused about class equality

2010-04-06 Thread Justin Spahr-Summers
On Tue, 06 Apr 2010 22:41:43 -0400, strtr wrote: > > Justin Spahr-Summers Wrote: > > > > I think he said that he has two distinct object references, but the > > value stored in the object(s) changes by changing either one. > > > > In other words, we

Re: Confused about class equality

2010-04-06 Thread Justin Spahr-Summers
On Tue, 06 Apr 2010 21:15:02 -0400, bearophile wrote: > > Time ago I have told Walter that adding images with pointers and boxes to the > D docs, that represent the main data structures used in D, can help a lot the > understanding and usage of D. > > When you *see* the data structure in an i

Re: Comparing Two Type Tuples

2010-04-05 Thread Justin Spahr-Summers
On Mon, 5 Apr 2010 15:47:10 + (UTC), BCS wrote: > > Hello Justin Spahr-Summers, > > > On Mon, 5 Apr 2010 02:59:15 + (UTC), BCS wrote: > > > >> Hello Daniel, > >> > >>> Heya ppl! > >>> > >>> I was wondering

Re: Comparing Two Type Tuples

2010-04-05 Thread Justin Spahr-Summers
On Mon, 5 Apr 2010 02:59:15 + (UTC), BCS wrote: > > Hello Daniel, > > > Heya ppl! > > > > I was wondering how could I write a function that takes two Type > > Tuples as arguments and returns true if they are match. > > > > Could anyone help me with this? > > > > Thanks! > > > > here is m

Re: Comparing Two Type Tuples

2010-04-04 Thread Justin Spahr-Summers
On Sun, 4 Apr 2010 21:05:49 + (UTC), Daniel Ribeiro Maciel wrote: > > Heya ppl! > > I was wondering how could I write a function that takes two Type > Tuples as arguments and returns true if they are match. > > Could anyone help me with this? > > Thanks! You can really only pass a single

Re: Confused about class equality

2010-04-04 Thread Justin Spahr-Summers
On Sun, 04 Apr 2010 13:14:29 -0400, strtr wrote: > > Ali Çehreli Wrote: > > > > The code works as expected with 2.042 > > > > I had to modify the toString() functions to return string, and say > > "override" in C's toString definition; and had to modify the writefln() > > calls: > > > >

Re: Confused about class equality

2010-04-02 Thread Justin Spahr-Summers
On Fri, 02 Apr 2010 22:36:40 -0400, strtr wrote: > > The program below outputs, as I would expect : > Same Value. > Same Object. > 3 : 44E15C > 3 : 44E15C > 5 : 44E15C > 5 : 44E15C > > Now what would it mean if it were to output : > Same Value. > 3 : 5B536C 59D020 > 3 : 59CE0