Sorry for the delays in responses, things are a bit hectic around here 
now-a-days.

Are there plans to update the documentation on the website? It seems that 
nbind has been around for quite a while... why hasn't embind been 
deprecated?

Cheers,
Ricky

On Sunday, November 27, 2016 at 6:00:41 AM UTC-8, Juha Järvi wrote:

> nbind is a replacement for embind because otherwise it seemed very 
> difficult or impossible to:
>
> - Support also targeting Node.js and Electron addons
> - Design C++ APIs without constraints (using pointers and references etc. 
> as normal)
> - Pass objects by value so they belong to an appropriate class in both C++ 
> and JavaScript
>
> Since everything had to be redesigned anyway for the above reasons, it was 
> also possible to:
>
> - Autogenerate TypeScript definitions
> - Avoid having to register vectors and smart pointers to use them
> - Avoid generating JavaScript dispatcher functions when argument and 
> return values are numeric
> - Support multiple inheritance
> - Support passing 64-bit integers (converting to JavaScript double or 
> using any JavaScript bignum library)
> - Write internal code in ES6 style TypeScript instead of ES5
> - Write all internal tests using plain JavaScript and set up Travis CI
> - Use more compact syntax:
>
> embind:
>
> EMSCRIPTEN_BINDINGS(my_class_example) {
>   class_<MyClass>("MyClass")
>     .constructor<int, std::string>()
>     .function("incrementX", &MyClass::incrementX)
>     .property("x", &MyClass::getX, &MyClass::setX)
>     .class_function("getStringFromInstance", 
> &MyClass::getStringFromInstance)
>     ;
> }
>
> nbind:
>
> NBIND_CLASS(MyClass) {
>     construct<int, std::string>();
>     method(incrementX);
>     getset(getX, setX);
>     method(getStringFromInstance);
> }
>
> Other future improvements are also possible but not sure about when 
> there's time:
>
> - Method overloading based on argument types (multiple inheritance makes 
> this a bit more complicated)
> - Support compiling to native code on mobile (React Native, Weex...)
> - Precompile a single native Node.js addon for all versions Node.js and 
> Electron on the same platform
>
> Again the latter two are out of scope or impossible with embind.
>
> perjantai 25. marraskuuta 2016 23.38.33 UTC+2 rickyp kirjoitti:
>>
>> Matthias - Thanks, I figured it would be a bit difficult but given that 
>> it ends up in JavaScript I figured there maybe a way to extend the compiler 
>> a bit more. I tried a few js -> d.ts generators but they all seemed to fail.
>>
>> Juha - I'll give that a shot. Is nbind replacing embind or is it 
>> completely separate?
>>
>> On Tuesday, November 22, 2016 at 3:36:25 AM UTC-8, Juha Järvi wrote:
>>
>>> nbind <https://github.com/charto/nbind#using-with-typescript> has a 
>>> somewhat shorter syntax than Embind and generates TypeScript definitions 
>>> out of the box. You can also compile native binary Node.js addons with the 
>>> exact same binding code, just by changing a build flag.
>>>
>>> maanantai 21. marraskuuta 2016 14.45.59 UTC+2 matthias kirjoitti:
>>>>
>>>> The WebIdl to Typescript tool (https://github.com/hfmanson/idl) did 
>>>> not work out of the box. You would need to extend it.
>>>> On the other hand I think Embind has more features/possibilities than 
>>>> WebIdl.
>>>>
>>>> We tried to create a wrapper arround Embind to create embind bindings + 
>>>> code to create typescript definitions. Unfortunately you can not output 
>>>> this directly with a compiler. Instead you have to translate it into 
>>>> JavaScript and run it for example in Node.js and this can output 
>>>> typescript 
>>>> definitions. If you use emscripten::val it is even more complicated 
>>>> because 
>>>> this can be anything.
>>>>
>>>>
>>>> Am Dienstag, 2. Juni 2015 16:27:45 UTC+2 schrieb matthias:
>>>>>
>>>>> With embind I am able to create some class library written in C++ 
>>>>> (which is very nice).
>>>>> Is there a possibility that emscripten/embind also creates a 
>>>>> typescript definition file (*.d.ts) file?
>>>>> Or are there any plans to support that?
>>>>>
>>>>> If it would be possible to create such a file you could use the 
>>>>> emscripten/embind library in a typescript project and typescript would 
>>>>> give 
>>>>> you errors if you use the wrong names, parameters, types and so on.
>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to