paulbartrum / jurassic

A .NET library to parse and execute JavaScript code.
MIT License
873 stars 122 forks source link

Added a ability to disable exposing of CLR collections by value #183

Closed Taritsyn closed 4 years ago

Taritsyn commented 4 years ago

Two years ago (5b83b3b), instances of CLR collections began to be passed by value (not everywhere, this did not affect the instances, that passed directly). This innovation led to errors like this - “TypeError: The method call is ambiguous between the following methods…”.

To solve this problem, I suggest adding a property (DisableClrCollectionsExposingByValue) that allows to disable this feature.

paulbartrum commented 4 years ago

Honestly, I don't like ClrInstanceWrapper and I'm loath to add properties to ScriptEngine which I might have to remove at a later date. My current long-term plan is to make it easy for library end-users to generate interoperability shims at compile-time, just like the library itself does right now, most likely using C# 5 source generators. Unlike ClrInstanceWrapper, compile-time shims are fast, easy to debug and easy to understand, with the main down-side being that they are traditionally hard to integrate into the build process. (I'm hoping source generators will help with this.)

Taritsyn commented 4 years ago

Yes, this is a good idea.