Thread overview
Igor Stepanov's runtime reflection patch
Jan 12, 2012
Vladimir Panteleev
Jan 13, 2012
Trass3r
Jan 13, 2012
Vladimir Panteleev
Jan 13, 2012
Brad Roberts
Jan 13, 2012
Jacob Carlborg
Jan 13, 2012
Jacob Carlborg
January 12, 2012
Igor Stepanov has finished his runtime reflection patch, announced here a while ago. [1]

DMD patch against commit c50eb5f (from December 31): http://j.mp/xdI0hb
Druntime Github fork: https://github.com/IgorStepanov/druntime

User classes can declare a getMembers method, which becomes available in the classinfo. The patch adds implicit generation of getMembers information for all classes and structures, which do not declare the method explicitly.

Usage is simple: YourClass.classinfo.getMembers("field") returns a list of fields with that name (MemberInfo array). Use null to get all fields. This also works for modules and enumerations.

The patch also adds linkage and argument information to function TypeInfo.

An example of what would be possible with this patch: call arbitrary methods by name and a Variant array as parameters, and obtaining the result as a Variant.

Igor has asked about the potential of this patch to be included into DMD. I imagine that the consensus would be that it should at least be enabled (or disabled) with a compiler switch, or attribute in the source code.

 [1]: http://j.mp/wZLCDb
January 13, 2012
> DMD patch against commit c50eb5f (from December 31): http://j.mp/xdI0hb
> Druntime Github fork: https://github.com/IgorStepanov/druntime

Why the heck isn't the dmd patch a fork as well?
January 13, 2012
On Friday, 13 January 2012 at 01:52:04 UTC, Trass3r wrote:
>> DMD patch against commit c50eb5f (from December 31): http://j.mp/xdI0hb
>> Druntime Github fork: https://github.com/IgorStepanov/druntime
>
> Why the heck isn't the dmd patch a fork as well?

Walter said[1] that compiler modifications that change the language are better-off distributed as patches.

 [1]: http://j.mp/w6PnwF
January 13, 2012
On 1/12/2012 7:48 PM, Vladimir Panteleev wrote:
> On Friday, 13 January 2012 at 01:52:04 UTC, Trass3r wrote:
>>> DMD patch against commit c50eb5f (from December 31): http://j.mp/xdI0hb Druntime Github fork: https://github.com/IgorStepanov/druntime
>>
>> Why the heck isn't the dmd patch a fork as well?
> 
> Walter said[1] that compiler modifications that change the language are better-off distributed as patches.
> 
>  [1]: http://j.mp/w6PnwF

He meant not a language fork.  And by patch, I'm sure he included pull requests.  Terminology differences.
January 13, 2012
On 2012-01-13 00:50, Vladimir Panteleev wrote:
> Igor Stepanov has finished his runtime reflection patch, announced here
> a while ago. [1]
>
> DMD patch against commit c50eb5f (from December 31): http://j.mp/xdI0hb
> Druntime Github fork: https://github.com/IgorStepanov/druntime
>
> User classes can declare a getMembers method, which becomes available in
> the classinfo. The patch adds implicit generation of getMembers
> information for all classes and structures, which do not declare the
> method explicitly.
>
> Usage is simple: YourClass.classinfo.getMembers("field") returns a list
> of fields with that name (MemberInfo array). Use null to get all fields.
> This also works for modules and enumerations.
>
> The patch also adds linkage and argument information to function TypeInfo.
>
> An example of what would be possible with this patch: call arbitrary
> methods by name and a Variant array as parameters, and obtaining the
> result as a Variant.
>
> Igor has asked about the potential of this patch to be included into
> DMD. I imagine that the consensus would be that it should at least be
> enabled (or disabled) with a compiler switch, or attribute in the source
> code.
>
> [1]: http://j.mp/wZLCDb

Cool, but do we really want all these enums (Linkage, StorageClass and so on) at global scope?

-- 
/Jacob Carlborg
January 13, 2012
On 2012-01-13 05:33, Brad Roberts wrote:
> On 1/12/2012 7:48 PM, Vladimir Panteleev wrote:
>> On Friday, 13 January 2012 at 01:52:04 UTC, Trass3r wrote:
>>>> DMD patch against commit c50eb5f (from December 31): http://j.mp/xdI0hb
>>>> Druntime Github fork: https://github.com/IgorStepanov/druntime
>>>
>>> Why the heck isn't the dmd patch a fork as well?
>>
>> Walter said[1] that compiler modifications that change the language are better-off distributed as patches.
>>
>>   [1]: http://j.mp/w6PnwF
>
> He meant not a language fork.  And by patch, I'm sure he included pull requests.  Terminology differences.

I see no reason why Walter would want a patch instead of a pull request.

-- 
/Jacob Carlborg