Re: Minor issue - zero-length fixed size arrays in variable-sized structs..

2009-07-09 Thread Tim Matthews
Daniel Keep wrote: You'd have to be mad to use it like that. I am mad. struct S { int a; private { size_t size; char[0] data; } char[] message() { return data.ptr[0..length]; } size_t length() { return size; } S* opCall(size_t size) { return cast(S*)((new uby

Enhancement request

2009-07-09 Thread Sjoerd van Leent
As D is typically a system language, this enhancement might not make it, but I still think it would be practical. I've been thinking of a real world example for this, and yesterday found a nice example to illustrate. Suppose you would be creating an API to interrogate a database. Now within the

Re: Enhancement request

2009-07-09 Thread Kagamin
Sjoerd van Leent Wrote: > Now the compiler knows that it has to do some magic stuff to make the fields > accessible using strings etc. > > I know that it might be possible to do all of this through the vtable, > classinfo, typeinfo and so on, but it doesn't appear to be very > straightforward.

Re: Enhancement request

2009-07-09 Thread Daniel Keep
D2 has a getMembers method in TypeInfo and ClassInfo that would probably do the job. Only problem is that the compiler doesn't actually generate the function for it. I asked about it a while ago, but never got a response.

Re: Enhancement request

2009-07-09 Thread Sjoerd van Leent
Daniel Keep Wrote: > > D2 has a getMembers method in TypeInfo and ClassInfo that would probably > do the job. Only problem is that the compiler doesn't actually generate > the function for it. > > I asked about it a while ago, but never got a response. I've noticed this message a while ago. I

Re: Bartosz asks What’s Wrong with the Th

2009-07-09 Thread Sjoerd van Leent
Bartosz Milewski Wrote: > Walter Bright Wrote: > > > http://www.reddit.com/r/programming/comments/8z3wm/whats_wrong_with_the_thread_object/ > > The bottom line of this post is that the current Thread object in D should be > abandoned and replaced by a more primitive "spawn" function. If there a

Re: Enhancement request

2009-07-09 Thread Robert Clipsham
Sjoerd van Leent wrote: As D is typically a system language, this enhancement might not make it, but I still think it would be practical. I've been thinking of a real world example for this, and yesterday found a nice example to illustrate. Suppose you would be creating an API to interrogate

Re: Enhancement request

2009-07-09 Thread Sjoerd van Leent
Robert Clipsham Wrote: > Sjoerd van Leent wrote: > > As D is typically a system language, this enhancement might not make it, > > but I still think it would be practical. > > > > I've been thinking of a real world example for this, and yesterday found a > > nice example to illustrate. > > > >

Re: Bartosz asks What’s Wrong with the Th

2009-07-09 Thread Sean Kelly
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Wed, 08 Jul 2009 19:34:51 -0400, Bartosz Milewski > wrote: > > Walter Bright Wrote: > > > >> http://www.reddit.com/r/programming/comments/8z3wm/whats_wrong_with_the_thread_object/ > > > > The bottom line of this post is that t

Re: Minor issue - zero-length fixed size arrays in variable-sized structs..

2009-07-09 Thread Jarrett Billingsley
On Thu, Jul 9, 2009 at 2:38 AM, Daniel Keep wrote: > > You'd have to be mad to use it like that. > > struct S > { >    int a; >    private { size_t size; char[0] data; } >    char[] message() { return data.ptr[0..length]; } >    size_t length() { return size; } > >    S* opCall(size_t size) >    {

new DIP2: Const code bloat

2009-07-09 Thread Kagamin
DiP2 is here. Check it. http://www.prowiki.org/wiki4d/wiki.cgi?DiPs http://www.prowiki.org/wiki4d/wiki.cgi?DiP2 ps code markup is not very nice.

Is DFL still developed?

2009-07-09 Thread Trass3r
Last release was some time ago, is it still under development? I like its style, would be a pity if not.

Re: new DIP2: Const code bloat

2009-07-09 Thread bearophile
Kagamin: > DiP2 is here. Check it. > http://www.prowiki.org/wiki4d/wiki.cgi?DiP2 It misses the Author field. Also an optional field for the suggested way to implement something can be positive. Bye, bearophile

Re: Case Range Statement ..

2009-07-09 Thread Bill Baxter
On Wed, Jul 8, 2009 at 8:26 PM, Walter Bright wrote: > Bill Baxter wrote: >> >> I think what Jerome is getting at is that we could be getting more >> mileage out of the xpr1..xpr2 syntax.  It would be useful syntax for >> more than just integral, dense ranges in foreach and slices.  The >> equivale

Re: Is DFL still developed?

2009-07-09 Thread Tim Matthews
Trass3r wrote: Last release was some time ago, is it still under development? Last change was 3 months so yes but slow. At least it's not dead like minwin. I like its style, would be a pity if not. Great static linked, light weight, tool kit for windows while still having a lot of featur

Re: Is DFL still developed?

2009-07-09 Thread Trass3r
Tim Matthews schrieb: Great static linked, light weight, tool kit for windows while still having a lot of features. kinda OT but the dprogramming domain would be a great way to promote d (from the dfl guy) but it is not really used enough. Exactly. Unfortunately I can't get it to run, always

Re: Is DFL still developed?

2009-07-09 Thread Robert Jacques
On Thu, 09 Jul 2009 11:14:49 -0400, Trass3r wrote: Tim Matthews schrieb: Great static linked, light weight, tool kit for windows while still having a lot of features. kinda OT but the dprogramming domain would be a great way to promote d (from the dfl guy) but it is not really used enough.

Re: Bartosz asks What’s Wrong with the Th

2009-07-09 Thread Bartosz Milewski
Sean Kelly Wrote: > It would be trivial to implement spawn on top of the Thread object. Not so trivial, as I would like the spawn function to be a variadic template. > And > the reverse would work as well, though it would be less practical. After > all, some data must be used to represent a t

Re: Case Range Statement ..

2009-07-09 Thread bearophile
Bill Baxter: > Python's are a little annoying in that, like D, you can't use > them outside of indexing expressions. Can't even use them in loops. > In NumPy, the numerical library for Python, they've invented some > quirky objects like numpy.r_ which you index to create a range > literal. Like >

Re: Is DFL still developed?

2009-07-09 Thread Trass3r
Robert Jacques schrieb: If you're using a recent version of D2, you might have forgotten the USE_CORE_MEMORY flag. And the svn is only up to D2.028 (IIRC). If you need something more recent, I have a branch that works with D2.031 (but probably not with versions pre 2.029) Also doesn't work wi

Re: Is DFL still developed?

2009-07-09 Thread Robert Jacques
On Thu, 09 Jul 2009 11:45:03 -0400, Trass3r wrote: Robert Jacques schrieb: If you're using a recent version of D2, you might have forgotten the USE_CORE_MEMORY flag. And the svn is only up to D2.028 (IIRC). If you need something more recent, I have a branch that works with D2.031 (but pro

Re: new DIP2: Const code bloat

2009-07-09 Thread Andrei Alexandrescu
Kagamin wrote: DiP2 is here. Check it. http://www.prowiki.org/wiki4d/wiki.cgi?DiPs http://www.prowiki.org/wiki4d/wiki.cgi?DiP2 Great start! Andrei

Re: Case Range Statement ..

2009-07-09 Thread Andrei Alexandrescu
Bill Baxter wrote: On Wed, Jul 8, 2009 at 8:26 PM, Walter Bright wrote: Bill Baxter wrote: I think what Jerome is getting at is that we could be getting more mileage out of the xpr1..xpr2 syntax. It would be useful syntax for more than just integral, dense ranges in foreach and slices. The eq

Re: Bartosz asks What’s Wrong with the Th

2009-07-09 Thread Steven Schveighoffer
On Thu, 09 Jul 2009 08:48:45 -0400, Sean Kelly wrote: Even run isn't supposed to be overridable, as it's a private method. This works only because of a compiler bug. whoa! I didn't realize that! Why would you ever inherit from Thread (even as the doc says, call super(&run) in the con

Re: Bartosz asks What’s Wrong with the Th

2009-07-09 Thread Steven Schveighoffer
On Thu, 09 Jul 2009 11:36:05 -0400, Bartosz Milewski wrote: Sean Kelly Wrote: It would be trivial to implement spawn on top of the Thread object. Not so trivial, as I would like the spawn function to be a variadic template. How is that not trivial? Or at least less trivial than imple

Re: Minor issue - zero-length fixed size arrays in variable-sized structs..

2009-07-09 Thread Steven Schveighoffer
On Thu, 09 Jul 2009 09:47:44 -0400, Jarrett Billingsley wrote: On Thu, Jul 9, 2009 at 2:38 AM, Daniel Keep wrote: You'd have to be mad to use it like that. struct S {    int a;    private { size_t size; char[0] data; }    char[] message() { return data.ptr[0..length]; } ... You can

Re: Is DFL still developed?

2009-07-09 Thread Trass3r
Ah thanks, I checked the snapshot version and it works with latest D1 dmd for me.

Re: new DIP2: Const code bloat

2009-07-09 Thread Steven Schveighoffer
On Thu, 09 Jul 2009 09:46:50 -0400, Kagamin wrote: DiP2 is here. Check it. http://www.prowiki.org/wiki4d/wiki.cgi?DiPs http://www.prowiki.org/wiki4d/wiki.cgi?DiP2 ps code markup is not very nice. Thanks for that! I updated the DiP to identify one other important problem that the solution

Re: Enhancement request

2009-07-09 Thread grauzone
Hey Robert, so how do I get all methods of a type? This doesn't work in D1. Now suppose that get() is somewhere in a library that isn't aware of object Person and of a template. Because that is the problem with libraries and especially DLL's. It needs to be more dynamic. Theoretically, it shou

Re: Case Range Statement ..

2009-07-09 Thread Walter Bright
Bill Baxter wrote: Not every one of those has every feature you could imagine. But nice things about Python's slices include: * optional step size, * step size can be negative. * nice compact notation * And the a:b syntax maps to a slice object so that you can manipulate them and pass them aroun

Re: Can we fix reverse operator overloading (opSub_r et. al.)?

2009-07-09 Thread Walter Bright
Andrei Alexandrescu wrote: This also reminds me that the entire operator overloading feature must be thrown away and redesigned. :-(

Re: new DIP2: Const code bloat

2009-07-09 Thread Jason House
that's a great choice for DIP 2. it addresses the really old "return const" issue. We know Walter at one time wanted to solve the issue and we have an official record of Andrei saying it's technically sound. The sample usage should probably include temporary variables inside a function. What

Re: Can we fix reverse operator overloading (opSub_r et. al.)?

2009-07-09 Thread Andrei Alexandrescu
Walter Bright wrote: Andrei Alexandrescu wrote: This also reminds me that the entire operator overloading feature must be thrown away and redesigned. :-( It's run its course like an old BMW. We need to do new things, and bolting them on what we have won't work. Andrei

Re: Case Range Statement ..

2009-07-09 Thread Jérôme M. Berger
Walter Bright wrote: Nick Sabalausky wrote: "Walter Bright" wrote in message It's handy when you want to prefix one expression to another, as in: (foo(), x + 3) I guess I'm not familiar with that syntax. What does that do and for what purpose? They're called Comma Expressions, and th

Re: Case Range Statement ..

2009-07-09 Thread Jérôme M. Berger
Bill Baxter wrote: On Wed, Jul 8, 2009 at 4:12 PM, Andrei Alexandrescu wrote: Jérôme M. Berger wrote: So, the correct way to define an inclusive range is with "+1" except when it's with "nextUp", unless you're talking about the right end of the range where it is inclusive by default and the

Re: Case Range Statement ..

2009-07-09 Thread bearophile
Walter Bright: > Having such a third operand, however, should mesh quite well with > Andrei's range library construct. In normal usage slices are sometimes useful, but slicing is mostly useful when you work with rectangular matrices, so you can slice and dice them in many ways, across axes, etc

Re: Case Range Statement ..

2009-07-09 Thread Jérôme M. Berger
Andrei Alexandrescu wrote: Jérôme M. Berger wrote: So, the correct way to define an inclusive range is with "+1" except when it's with "nextUp", unless you're talking about the right end of the range where it is inclusive by default and the right way to make it exclusive is with "+1" excep

Re: Minor issue - zero-length fixed size arrays in variable-sized structs..

2009-07-09 Thread Jarrett Billingsley
On Thu, Jul 9, 2009 at 1:09 PM, Steven Schveighoffer wrote: > Would something like this work? > > (&data)[0..length] Nope; &data is a char[0]*, and slicing it will get you a char[0][]. Which is pretty useless :D

Re: Is DFL still developed?

2009-07-09 Thread Sam Hu
If you need > something more recent, I have a branch that works with D2.031 (but > probably not with versions pre 2.029) I' m sorry to step in ,but can I ask for a copy? Thanks and best regards, Sam

Re: Case Range Statement ..

2009-07-09 Thread Walter Bright
Jérôme M. Berger wrote: Walter Bright wrote: Nick Sabalausky wrote: "Walter Bright" wrote in message It's handy when you want to prefix one expression to another, as in: (foo(), x + 3) I guess I'm not familiar with that syntax. What does that do and for what purpose? They're called

Re: Case Range Statement ..

2009-07-09 Thread BCS
Hello Walter, It's handy for things like rewriting ++e so it can be used more than once but is only evaluated once: (tmp = ++e, tmp) Uh? How is that different from "++e" You can then use tmp more than once with only one increment of e. how does that differ from using ++e the first time

Re: Case Range Statement ..

2009-07-09 Thread Walter Bright
BCS wrote: Hello Walter, It's handy for things like rewriting ++e so it can be used more than once but is only evaluated once: (tmp = ++e, tmp) Uh? How is that different from "++e" You can then use tmp more than once with only one increment of e. how does that differ from using ++e the

Re: Case Range Statement ..

2009-07-09 Thread Bill Baxter
On Thu, Jul 9, 2009 at 7:08 PM, Walter Bright wrote: > Jérôme M. Berger wrote: >> >> Walter Bright wrote: >>> >>> Nick Sabalausky wrote: "Walter Bright" wrote in message > > It's handy when you want to prefix one expression to another, as in: > >   (foo(), x + 3) >>>

Re: Is DFL still developed?

2009-07-09 Thread Robert Jacques
On Thu, 09 Jul 2009 20:47:28 -0400, Sam Hu wrote: If you need something more recent, I have a branch that works with D2.031 (but probably not with versions pre 2.029) I' m sorry to step in ,but can I ask for a copy? Thanks and best regards, Sam Sure. I've ziped up my dfl directory: https

Re: Case Range Statement ..

2009-07-09 Thread Walter Bright
Bill Baxter wrote: If it's internal to the parse tree can't you make the syntax whatever you want? Something like (expr1 __exprSequencer expr2) should do just fine, right? No reason it has to be a precious one-character symbol syntax. What if you're writing a program that generates D code?

Re: Case Range Statement ..

2009-07-09 Thread Jarrett Billingsley
On Fri, Jul 10, 2009 at 12:09 AM, Walter Bright wrote: > Bill Baxter wrote: >> >> If it's internal to the parse tree can't you make the syntax whatever you >> want? >> Something like (expr1 __exprSequencer expr2) should do just fine, right? >> No reason it has to be a precious one-character symbol

Re: Case Range Statement ..

2009-07-09 Thread Walter Bright
Jarrett Billingsley wrote: On Fri, Jul 10, 2009 at 12:09 AM, Walter Bright wrote: Bill Baxter wrote: If it's internal to the parse tree can't you make the syntax whatever you want? Something like (expr1 __exprSequencer expr2) should do just fine, right? No reason it has to be a precious one-cha

Re: Enhancement request

2009-07-09 Thread Sjoerd van Leent
grauzone Wrote: > The problem is, that you have to litter your code with calls like above. Exactly. Even though it can just be brought down to one additional statement per class, the statement in itself doesn't create any functionality, at least, from programmers perspective. This could obvio