August 05, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | On Mon, 5 Aug 2002 10:09:57 -0700 "Sean L. Palmer" <seanpalmer@earthlink.net> wrote:
> Don't want it to change on recompile (breaks existing data files). So it should be some kind of hash on the name.
Then GUID will probably be a better idea. Never heard of those duplicating.
|
August 05, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | On Mon, 5 Aug 2002 15:46:12 +0000 (UTC) Patrick Down <pat@codemoon.com> wrote: >> Python is an interpreted language. D is not. > > So? Does this mean that D should not have introspection so that > you can do similar things? I'm not asking for run time modifiable > code or structures. I'm just asking to be able to list the names and > types of members. .. which adds significant bloat to compiled executable. > Ok, I can see this as useful but it really just seems like introspection where the user can turn it on and off at the function and member level. Yes, it is exactly that. And I like it: where it is really needed, you turn it on; where it is not, it doesn't waste space. |
August 05, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | On Mon, 5 Aug 2002 01:26:38 -0700 "Sean L. Palmer" <seanpalmer@earthlink.net> wrote: > Test for IsA (is instance of A) and IsDerivedFromA (is instance of A or is > instance of class derived from A) These are very easily written by user - just look at ClassInfo. =) > Of course dynamic cast. All reference casts in D are dynamic. |
August 05, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Pavel Minayev <evilone@omen.ru> wrote in news:CFN374739675806829@news.digitalmars.com: > On Mon, 5 Aug 2002 15:46:12 +0000 (UTC) Patrick Down > <pat@codemoon.com> wrote: > >> Ok, I can see this as useful but it really just seems like introspection where the user can turn it on and off at the function and member level. > > Yes, it is exactly that. And I like it: where it is really needed, you turn it on; where it is not, it doesn't waste space. Ok, that seems reasonable. Perhaps you should be able to turn in on and off at the class and module level too. Also if you go as far as to add new keyword for member introspection should it go as far as C# style tagging? |
August 06, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | On Mon, 5 Aug 2002 19:45:39 +0000 (UTC) Patrick Down <pat@codemoon.com> wrote: > Ok, that seems reasonable. Perhaps you should be able to turn in on and off at the class and module level too. Yes, right. > Also if you go as far as to add new keyword for member introspection should it go as far as C# style tagging? Could you please remind me about it? |
August 06, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | So how (and when) do you generate it? GUID's have timestamp and local NIC info. That means a data file I make on my machine with an exe I compile, if you have identical source and you recompile and try to read my data file it won't match. No good. A crc32 on the fully explicit scoped name (with dots as separators) would likely be plenty sufficient. Sean "Pavel Minayev" <evilone@omen.ru> wrote in message news:CFN374739687560995@news.digitalmars.com... > On Mon, 5 Aug 2002 10:09:57 -0700 "Sean L. Palmer" <seanpalmer@earthlink.net> > wrote: > > > Don't want it to change on recompile (breaks existing data files). So it > > should be some kind of hash on the name. > > Then GUID will probably be a better idea. Never heard of those duplicating. |
August 06, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | This sounds like a cool idea. This would be useful in saving/loading objects. <Babble> I'd also like it if D provided other faculties for save/loading classes from file. Some features to aid in quickly save parts of the hierarchies of class objects to files. Some support in saving objects that have multiple references and then in restoring their pointer locations on a load. (I've done that before, but it would be nice to have some sort of support either in lib form or complier form for it). -PS Lucky this a digitalmars newgroup and hasn't been attacked by that newgroup porn thing. What's with that Evil. "Pavel Minayev" <evilone@omen.ru> wrote in message news:CFN374739675806829@news.digitalmars.com... > On Mon, 5 Aug 2002 15:46:12 +0000 (UTC) Patrick Down <pat@codemoon.com> wrote: > > >> Python is an interpreted language. D is not. > > > > So? Does this mean that D should not have introspection so that > > you can do similar things? I'm not asking for run time modifiable > > code or structures. I'm just asking to be able to list the names and > > types of members. > > .. which adds significant bloat to compiled executable. > > > Ok, I can see this as useful but it really just seems like introspection where the user can turn it on and off at the function and member level. > > Yes, it is exactly that. And I like it: where it is really needed, you turn it on; where it is not, it doesn't waste space. |
August 06, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Pavel Minayev wrote:
> On Mon, 5 Aug 2002 15:46:12 +0000 (UTC) Patrick Down <pat@codemoon.com> wrote:
>
>
>>>Python is an interpreted language. D is not.
>>>
>>So? Does this mean that D should not have introspection so that
>>you can do similar things? I'm not asking for run time modifiable code or structures. I'm just asking to be able to list the names and types of members.
>>
>
> .. which adds significant bloat to compiled executable.
It's not going to be compile-time optional, so this subthread can die.
|
August 06, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Pavel Minayev <evilone@omen.ru> wrote in news:CFN374743695890046@news.digitalmars.com: > On Mon, 5 Aug 2002 19:45:39 +0000 (UTC) Patrick Down > <pat@codemoon.com> wrote: > >> Ok, that seems reasonable. Perhaps you should be able to turn in on and off at the class and module level too. > > Yes, right. > >> Also if you go as far as to add new keyword for member introspection should it go as far as C# style tagging? > > Could you please remind me about it? I meant attributes, I had to get the book out and remind myself. They are extra information available via reflection besides the name and type information. The syntax is like this. [Serializable] class Foo { } There are a number of built in attributes but like Serializable but you can also define your own. For example you might attach a human readable name for a runtime property browser. class Foo { [ Serializable, PropName("The yearly interest rate") ] public int yearlyRate { get { return yrRate; } set ( yrRate= value; } } } I'm not necessarily advocating them for D but they are an interesting language feature of C#. |
August 07, 2002 Re: TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to anderson | I propose a standard "convert to byte array" function (and corresponding "convert byte array to object" function). Not sure what the syntax should be. Something along the lines of standard conversion to string, just a binary version. Actual file I/O isn't the hard part, and streaming/persistence doesn't always go to a disk file anyway (i.e. message pipe, network socket, some kind of custom file, compressed file, etc) Sean "anderson" <anderson@firestar.com.au> wrote in message news:aioclq$11f4$1@digitaldaemon.com... > This sounds like a cool idea. This would be useful in saving/loading objects. > > <Babble> > I'd also like it if D provided other faculties for save/loading classes from > file. Some features to aid in quickly save parts of the hierarchies of class > objects to files. Some support in saving objects that have multiple references and then in restoring their pointer locations on a load. (I've done that before, but it would be nice to have some sort of support either in lib form or complier form for it). > > -PS Lucky this a digitalmars newgroup and hasn't been attacked by that newgroup porn thing. What's with that Evil. |
Copyright © 1999-2021 by the D Language Foundation