Jump to page: 1 26  
Page
Thread overview
DMD 0.58 release
Mar 03, 2003
Walter
Mar 03, 2003
Patrick Down
Mar 03, 2003
Walter
Mar 03, 2003
Sean L. Palmer
Mar 03, 2003
Daniel Yokomiso
Mar 03, 2003
Dan Liebgold
Mar 03, 2003
Walter
Mar 03, 2003
Dan Liebgold
Mar 03, 2003
Walter
Mar 03, 2003
Garen
Mar 03, 2003
Walter
Mar 03, 2003
Daniel Yokomiso
Mar 04, 2003
Walter
Mar 04, 2003
Daniel Yokomiso
Mar 04, 2003
Walter
Mar 04, 2003
Bill Cox
Mar 04, 2003
Daniel Yokomiso
Mar 04, 2003
Bill Cox
Mar 04, 2003
Walter
Mar 04, 2003
Daniel Yokomiso
Mar 04, 2003
Walter
Mar 04, 2003
Daniel Yokomiso
Mar 04, 2003
Walter
Mar 04, 2003
Daniel Yokomiso
Mar 04, 2003
Walter
Mar 06, 2003
Daniel Yokomiso
Mar 06, 2003
Walter
Mar 04, 2003
Bill Cox
Mar 04, 2003
Mike Wynn
Mar 04, 2003
Walter
Mar 05, 2003
Mike Wynn
Mar 05, 2003
Walter
Mar 04, 2003
Dan Liebgold
Mar 04, 2003
Walter
Mar 04, 2003
Burton Radons
typename for forward declarations
Mar 04, 2003
Sean L. Palmer
Mar 04, 2003
Walter
Mar 03, 2003
Dan Liebgold
Mar 03, 2003
Walter
Mar 04, 2003
Burton Radons
Mar 04, 2003
Patrick Down
Mar 07, 2003
Burton Radons
Mar 07, 2003
Farmer
Mar 12, 2003
Burton Radons
Mar 12, 2003
Burton Radons
Mar 13, 2003
Burton Radons
Mar 13, 2003
Burton Radons
Mar 14, 2003
Burton Radons
Mar 18, 2003
Burton Radons
Mar 19, 2003
Burton Radons
Mar 20, 2003
Burton Radons
Mar 22, 2003
Walter
Mar 22, 2003
Burton Radons
Mar 22, 2003
Burton Radons
Mar 23, 2003
Burton Radons
Mar 30, 2003
Walter
March 03, 2003
Maintenance.

www.digitalmars.com/d/changelog.html



March 03, 2003
In article <b3vdgg$1f8t$1@digitaldaemon.com>, Walter says...
>
>Maintenance.
>
>www.digitalmars.com/d/changelog.html
>

<quote>
Added covariant function return types
</quote>

Have you documented this anywhere?


March 03, 2003
Yeah, what is a covariant function return type?

Sean

"Walter" <walter@digitalmars.com> wrote in message news:b3vdgg$1f8t$1@digitaldaemon.com...
> Maintenance.
>
> www.digitalmars.com/d/changelog.html


March 03, 2003
"Sean L. Palmer" <seanpalmer@directvinternet.com> escreveu na mensagem news:b40568$1tur$1@digitaldaemon.com...
> Yeah, what is a covariant function return type?
>
> Sean
>
> "Walter" <walter@digitalmars.com> wrote in message news:b3vdgg$1f8t$1@digitaldaemon.com...
> > Maintenance.
> >
> > www.digitalmars.com/d/changelog.html

You can redefine the return type to be "more specific". That means a subclass can override a inherited method and change the return type to a subtype of the original method.

class A {
    A self() {
        return this;
    }
}
class B : A {
    B self() { // covariant return type
        return this;
    }
}

http://sern.ucalgary.ca/courses/SENG/609.03/W98/Abadi/AbadiCh2.html#2.6


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/2/2003


March 03, 2003
"Patrick Down" <Patrick_member@pathlink.com> wrote in message news:b404ce$1tff$1@digitaldaemon.com...
> <quote>
> Added covariant function return types
> </quote>
>
> Have you documented this anywhere?

Documentation? Huh? <g>

www.digitalmars.com/d/function.html


March 03, 2003
In article <b3vdgg$1f8t$1@digitaldaemon.com>, Walter says...
>
>Maintenance.
>
>www.digitalmars.com/d/changelog.html
>
>

" Added covariant function return types."

Very cool!  Yet another thing that is just plain broken in C++, fixed in D.

Dan





March 03, 2003
"Dan Liebgold" <Dan_member@pathlink.com> wrote in message news:b40b5v$21pv$1@digitaldaemon.com...
> " Added covariant function return types."
>
> Very cool!  Yet another thing that is just plain broken in C++, fixed in
D.

But C++ supports covariant function return types. Or is something broken about it that I'm missing? Oddly, C# does not support it, nor does Java. I'd intended to make this work in D for a while, I just was buried in other things. I've been looking at adding 'virtual types', too.


March 03, 2003
In article <b40d29$23a9$1@digitaldaemon.com>, Walter says...
>
>But C++ supports covariant function return types. Or is something broken about it that I'm missing? Oddly, C# does not support it, nor does Java. I'd intended to make this work in D for a while, I just was buried in other things. I've been looking at adding 'virtual types', too.
>
>

Hmmm, I guess they slipped that in to the C++ design when I wasn't looking. Do you know when it was added?  It seems to have been discussed as recently as a few years ago.

Dan


March 03, 2003
Walter wrote:

> But C++ supports covariant function return types. Or is something broken about it that I'm missing? Oddly, C# does not support it, nor does Java. I'd intended to make this work in D for a while, I just was buried in other things. I've been looking at adding 'virtual types', too.
> 

Both C# and Java plan to have 'em in future releases.

How would virtual types fit in with templates?


March 03, 2003
In article <b3vdgg$1f8t$1@digitaldaemon.com>, Walter says...
>
>Maintenance.
>
>www.digitalmars.com/d/changelog.html
>

Are there plans to support initializing arrays with function literals, like this:

//------------------------------------------------//
typedef void function (char*) print_proc;

print_proc functbl[4] = [
(print_proc)function void (char * text) { printf(" %s,\n", text); },
(print_proc)function void (char * text) { printf(" [%s],\n", text); },
(print_proc)function void (char * text) { printf("%s,\n", text); },
(print_proc)function void (char * text) { printf(" {%s},\n", text); },
];

void test () {
for (int i = 0; i < tbl.length; ++i)
functbl[i]("nonsense");
}
//------------------------------------------------//

Currently, the compiler complains with "non-constant expression __anonymous". Perhaps its the above code has an error?

This will work if I separate out the definitions of the functions and name them, then put the names in the array.

Dan


« First   ‹ Prev
1 2 3 4 5 6