!@#$%^&*( standards/design committee bullshit again... in JavaScript, there is a utility object called Reflect.
EXPECTED SEMANTICS:
In general computer programing, reflection is 'is the ability of a process to examine, introspect, and modify its own structure and behavior'... therefore one should expect that a set of methods, RM, allowing objects to reflect upon themselves would be declared on the prototypical object, such that all descendent objects would be able to be called like this,
`arbitraryObject.aMemberOfTheSetRMWhichCanDoReflection()`.HELL NO.
It turns out that there are legacy methods, LM, in the prototypical object, Object, which were deemed close but insufficient, and the legacy methods had to be reimplemented. So where did they choose to implement these? They created a utility object, Reflect, whereby you call RM as a method of Reflect, passing in the target object as an argument.
- First of all, now they have the set of methods Reflect.RM which look almost like Object.LM, such that a crucial step in the documentation of Reflect should really begin with a table showing the differences and similarities between Object.LM and Reflect.RM. But they don't open with it - they kinda bury it... and you have to find or build the table carefully. OK.
- Second, the main issue that jumps out at me when I look at this is the semantic salad. It's really one of those 'who the fuck decided this?' things... Reflect doesn't do (its own personal) reflection! It just grabs other people (other objects) and makes them do things! The goddamn object should have been named 'Possess' or 'Dominate' instead!
As in introduction to Reflect, you may want to read these, in this order:
No comments :
Post a Comment