Is it possible to support index setter through parentheses instead of brackets in V8Engine? #520
Replies: 1 comment
-
Hi @ZelgiusLiu,
It's a JScript-specific language extension that facilitates host object access. JScript and VBScript interact with host objects via
V8 supports only standard JavaScript language features. It's an open-source project, so modifications are certainly possible, but this sort of change is outside the scope of the ClearScript project. .NET does have support for parameterized properties, although in C# it's limited to indexers. ClearScript allows standard JavaScript code to access such properties via the following somewhat clunky pattern: value = obj.Item.get(arg1, arg2, ...); // OR: value = obj.Item(arg1, arg2, ...);
obj.Item.set(arg1, arg2, ..., value); Here "Item" is the name of the property. Most C# indexers are actually named "Item" under the covers, but other languages may use different names. Good luck! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am now trying to upgrade some old projects using JScriptCodeProvider to newer version of .Net.
And when converting the JScrriptCodeProvider to ClearScript, I found some interesting differences.
As shown in the following code, I found that for JScript, it supports both getting and setting operations with index operator through parentheses; then, for V8Engine, it supports only getting value through parentheses, and setting operation can only be done when using brackets:
Here is what confuses me:
Beta Was this translation helpful? Give feedback.
All reactions