September 25, 2001 Re: Structs and compound return types | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | As soon as I hit "Send" I realized I had a quibble. Sorry for the double-post.
While I like the fact that GCC has this feature, and I like the fact that the syntax handles overloading well, I don't like the "feel" of the syntax. I still think it should be a property. Walter has said that there will be a property ".class or some such" (see "finding the class of an object" thread). If we call it .typeof, then it works in many situations:
class Foo {};
struct { int a; int b; } bar(char *);
Foo a;
a.typeof b;
bar(char*).typeof retVal;
| |||
September 26, 2001 Re: Structs and compound return types | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | Russ Lewis wrote:
>
> As soon as I hit "Send" I realized I had a quibble. Sorry for the double-post.
>
> While I like the fact that GCC has this feature, and I like the fact that the syntax handles overloading well, I don't like the "feel" of the syntax. I still think it should be a property. Walter has said that there will be a property ".class or some such" (see "finding the class of an object" thread). If we call it .typeof, then it works in many situations:
>
> class Foo {};
>
> struct { int a; int b; } bar(char *);
>
> Foo a;
> a.typeof b;
> bar(char*).typeof retVal;
Depending on how generics get implemented, this could be very useful. It might make some parts of generic programming a lot easier.
Dan
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply