This project has moved and is read-only. For the latest updates, please go here.

Global camel case support

Dec 1, 2014 at 2:18 AM

I mentioned this on my issue but thought I would start a discussion, what do we thing about adding the ability to add global camel case support.

I was thinking something like ScriptEngine.NameResolver = new CamelCaseNameResolver();

By default we would do everything as currently until you add the new resolver, it would simply lower case the first letter of a property/method name.

It would still allow attributes to override this if required.

Dec 1, 2014 at 1:42 PM
Hi Stefan,

That's an interesting idea. Some thoughts:

  • In ClearScript it probably would be easier and more natural if the resolver worked in the other direction - that is, if it took names issued by script code and transformed them into names used on the host.
  • For applications that expose many host resources, it might be useful to allow the resolver to examine the target object and/or type.
  • This mechanism might have uses beyond name transformation, such as blocking access to arbitrary members, modifying argument lists, checking permissions, etc. It probably could be a generic binding hook.
We'd love to hear more thoughts or ideas.

Apr 17, 2015 at 8:59 AM
+1 for this feature (different cases would confuse any users who are editing scripts and do not have a lot of experience with many languages).

It would also be nice to have options for blocking all member access by default, and only allowing access through the ScriptMember attribute or conventions which one registers (i.e. all properties of type x, or all types in assembly y).
Apr 20, 2015 at 3:47 PM
Edited Apr 20, 2015 at 3:47 PM
Hello uberclops,

ClearScript 5.4.2 will allow you to specify ScriptAccess defaults at the type and assembly levels. We're tracking the generic binding hook feature here.

Apr 21, 2015 at 6:09 AM
Awesome, thanks guys! Keep up the good work :)
May 21, 2015 at 1:11 PM
Is there any updated documentation for 5.4.2 describing how to achieve global camel case support?
May 21, 2015 at 3:49 PM
Hi again,

The generic binding hook feature is not in ClearScript 5.4.2, and we don't have an ETA. We're still evaluating what its scope should be and what its API should look like. Sorry!