[e-lang] Joe-E reflection API questions
David Wagner
daw at cs.berkeley.edu
Mon Apr 23 17:06:46 EDT 2007
Mark Miller writes:
>On 4/21/07, David Wagner <daw at cs.berkeley.edu> wrote:
>> Comment: fields() returns all fields, including inherited fields.
>> field() ignores inherited fields. That's non-uniform and inconsistent,
>> which is surprising and confusing. I think that either they both should
>> return inherited fields, or neither. I prefer the former.
>
>Some other options:
>
>1) rename field() to declaredField(), following the Java reflection
>naming convention.
>
>2) have all four: field(), fields(), declaredField(), declaredFields().
>
>3) Add another boolean flag (in addition to the current static-vs-instance flag)
Any of those seem reasonable to me. My personal reaction is to think
that 1) and 2) seem mildly cleaner than 3) (a proliferation of boolean
arguments seems mildly kludgy), but any would do the trick.
I suppose another possibility is to reserve the four names you list
and implement only a subset of them (at least for now), if we think
that only a subset will normally be needed or used by typical clients.
I'm not especially advocating this, just adding to the list of
options.
>Actually, it's a bit weirder than that: methods(Reflection.instance,
>...) includes inherited methods, but methods(Reflection.statics, ...)
>does not.
Hmm. I hadn't noticed that. Yup, that seems unexpected. Thanks.
More information about the e-lang
mailing list