typeof()

Jacob Carlborg doob at me.com
Thu Oct 20 23:29:44 PDT 2011


On 2011-10-20 19:36, Steven Schveighoffer wrote:
> On Thu, 20 Oct 2011 12:26:29 -0400, Jacob Carlborg <doob at me.com> wrote:
>
>> On 2011-10-20 16:20, Steven Schveighoffer wrote:
>>> On Thu, 20 Oct 2011 10:07:12 -0400, Gor Gyolchanyan
>>> <gor.f.gyolchanyan at gmail.com> wrote:
>>>
>>>>> D's runtime type info is very limited, so you may not be able to get
>>>>> what you are looking for.
>>>>
>>>> D's compile-time type info is very rich and it's easy to remember it
>>>> for run-time use.
>>>
>>> Yes, but you have to do some funky stuff to link it to the typeinfo.
>>> Compare this to other languages where the compiler generates a very rich
>>> set of runtime info (e.g. Java).
>>>
>>> I think actually, the runtime info generated by the compiler is seldom
>>> used (except for maybe dynamic casting), and just creates bloat.
>>>
>>> I envision in the future, the runtime info generated would be triggered
>>> by an annotation like @rtti("functions", "fields", "inheritance"). That
>>> would give us a good hook to selectively generate rtti when it makes
>>> sense.
>>>
>>> -Steve
>>
>> And the you get big problems when you want to use the runtime info of
>> a type you don't control and it doesn't use that attribute.
>
> Big problems being, things are null? So? Right now, there's almost no
> RTTI, and we do just fine.
>
> -Steve

I got the impression that you suggested that the current RTTI should be 
removed and only be available if you're using the @rtti attribute.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list