Thread overview | ||||||
---|---|---|---|---|---|---|
|
July 09, 2002 Exposing Type Information to Runtime Code | ||||
---|---|---|---|---|
| ||||
IMHO, you should be able to discover all of the information about variables and their types at runtime. Now, before everybody gets antsy, I'm not talking about embedding it in the variables themselves, nor even requiring that the programmer use it. But I think that you should be able to write a line something like: MyClass.type ...... Which gives you access to a tree of data that describes everything about that type - its members, their properties, etc. If you don't use access it, then the compiler doesn't have to generate it for your program. But if you do use it, it is far more maintainable, readable, and cross-portable than any other solution I've found so far. -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
July 10, 2002 Re: Exposing Type Information to Runtime Code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | Not only at runtime, this kind of info can really help you write nice template code. At very very least you need typeof(), sizeof(), and offsetof(). Sean "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3D2B29A8.64BF8A8F@deming-os.org... > IMHO, you should be able to discover all of the information about variables and their types at runtime. > > Now, before everybody gets antsy, I'm not talking about embedding it in the variables themselves, nor even requiring that the programmer use it. But I think that you should be able to write a line something like: > > MyClass.type ...... > > Which gives you access to a tree of data that describes everything about that type - its members, their properties, etc. > > If you don't use access it, then the compiler doesn't have to generate it for your program. But if you do use it, it is far more maintainable, readable, and cross-portable than any other solution I've found so far. |
July 20, 2002 Re: Exposing Type Information to Runtime Code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | It is a good idea, and it is where ClassInfo and TypeInfo are heading. However, they are not there yet, for the reason that I don't want to stuff those with things I imagine might be useful, but instead I'll put in things as significant needs for them become apparent. Both will likely play a significant role in future generic type design for D. -Walter "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3D2B29A8.64BF8A8F@deming-os.org... > IMHO, you should be able to discover all of the information about variables and their types at runtime. > > Now, before everybody gets antsy, I'm not talking about embedding it in the variables themselves, nor even requiring that the programmer use it. But I think that you should be able to write a line something like: > > MyClass.type ...... > > Which gives you access to a tree of data that describes everything about that type - its members, their properties, etc. > > If you don't use access it, then the compiler doesn't have to generate it for your program. But if you do use it, it is far more maintainable, readable, and cross-portable than any other solution I've found so far. > > -- > The Villagers are Online! villagersonline.com > > .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] > .[ (a version.of(English).(precise.more)) is(possible) ] > ?[ you want.to(help(develop(it))) ] > > |
July 20, 2002 Re: Exposing Type Information to Runtime Code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | On Tue, 9 Jul 2002 22:44:31 -0700 "Sean L. Palmer" <seanpalmer@earthlink.net> wrote:
> Not only at runtime, this kind of info can really help you write nice
> template code. At very very least you need typeof(), sizeof(), and
> offsetof().
You have 'em:
object.classinfo
object.size
struct.field.offset
|
Copyright © 1999-2021 by the D Language Foundation