June 23, 2004
In article <cbcbuu$mre$1@digitaldaemon.com>, Andy Friesen says...
>
>This isn't quite what Mattias was getting at.  Here's a more general example of the same notion:
>
>In ML:
>
>     fun multiply x y = x * y;
>
>And in D:
>
>     template ReturnType(A, B) {
>             alias typeof(A.init*B.init) ReturnType;
>     }
>
>     template multiply(A, B) {
>             ReturnType!(A, B) multiply(A a, B b) {
>                     return a * b;
>             }
>     }
>
>This form will properly deduce the return type regardless of the types of A and B. (this is only an issue when they aren't the same)
>
>C++ is utterly helpless in this regard, since it doesn't have typeof.

Ah gotcha.  This is the same as the problems with making a non-macro version of min and max work correctly in C++.

Sean


June 23, 2004
You can do this easily with template magic(tm) and automatic template instantiation  in C++

Check it out

http://cvs.sourceforge.net/viewcvs.py/brook/brook/include/brtvector.hpp
http://cvs.sourceforge.net/viewcvs.py/brook/brook/include/type_promotion.hpp 

type promotion sets up the casting order
then brtvector uses it

That's what I did :-)
This is across Vector Types as well as across types of vectors (int,float)->float
(double,float)->double
...
...

it would have been a LOT neater if you could have partial specialization--but VC6 and gcc-2.95 didn't support that and those were some of my targets


Sean Kelly wrote:
> In article <cbcbuu$mre$1@digitaldaemon.com>, Andy Friesen says...
> 
>>This isn't quite what Mattias was getting at.  Here's a more general example of the same notion:
>>
>>In ML:
>>
>>    fun multiply x y = x * y;
>>
>>And in D:
>>
>>    template ReturnType(A, B) {
>>            alias typeof(A.init*B.init) ReturnType;
>>    }
>>
>>    template multiply(A, B) {
>>            ReturnType!(A, B) multiply(A a, B b) {
>>                    return a * b;
>>            }
>>    }
>>
>>This form will properly deduce the return type regardless of the types of A and B. (this is only an issue when they aren't the same)
>>
>>C++ is utterly helpless in this regard, since it doesn't have typeof.
> 
> 
> Ah gotcha.  This is the same as the problems with making a non-macro version of
> min and max work correctly in C++.
> 
> Sean
> 
> 
June 23, 2004
In article <cbcjdn$13dp$1@digitaldaemon.com>, Daniel Horn says...
>
>You can do this easily with template magic(tm) and automatic template instantiation  in C++

I agree that you can get pretty close with traits templates, but that's far from a simple solution.  It also becomes more complicated once user defined types are involved.  Especially since all that works is just trying to replicate a one line macro :)

Sean


June 23, 2004
Ant wrote:

>>>oppurtunity
>>
>>Grammatical advice from a guy who can't spell "opportunity".
>>
> 
> 
> Not directed to the poster.
> 
> Many people just focus on the details and don't see the real issues.
> that's good for slashdot but here if we are going to insult each other
> and have a good old "food fight" let's be a little smarter.
> 
> :)
> 
> Ant
> PS
> of course "smarter" doesn't really expresses my idea. I want to say
> something like "intelligente", "with more culture" and things like that
> but I don't know the expression in this language.

Kulturny. English-speakers (writers?) could do with that fine Russian word in their vocabulary, and its antonym.

Cheers,
Sigbjørn Lund Olsen
June 23, 2004
Walter wrote:

> D has a lot of powerful capabilities that are absent from C++. Why is C++ more powerful? I don't believe it is. For example, you can't do DbC, mixins, nested functions, delegates, etc., in C++. C++'s support for unicode is mostly a disaster. Using gc in C++ is only for experts.

Depends on how you read it:

* "D is more powerful than C++ in general" - definitely

* "D is more powerful than C++ in every respect" - not yet.
There is a number of points lacking. Most important from my perspective:
Full support for expression templates. To be more specific:
-> implicit instantiation
-> casting overloading for structs and/or struct constructors
   (static opCall is a crude hack but insufficient in some cases)

June 23, 2004
"Norbert Nemec" <Norbert.Nemec@gmx.de> escribió en el mensaje
news:cbctkg$1jdd$1@digitaldaemon.com
| Depends on how you read it:
|
| * "D is more powerful than C++ in general" - definitely
|
| * "D is more powerful than C++ in every respect" - not yet.
| There is a number of points lacking. Most important from my perspective:
| Full support for expression templates. To be more specific:
| -> implicit instantiation
| -> casting overloading for structs and/or struct constructors
|    (static opCall is a crude hack but insufficient in some cases)

Personally (and I think others agree), I think the main problem with D right
now is lack of libraries, because the language itself is awesome.
I've been telling my friends about how great D is for almost 2 years now,
and yesterday one of them asked me "can D connect to Oracle?". And I said,
"yes, just like you would in C". However his point was about doing something
easy as Java or .Net do it.
And what about the always-repeating question about GUI libraries?
(just to mention the two that I'm more familiar with, besides sockets, but
that's already covered)

-----------------------
Carlos Santander Bernal


June 24, 2004
"Carlos Santander B." <carlos8294@msn.com> wrote in message news:cbd5cq$1vgu$1@digitaldaemon.com...
> "Norbert Nemec" <Norbert.Nemec@gmx.de> escribió en el mensaje
> news:cbctkg$1jdd$1@digitaldaemon.com
> | Depends on how you read it:
> |
> | * "D is more powerful than C++ in general" - definitely
> |
> | * "D is more powerful than C++ in every respect" - not yet.
> | There is a number of points lacking. Most important from my perspective:
> | Full support for expression templates. To be more specific:
> | -> implicit instantiation
> | -> casting overloading for structs and/or struct constructors
> |    (static opCall is a crude hack but insufficient in some cases)
>
> Personally (and I think others agree), I think the main problem with D right now is lack of libraries, because the language itself is awesome.

I agree that the language is very good, and certainly "good enough" now for 1.0. But the libraries do a leave a lot to be desired. For that, we can just hope for more contributions, I guess. Just time and effort. I can't think of anything more profound that that - maybe I'm missing something.

> I've been telling my friends about how great D is for almost 2 years now,
> and yesterday one of them asked me "can D connect to Oracle?". And I said,
> "yes, just like you would in C". However his point was about doing something
> easy as Java or .Net do it.
> And what about the always-repeating question about GUI libraries?
> (just to mention the two that I'm more familiar with, besides sockets, but
> that's already covered)


June 24, 2004
kinghajj wrote:

> I don't care if D doesn't become the *rage*, I'll use D as long as Walter works on it.
> 
> However, something that could help it *alot* would be to add a standard GUI library into Phobos, hopefully cross-platform for Win32 and Linux/Gtk. People don't want to make command-line apps anymore, esp. not for Win32!

A GUI for D is most certainly important, no doubt about that.  But D's current instability is making GUI implementations fall victim to a kind of circular dependency that stifles further progress (what's that western idiom that Walter always uses?... the chicken and egg problem).

Creating a complicated and powerful GUI requires a stable language implementation. That's something that D is not quite yet.  So what we have here is a case where the language needs libraries, but complicated libraries (like GUI's) need a stable language (one that doesn't break library compilation after each new release).  So that, I think, is why everybody is pining away for bug fixes.  Apparently bug-fixing is next on Walter's agenda anyway, so hopefully everything will stablize and everyone will be happy, happy, happy.

Later,

John
June 25, 2004
Walter schrieb:

> D has a lot of powerful capabilities that are absent from C++. Why is C++
> more powerful? I don't believe it is. For example, you can't do DbC, mixins,
> nested functions, delegates, etc., in C++. C++'s support for unicode is
> mostly a disaster. Using gc in C++ is only for experts.

I also think that D is very interesting and powerful, but IMHO it isn't ready for productional use yet.

Best regards,
Mark Junker
June 25, 2004

> And what about the always-repeating question about GUI libraries?

yeah - it's a pity DUI hasn't been compilable for a while now. These GUI libraries seem to be really pushing the language and I bet it's tough to keep everything working with the language in flux. The progress so far has been impressive for the ones I've taken a look at so I hope everyone keeps it going. The toolkits I'm most familiar with are Swing and Qt so anything approaching those would be really sweet. The trouble is that these things take tons of effort - especially the crossplatform toolkits.