class extensions

kris foo at bar.com
Wed Aug 29 18:41:04 PDT 2007


Lutger wrote:
> kris wrote:
>>
>> Yeah, the proposed extensions raised all kinds of red flags for me at 
>> the conference.
>>
>> Bluntly, it felt like the notion of "structured programming" was being 
>> tossed out in favor of "slapdash programming" ... a brand new paradigm 
>> to go along with the other(s) being adopted :)
> 
> What are the objections to this? Are there technical pitfalls?

Technical? Since when did that become important? ;)

I belong to the "just because you can doesn't mean you should" camp, and 
feel that perhaps a more holistic view should be taken here? Just don't 
see this specific idiom as being particularly beneficial, without adding 
detrimental side-effect that I'll briefly touch on in a moment (it never 
really had significant value with arrays either, other than perhaps as a 
means to confuse non-experts O_+)

> I liked to idea very much. It gives a flexible way of object-oriented / 
> object-based programming similar to how I often see it implemented in C. 

And it potentially introduces additional namespace issues, hijacking 
issues, and compilation errors for large and/or long-term software 
development projects. The commercial-development space is where D ought 
to target, if it's to rise well above being just another enthusiasts 
playground :p

A conservative approach would remove the existing idiom with arrays, 
rather than propagate it, and address concerns instead by perhaps 
looking at alternate approaches for supporting 'properties' (C# for 
example). Are you thinking this makes a good solution for 'properties' 
in general? As has been discussed recently?

> Plus one can achieve a very nice syntactic sugar for call chaining, 

D provides that already, no? Tango supports call-chaining extensively.

> which is a great benefit I think. I thought this syntax for arrays is 
> generally appreciated, so why not extend it for other types?

Just because some folks apparently like it, and are vocal about it, 
doesn't necessarily make it "generally appreciated"? That's a problem 
with newsgroups and forums though ... it's perhaps easy to get a skewed 
perspective?

As for extending to other types, that's cool! I just feel this 
particular idiom potentially builds smoldering fires larger than the 
one(s) it is attempting to extinguish (or perhaps it's not even trying 
to resolve anything?). If that is the case it is hardly an adequate 
resolution, and will simply return to bite D in the buttocks.

As such, I suspect alternatives should be given great consideration (or 
/greater/ consideration) and the relative trade-offs should be weighed 
appropriately. Yourself, and others, may feel that's not necessary or 
has been adequately performed already? I don't feel that way, and it's 
not the impression I got from the conference :-D

(parts of this are written somewhat tongue-in-cheek, as there's only so 
much one can achieve via this medium. Please just take it as my opinion, 
and nothing more)



More information about the Digitalmars-d mailing list