Re: SQLite Bindings

2011-03-15 Thread Jonas Drewsen
On 15/03/11 01.33, nedbrek wrote: Hello all, "Jesse Phillips" wrote in message news:ilk728$gk0$1...@digitalmars.com... libcurl, SQLite, libpng, libbzip2, and the WindowsAPI stuff all sound like Excellent items to include for standard distribution. It is really nice to just have these items ava

Re: SQLite Bindings

2011-03-15 Thread Jacob Carlborg
On 2011-03-15 10:30, Jonas Drewsen wrote: On 15/03/11 01.33, nedbrek wrote: Hello all, "Jesse Phillips" wrote in message news:ilk728$gk0$1...@digitalmars.com... libcurl, SQLite, libpng, libbzip2, and the WindowsAPI stuff all sound like Excellent items to include for standard distribution. It i

Re: Why can't structs be derived from?

2011-03-15 Thread dsimcha
On 3/15/2011 9:25 AM, Jens wrote: It seems rather fundamental to be able to compose a new struct from a given struct using inheritance. Why is this not allowed? struct slist_node { slist_node* next; }; template struct slist_node: public slist_node { T data; }; Something that has b

Why can't structs be derived from?

2011-03-15 Thread Jens
It seems rather fundamental to be able to compose a new struct from a given struct using inheritance. Why is this not allowed? struct slist_node { slist_node* next; }; template struct slist_node: public slist_node { T data; };

Re: Stream Proposal

2011-03-15 Thread Kagamin
Andrei Alexandrescu Wrote: > >> T[] getBuffer(size_t n); > >> void commitBuffer(size_t n); > > > > void put(T); // as usual > > void put(T[]); // bulk put; can pass a slice of the buffer from getBuffer > > This is already implemented but doesn't allow someone to play with the > buffer and then c

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Schveighoffer
On Tue, 15 Mar 2011 09:28:50 -0400, dsimcha wrote: On 3/15/2011 9:25 AM, Jens wrote: It seems rather fundamental to be able to compose a new struct from a given struct using inheritance. Why is this not allowed? struct slist_node { slist_node* next; }; template struct slist_node: public

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Schveighoffer
On Tue, 15 Mar 2011 09:25:13 -0400, Jens wrote: It seems rather fundamental to be able to compose a new struct from a given struct using inheritance. Why is this not allowed? struct slist_node { slist_node* next; }; template struct slist_node: public slist_node { T data; }; struc

Phobos and shared

2011-03-15 Thread d coder
Greetings I am trying to create a multithreaded application. Right now I am finding it difficult to work with "shared" qualifier. One of the reasons is that Phobos library does not seem compatible with "shared" data-structures. For example: import std.bitmanip; shared BitArray foo; void main() {

Re: Why can't structs be derived from?

2011-03-15 Thread Jonathan M Davis
On Tuesday 15 March 2011 06:25:13 Jens wrote: > It seems rather fundamental to be able to compose a new struct from a > given struct using inheritance. Why is this not allowed? > > struct slist_node > { > slist_node* next; > }; > > template > struct slist_node: public slist_node > { > T

Re: Why can't structs be derived from?

2011-03-15 Thread Caligo
On Tue, Mar 15, 2011 at 10:00 AM, Jonathan M Davis wrote: > On Tuesday 15 March 2011 06:25:13 Jens wrote: > > It seems rather fundamental to be able to compose a new struct from a > > given struct using inheritance. Why is this not allowed? > > > > struct slist_node > > { > > slist_node* next;

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Schveighoffer
On Tue, 15 Mar 2011 12:28:07 -0400, Caligo wrote: struct MyStruct{ MyClass mc; // 4 bytes int a; int b; char c; } class MyClass{ MyStruct ms; // 16 bytes int x; int y; char z; } so, 'ms' is on the heap, even though it's a struct, right? but 'mc' is just a reference

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Schveighoffer
On Tue, 15 Mar 2011 13:24:27 -0400, Steven Schveighoffer wrote: Yes, it's not struct vs. heap more than it is value semantics vs. ... That should have said "stack vs. heap". -Steve

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Jonathan M Davis wrote: > On Tuesday 15 March 2011 06:25:13 Jens wrote: >> It seems rather fundamental to be able to compose a new struct from a >> given struct using inheritance. Why is this not allowed? >> >> struct slist_node >> { >> slist_node* next; >> }; >> >> template >> struct slist_no

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
dsimcha wrote: > On 3/15/2011 9:25 AM, Jens wrote: >> It seems rather fundamental to be able to compose a new struct from a >> given struct using inheritance. Why is this not allowed? >> >> struct slist_node >> { >> slist_node* next; >> }; >> >> template >> struct slist_node: public slist_node

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Schveighoffer
On Tue, 15 Mar 2011 13:30:00 -0400, Jens wrote: dsimcha wrote: On 3/15/2011 9:25 AM, Jens wrote: It seems rather fundamental to be able to compose a new struct from a given struct using inheritance. Why is this not allowed? struct slist_node { slist_node* next; }; template struct slist

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Steven Schveighoffer wrote: > On Tue, 15 Mar 2011 13:30:00 -0400, Jens wrote: > >> dsimcha wrote: >>> On 3/15/2011 9:25 AM, Jens wrote: It seems rather fundamental to be able to compose a new struct from a given struct using inheritance. Why is this not allowed? struct slist_no

Re: Why can't structs be derived from?

2011-03-15 Thread Jesse Phillips
Jens Wrote: > OK, silly me. I used a wrong example. I really did want to know about > non-polymorphic composition from structs via derivation. Sorry for the > confusion. > > struct point > { > int x; > int y; > }; > > struct point3d: point > { > int z; > }; You already got your an

Re: Why can't structs be derived from?

2011-03-15 Thread Andrei Alexandrescu
On 3/15/11 12:55 PM, Jens wrote: Steven Schveighoffer wrote: That's all there is. Structs do not have inheritance, only alias this. Why don't they though? Inheritance does not have to mean polymorphic. It can mean composition, like in C++. I don't understand the reason for such ugly syntax.

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Andrei Alexandrescu wrote: > On 3/15/11 12:55 PM, Jens wrote: >> Steven Schveighoffer wrote: >>> That's all there is. Structs do not have inheritance, only alias >>> this. >> >> Why don't they though? Inheritance does not have to mean >> polymorphic. It can mean composition, like in C++. I don't >

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Jesse Phillips wrote: > Jens Wrote: > >> OK, silly me. I used a wrong example. I really did want to know about >> non-polymorphic composition from structs via derivation. Sorry for >> the confusion. >> >> struct point >> { >> int x; >> int y; >> }; >> >> struct point3d: point >> { >> in

Re: Why can't structs be derived from?

2011-03-15 Thread Andrei Alexandrescu
On 03/15/2011 01:48 PM, Jens wrote: Andrei Alexandrescu wrote: On 3/15/11 12:55 PM, Jens wrote: Steven Schveighoffer wrote: That's all there is. Structs do not have inheritance, only alias this. Why don't they though? Inheritance does not have to mean polymorphic. It can mean composition, l

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Schveighoffer
On Tue, 15 Mar 2011 14:54:13 -0400, Jens wrote: I didn't ask how to do composition in D. I asked why composition cannot be done via derivation, i.e., the reasoning behind the language design choice. A design faux paus IMO. Because composition by inheritance can be *completely* implemented usi

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Andrei Alexandrescu wrote: > On 03/15/2011 01:48 PM, Jens wrote: >> Andrei Alexandrescu wrote: >>> On 3/15/11 12:55 PM, Jens wrote: Steven Schveighoffer wrote: > That's all there is. Structs do not have inheritance, only alias > this. Why don't they though? Inheritance does

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 15.03.2011 19:48, schrieb Jens: > Andrei Alexandrescu wrote: >> On 3/15/11 12:55 PM, Jens wrote: >>> Steven Schveighoffer wrote: That's all there is. Structs do not have inheritance, only alias this. >>> >>> Why don't they though? Inheritance does not have to mean >>> polymorphic. It

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Daniel Gibson wrote: > Am 15.03.2011 19:48, schrieb Jens: >> Andrei Alexandrescu wrote: >>> On 3/15/11 12:55 PM, Jens wrote: Steven Schveighoffer wrote: > That's all there is. Structs do not have inheritance, only alias > this. Why don't they though? Inheritance does not hav

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Steven Schveighoffer wrote: > On Tue, 15 Mar 2011 14:54:13 -0400, Jens wrote: > >> I didn't ask how to do composition in D. I asked why composition >> cannot be done via derivation, i.e., the reasoning behind the >> language design choice. A design faux paus IMO. > > Because composition by inherit

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Daniel Gibson wrote: > Am 15.03.2011 20:24, schrieb Jens: >> Daniel Gibson wrote: >>> Am 15.03.2011 19:48, schrieb Jens: Andrei Alexandrescu wrote: > On 3/15/11 12:55 PM, Jens wrote: >> Steven Schveighoffer wrote: >>> That's all there is. Structs do not have inheritance, only

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 15.03.2011 20:24, schrieb Jens: > Daniel Gibson wrote: >> Am 15.03.2011 19:48, schrieb Jens: >>> Andrei Alexandrescu wrote: On 3/15/11 12:55 PM, Jens wrote: > Steven Schveighoffer wrote: >> That's all there is. Structs do not have inheritance, only alias >> this. > > Wh

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Schveighoffer
On Tue, 15 Mar 2011 15:28:09 -0400, Jens wrote: Steven Schveighoffer wrote: On Tue, 15 Mar 2011 14:54:13 -0400, Jens wrote: I didn't ask how to do composition in D. I asked why composition cannot be done via derivation, i.e., the reasoning behind the language design choice. A design faux pa

Re: Why can't structs be derived from?

2011-03-15 Thread Andrei Alexandrescu
On 3/15/11 1:54 PM, Jens wrote: Jesse Phillips wrote: Jens Wrote: OK, silly me. I used a wrong example. I really did want to know about non-polymorphic composition from structs via derivation. Sorry for the confusion. struct point { int x; int y; }; struct point3d: point { int

Re: Why can't structs be derived from?

2011-03-15 Thread bearophile
Jens: > Sometimes I wonder if D has the goal of changing > as much as possible just for change sake. I don't think so. Several D problems come from C syntax/semantics. Bye, bearophile

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Steven Schveighoffer wrote: > On Tue, 15 Mar 2011 15:28:09 -0400, Jens wrote: > >> Steven Schveighoffer wrote: >>> On Tue, 15 Mar 2011 14:54:13 -0400, Jens wrote: >>> I didn't ask how to do composition in D. I asked why composition cannot be done via derivation, i.e., the reasoning behi

Re: Why can't structs be derived from?

2011-03-15 Thread Andrei Alexandrescu
On 3/15/11 2:07 PM, Jens wrote: Andrei Alexandrescu wrote: STL's mild abuses of inheritance (in the absence of something better such as aliases) are known and understood without being condoned at large. For a good account of why composition is preferable to inheritance, you may want to refer to

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 15.03.2011 20:40, schrieb Jens: > Daniel Gibson wrote: >> Am 15.03.2011 20:24, schrieb Jens: >>> Daniel Gibson wrote: Am 15.03.2011 19:48, schrieb Jens: > Andrei Alexandrescu wrote: >> On 3/15/11 12:55 PM, Jens wrote: >>> Steven Schveighoffer wrote: That's all there is.

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Andrei Alexandrescu wrote: > On 3/15/11 1:54 PM, Jens wrote: >> Jesse Phillips wrote: >>> Jens Wrote: >>> OK, silly me. I used a wrong example. I really did want to know about non-polymorphic composition from structs via derivation. Sorry for the confusion. struct point >>>

Re: Why can't structs be derived from?

2011-03-15 Thread Andrei Alexandrescu
On 3/15/11 2:55 PM, Jens wrote: We'll have to agree to disagree on this one then. I'm sure there will be others. ;) I hope this newsgroup will use future opportunities for learning from you. It would never hurt if you did the converse (this is really not the place and the entourage to be cock

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Daniel Gibson wrote: > Am 15.03.2011 20:40, schrieb Jens: >> Daniel Gibson wrote: >>> Am 15.03.2011 20:24, schrieb Jens: Daniel Gibson wrote: > Am 15.03.2011 19:48, schrieb Jens: >> Andrei Alexandrescu wrote: >>> On 3/15/11 12:55 PM, Jens wrote: Steven Schveighoffer wrote:

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Andrei Alexandrescu wrote: > On 3/15/11 2:07 PM, Jens wrote: >> Andrei Alexandrescu wrote: >>> STL's mild abuses of inheritance (in the absence of something better >>> such as aliases) are known and understood without being condoned at >>> large. For a good account of why composition is preferable

Re: Why can't structs be derived from?

2011-03-15 Thread Ali Çehreli
On 03/15/2011 12:54 PM, Daniel Gibson wrote: > Furthermore I find C++'s class handling quite unfortunate.. only having > polymorphism when explicitly using pointers really sucks. > e.g. you have a base class Foo and a class Bar derived from Foo.. now you wanna > put Objects of type Foo and Bar

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Andrei Alexandrescu wrote: > On 3/15/11 2:55 PM, Jens wrote: >> We'll have to agree to disagree on this one then. I'm sure there >> will be others. ;) > > I hope this newsgroup will use future opportunities for learning from > you. It would never hurt if you did the converse (this is really not > t

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 15.03.2011 21:07, schrieb Jens: > Daniel Gibson wrote: >> Am 15.03.2011 20:40, schrieb Jens: >>> Daniel Gibson wrote: Am 15.03.2011 20:24, schrieb Jens: > Daniel Gibson wrote: >> Am 15.03.2011 19:48, schrieb Jens: >>> Andrei Alexandrescu wrote: On 3/15/11 12:55 PM, Jens

Re: Why can't structs be derived from?

2011-03-15 Thread David Nadlinger
On 3/15/11 9:24 PM, Jens wrote: Andrei Alexandrescu wrote: On 3/15/11 2:55 PM, Jens wrote: We'll have to agree to disagree on this one then. I'm sure there will be others. ;) I hope this newsgroup will use future opportunities for learning from you. It would never hurt if you did the converse

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Daniel Gibson wrote: > Am 15.03.2011 21:07, schrieb Jens: >> Daniel Gibson wrote: >>> Am 15.03.2011 20:40, schrieb Jens: Daniel Gibson wrote: > Am 15.03.2011 20:24, schrieb Jens: >> Daniel Gibson wrote: >>> Am 15.03.2011 19:48, schrieb Jens: Andrei Alexandrescu wrote:

Re: Why can't structs be derived from?

2011-03-15 Thread Ali Çehreli
On 03/15/2011 12:42 PM, Jens wrote: > Steven Schveighoffer wrote: >> Beauty is subjective, so I guess I can say at this point, go write >> your own language that is beautiful in your mind. Good luck. >> > > I am. Thanks. You don't have what it takes to write a language yet. Beauty is only one a

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 15.03.2011 21:29, schrieb Jens: > Daniel Gibson wrote: >> Am 15.03.2011 21:07, schrieb Jens: >>> How is it different in D where all polymorphic objects are reference >>> types? Take have the design space away, make everything a glorified >>> pointer and things are better? >> >> They obviously ar

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
bearophile wrote: > Jens: > >> Sometimes I wonder if D has the goal of changing >> as much as possible just for change sake. > > I don't think so. Several D problems come from C syntax/semantics. > May be just too late to change those now.

Re: Why can't structs be derived from?

2011-03-15 Thread bearophile
Jens: > I wasn't being. I know what I want in a language. I'm also tough, > thick-skinned, non-patronizing, non-sheeplish... Don't take it > personally. If someone is wimpy, they probably shouldn't be dialogue-ing > with me. It's technology for pete's sake. If you act like a decent human being

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Daniel Gibson wrote: > Am 15.03.2011 21:29, schrieb Jens: >> Daniel Gibson wrote: >>> Am 15.03.2011 21:07, schrieb Jens: How is it different in D where all polymorphic objects are reference types? Take have the design space away, make everything a glorified pointer and things are bet

Re: Why can't structs be derived from?

2011-03-15 Thread Simen kjaeraas
Jens wrote: bearophile wrote: Jens: I wasn't being. I know what I want in a language. I'm also tough, thick-skinned, non-patronizing, non-sheeplish... Don't take it personally. If someone is wimpy, they probably shouldn't be dialogue-ing with me. It's technology for pete's sake. If you act

Re: How do you debug DMD?

2011-03-15 Thread Walter Bright
On 3/14/2011 12:20 AM, %u wrote: You can use windbg.exe, which is in \dmd\windows\bin. Of course, you'll also need to download the Digital Mars C++ compiler from http://www.digitalmars.com/download/freecompiler.html Hm... I already have WinDbg (and DMC), but I never thought it's any more effici

Re: Why can't structs be derived from?

2011-03-15 Thread Andrei Alexandrescu
On 03/15/2011 04:04 PM, Simen kjaeraas wrote: Jens wrote: bearophile wrote: Jens: I wasn't being. I know what I want in a language. I'm also tough, thick-skinned, non-patronizing, non-sheeplish... Don't take it personally. If someone is wimpy, they probably shouldn't be dialogue-ing with me

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
bearophile wrote: > Jens: > >> I wasn't being. I know what I want in a language. I'm also tough, >> thick-skinned, non-patronizing, non-sheeplish... Don't take it >> personally. If someone is wimpy, they probably shouldn't be >> dialogue-ing with me. It's technology for pete's sake. > > If you act

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Ali Çehreli wrote: > On 03/15/2011 12:42 PM, Jens wrote: >> Steven Schveighoffer wrote: >>> Beauty is subjective, so I guess I can say at this point, go write >>> your own language that is beautiful in your mind. Good luck. >>> >> >> I am. Thanks. > > You don't have what it takes to write a langua

Re: Why can't structs be derived from?

2011-03-15 Thread Max Samukha
On 03/15/2011 10:46 PM, Jens wrote: Daniel Gibson wrote: Am 15.03.2011 21:29, schrieb Jens: Daniel Gibson wrote: Am 15.03.2011 21:07, schrieb Jens: How is it different in D where all polymorphic objects are reference types? Take have the design space away, make everything a glorified pointer

Re: Why can't structs be derived from?

2011-03-15 Thread Jonathan M Davis
On Tuesday, March 15, 2011 14:15:48 Max Samukha wrote: > On 03/15/2011 10:46 PM, Jens wrote: > > Daniel Gibson wrote: > >> Am 15.03.2011 21:29, schrieb Jens: > >>> Daniel Gibson wrote: > Am 15.03.2011 21:07, schrieb Jens: > > How is it different in D where all polymorphic objects are > >>>

Re: Why can't structs be derived from?

2011-03-15 Thread Jesse Phillips
Jens Wrote: > I didn't ask how to do composition in D. I asked why composition cannot > be done via derivation, i.e., the reasoning behind the language design > choice. A design faux paus IMO. Sorry that is a good point. Based on the other threads it seems you feel syntax for composition is n

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Jonathan M Davis wrote: > On Tuesday, March 15, 2011 14:15:48 Max Samukha wrote: >> On 03/15/2011 10:46 PM, Jens wrote: >>> Daniel Gibson wrote: Am 15.03.2011 21:29, schrieb Jens: > Daniel Gibson wrote: >> Am 15.03.2011 21:07, schrieb Jens: >>> How is it different in D where all po

Re: Why can't structs be derived from?

2011-03-15 Thread Jens
Andrei Alexandrescu wrote: > On 03/15/2011 04:04 PM, Simen kjaeraas wrote: >> Jens wrote: >> >>> bearophile wrote: Jens: > I wasn't being. I know what I want in a language. I'm also tough, > thick-skinned, non-patronizing, non-sheeplish... Don't take it > personally. If someo

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 15.03.2011 22:46, schrieb Jens: > Jonathan M Davis wrote: >> On Tuesday, March 15, 2011 14:15:48 Max Samukha wrote: >>> >>> Class objects are possible on stack in D. >> >> Yes, but only with the help of the standard library: >> std.typecons.scoped. scoped classes are going to be removed from the

Reading dchar from UTF-8 stdin

2011-03-15 Thread Ali Çehreli
Given that the input stream is UTF-8, it is understandable that the following program pulls just one code unit from the standard input (I think the console encoding is UTF-8 on my Ubuntu 10.10): import std.stdio; void main() { char code; readf(" %s", &code); writeln(code); //

Re: Why can't structs be derived from?

2011-03-15 Thread Andrej Mitrovic
Speaking of structs, shouldn't it be possible to write this:? struct AAWrapper(KeyType, ValType) { ValType[][KeyType] payload; alias payload.opIndex opIndex; } The reasoning behind this is that opIndex in AAWrapper really just forwards to payload's opIndex, while other functions like opIn

Re: Why can't structs be derived from?

2011-03-15 Thread Caligo
On Tue, Mar 15, 2011 at 4:03 PM, Jens wrote: > > If I found D adequate, I wouldn't be developing another language, now > would I? > > > Have you come up with a name for this language that you are developing? May I suggest D++?

Re: Why can't structs be derived from?

2011-03-15 Thread Andrej Mitrovic
On 3/15/11, Caligo wrote: > Have you come up with a name for this language that you are developing? May > I suggest D++? > Speaking of language names.. I never understood why people whine about "D not being searchable because of its name". Then how is `C` searchable? Heck, half of the results wh

Re: Why can't structs be derived from?

2011-03-15 Thread Walter Bright
On 3/15/2011 3:41 PM, Andrej Mitrovic wrote: I'd say the primary reason someone won't land on a D page if it's the first time she's looking for it is because D is simply not that popular yet. But saying that it's not searchable because of its name is silly, imo. D is very searchable if you sear

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 15.03.2011 23:55, schrieb Walter Bright: > On 3/15/2011 3:41 PM, Andrej Mitrovic wrote: >> I'd say the primary reason someone won't land on a D page if it's the >> first time she's looking for it is because D is simply not that >> popular yet. But saying that it's not searchable because of its n

Re: Why can't structs be derived from?

2011-03-15 Thread Andrej Mitrovic
On 3/15/11, Walter Bright wrote: > On 3/15/2011 3:41 PM, Andrej Mitrovic wrote: >> I'd say the primary reason someone won't land on a D page if it's the >> first time she's looking for it is because D is simply not that >> popular yet. But saying that it's not searchable because of its name >> is

To maximize "pure" crop

2011-03-15 Thread bearophile
Few months ago I have said that "pure" in D2 is a quite big thing, it's very useful. Recently I have found a blog post about functional Vs object oriented coding. This blog post is not so important, but it has given me a little push to understand something: http://squirrel.pl/blog/2011/03/14/two

Re: Why can't structs be derived from?

2011-03-15 Thread Caligo
On Tue, Mar 15, 2011 at 5:41 PM, Andrej Mitrovic wrote: > > Speaking of language names.. I never understood why people whine about > "D not being searchable because of its name". Then how is `C` > searchable? Heck, half of the results when searching for C will land > you C++ results. And searchin

Re: Why can't structs be derived from?

2011-03-15 Thread Jonathan M Davis
On Tuesday, March 15, 2011 15:34:50 Andrej Mitrovic wrote: > Speaking of structs, shouldn't it be possible to write this:? > > struct AAWrapper(KeyType, ValType) > { > ValType[][KeyType] payload; > alias payload.opIndex opIndex; > } > > The reasoning behind this is that opIndex in AAWrapp

Re: Why can't structs be derived from?

2011-03-15 Thread Andrej Mitrovic
On 3/16/11, Jonathan M Davis wrote: > On Tuesday, March 15, 2011 15:34:50 Andrej Mitrovic wrote: >> Speaking of structs, shouldn't it be possible to write this:? >> >> struct AAWrapper(KeyType, ValType) >> { >> ValType[][KeyType] payload; >> alias payload.opIndex opIndex; >> } >> >> The re

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Wawryk
On 16/03/11 04:59, Andrei Alexandrescu wrote: The reason for the allegedly ugly syntax is that it's considerably more general. It is often the case that a struct defines an entity that is implicitly convertible to another entity - could be an rvalue vs. lvalue, a class vs. another struct vs. a pr

Re: Why can't structs be derived from?

2011-03-15 Thread Steven Wawryk
On 16/03/11 10:30, Steven Wawryk wrote: On 16/03/11 04:59, Andrei Alexandrescu wrote: The reason for the allegedly ugly syntax is that it's considerably more general. It is often the case that a struct defines an entity that is implicitly convertible to another entity - could be an rvalue vs. lv

Re: Why can't structs be derived from?

2011-03-15 Thread Andrej Mitrovic
On 3/15/11, dsimcha wrote: > Something that has basically that effect is allowed, just not with that > syntax: > > struct slist_node(T) > { > slist_node base; > alias base this; > > T data; > } > Shouldn't base be a pointer? You'll get errors with that code.

Re: Why can't structs be derived from?

2011-03-15 Thread Andrej Mitrovic
I've spotted this in QtD's codebase, dunno if this works: T static_cast(T, U)(U obj) { return cast(T)cast(void*)obj; }

Re: Why can't structs be derived from?

2011-03-15 Thread bearophile
Andrej Mitrovic: > I've spotted this in QtD's codebase, dunno if this works: > > T static_cast(T, U)(U obj) > { > return cast(T)cast(void*)obj; > } See this thread, it contains a better implementation of staticCast (partially written by me), that I'd like in Phobos: http://www.digitalmars.c

Status report, milestones, quality improvements?

2011-03-15 Thread jasonw
A lot of work is going on around D. However I can't really fit the pieces together to see how everything works. Bad quality -- One problem is the large amount of obsolete data ( http://www.dsource.org/projects/dmdfe ) Dsource is The place for D projects. The problem with dsource is

Re: Why can't structs be derived from?

2011-03-15 Thread Walter Bright
On 3/15/2011 4:04 PM, Daniel Gibson wrote: D is very searchable if you search for "D programming language". That's fine if you want to find D's official homepage. But if you want to find a library for a specific purpose or something like that it's not that easy because you can't be sure that th

Re: Why can't structs be derived from?

2011-03-15 Thread Daniel Gibson
Am 16.03.2011 02:01, schrieb bearophile: Andrej Mitrovic: I've spotted this in QtD's codebase, dunno if this works: T static_cast(T, U)(U obj) { return cast(T)cast(void*)obj; } See this thread, it contains a better implementation of staticCast (partially written by me), that I'd like i

Re: Why can't structs be derived from?

2011-03-15 Thread bearophile
Daniel Gibson: > This check may make sense, but this cast could even work on > pointers-to-structs if they are similar, something like I suggest to keep purposes separated, to keep the semantics of the program cleaner and to avoid some bugs, letting staticCast work with just objects. A differe

Re: Why can't structs be derived from?

2011-03-15 Thread Nick Sabalausky
"Jens" wrote in message news:ilon8h$lhu$1...@digitalmars.com... > Andrei Alexandrescu wrote: >> On 03/15/2011 04:04 PM, Simen kjaeraas wrote: >>> Jens wrote: >>> bearophile wrote: > Jens: > >> I wasn't being. I know what I want in a language. I'm also tough, >> thick-skinned

Re: Why can't structs be derived from?

2011-03-15 Thread Nick Sabalausky
"David Nadlinger" wrote in message news:iloidv$8s1$1...@digitalmars.com... > On 3/15/11 9:24 PM, Jens wrote: >> Andrei Alexandrescu wrote: >>> On 3/15/11 2:55 PM, Jens wrote: We'll have to agree to disagree on this one then. I'm sure there will be others. ;) >>> >>> I hope this newsgrou

Re: Status report, milestones, quality improvements?

2011-03-15 Thread Nick Sabalausky
"jasonw" wrote in message news:ilp2rt$1fs5$1...@digitalmars.com... > > Newsgroup threads often discuss useless things (CRT displays and whether > black-on-white is better than white-on-black in a feature proposal > threads). Nick Sabalausky and Walter Bright are worst trolls in this > regard,

Re: Status report, milestones, quality improvements?

2011-03-15 Thread Jesse Phillips
http://digitalmars.com/d/2.0/changelog.html http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel

Re: Status report, milestones, quality improvements?

2011-03-15 Thread Nicholas
== Quote from jasonw (u...@webmails.org)'s article > A lot of work is going on around D. However I can't really fit the pieces together to see how everything works. > I've tried to advertise D to colleagues. What they're interested in is a) library and tool support b) quality of apidocs c) progres

Re: Status report, milestones, quality improvements?

2011-03-15 Thread Caligo
On Tue, Mar 15, 2011 at 11:18 PM, Nick Sabalausky wrote: > "jasonw" wrote in message > news:ilp2rt$1fs5$1...@digitalmars.com... > > > > Newsgroup threads often discuss useless things (CRT displays and whether > > black-on-white is better than white-on-black in a feature proposal > > threads). Ni

Re: Status report, milestones, quality improvements?

2011-03-15 Thread Jonathan M Davis
On Tuesday 15 March 2011 23:14:09 Caligo wrote: > On Tue, Mar 15, 2011 at 11:18 PM, Nick Sabalausky wrote: > > "jasonw" wrote in message > > news:ilp2rt$1fs5$1...@digitalmars.com... > > > > > Newsgroup threads often discuss useless things (CRT displays and > > > whether black-on-white is better