|
|
Am 16.05.2011 07:01, schrieb Darren New:
> There's similar wording in C#. It's more like "this type is an interface
> to manipulate classes, which aren't really first-class objects, which is
> why we give you this separate data structure to manipulate them." It
> just *feels* like they're not first-class objects, compared to Smalltalk
> or JavaScript or something like that.
I do agree.
For classes to be 1st-class objects, I'd expect to be able to do the
same things with class expressions that you'd be able to do with class
names, such as:
MyClass foo (Class<MyClass> c)
{
return new c();
}
instead of the more cumbersome Java code:
MyClass foo (Class<MyClass> c)
{
Constructor<MyClass> co = c.getConstructor();
return co.newInstance();
}
Those are the things that make you /feel/ that the reflection API is
something designed on top of an earlier language design.
Post a reply to this message
|
|