-
Notifications
You must be signed in to change notification settings - Fork 242
JSReplacement and reflection #850
Comments
The replacement can't be a method body, though, because it's a textual replacement macro. Not sure what we should do about this... |
Really, JSReplacement currently do two things:
I'd like split it a little bit. JSReplacement still will replace method usage, but will not suppress marked method generation (but it still not be called in most cases, except reflection). |
I'm OK with making JSReplacement not strip the method from output, as long as it doesn't break anything. Seems like a good idea. The behavioral gap between normal invocation/reflection invocation will suck, though. |
That's why I originally suggested put same macro inside MethodBody that was marked with JSReplacement. So, body of method marked with JSReplacement included in translated results will be just same if you use it through reflection. |
Well, there are cases where it wouldn't work, but maybe that's an acceptable compromise. |
On other side, right now we use JSReplace mostly to change invocation format if we cannot use standard - such as calling string/array/numeric methods. |
I think you're right. We want a split where one of them is 'replace method body (and inline optimistically)' and the other one is a macro replacement of sorts. |
@kg, what do you think about JSSuppressOutput meta attribute? Right now we have: We still have no any attribute, that will affect only method output and will just mute it for some particular class/method/etc. If JSReplacement will not suppress output, there may be some places where we want mark method additionally with JSSuppressOutput attribute. |
Looks like we should do changes proposed in this issue to implement ToString for char (#938) |
Probably we need to review meta attributes (and corresponding MemberInfo/TypeInfo flags) that affect on member proxy mapping, member output and member invocation translation. I'll try to collect here tasks that should affect on our decision. Meta attributes that help us identify member as proxy for another member Meta attributes that affect how member is translated JSExternal
Topics o investigate: how it JSExternal affect default field value, what will happen with inner classes if parent class marked with JSExternal. JSIgnore JSIgnore JSReplacement JSStubOnly JSNeverStub JSChangeName JSChangeToStaticMethod JSExtraStaticConstructor Meta attributes that affect how member invocation/usage is translated: JSReplacement JSChangeName JSChangeToStaticMethod JSRuntimeDispatch JSAlwaysAccessAsProperty Additional questions: |
Off the top of my head:
This forces the method to be translated even if you're not translating the module. I... forget what this is for, but it solved some sort of problem. Property accessors, maybe?
This... doesn't seem to do anything anymore? I think it did once, the comment above the definition explains what it should've done. Weird, we should remove it.
This lets you introduce additional static constructors on the type that run... after the original one, I think. This is intended to let you initialize additional global state with the type so that your externals/proxies will work.
It should do the right thing, but I'm not sure whether there is a test.
Great question, never tested it. For indexers it should produce Things here are complex enough that I'm wondering whether it would be worth it to do a full overhaul of all the Meta attributes so that we have a smaller set of better-defined attributes that have arguments to fine-tune behavior. We could map all the old attributes to the new ones, such that there's an old-Meta that's compatible with old code. |
Great, really rethinking ad re-implementing meta-attributes from scratch was what I'd thought about. Will try to create some proposal that will limit number of attributes/combinations and attribute targets for each attribute in such way, that it still be able do anything that is used in Proxies now, but have minimal or no duplication of functions. |
Do we really need JSChangeName? |
It really only exists for stuff like |
Currently using of JSReplacement affect reflection, as member with JSReplacement is not translated.
I suggest in any translate JSReplacement method with same body as passed in JSReplacement attribute.
The text was updated successfully, but these errors were encountered: