Comments (8)
This is already elaborated in the Goals > Data Type section.
from napi.
Ok, my problem was not the goal or target... it was about understanding Haxe, the source.
Haxe implements its own data structures, instead of reusing existing native solutions.
Now I understand, my mistake.
Then... how can this be done? Let's use the HashMap data type. In C# it is equal to IDictionary. Say you want to pass a list of named objects to a function. How do you write down the signature of this function in Haxe? In C# it has to result in "void func(IDictionary input)". Is that makeable in Haxe? Using a wrapper, you will have to pack your input dictionary first into the Wrapper type.
from napi.
Another issue are exceptions. If you wrap a native class, you also have to wrap the exception.
Errors have to be reproducible for each target language.
Other thought: A macro in combination with metadata could be used to replace the proxy types with native types.
from napi.
There is a "code" branch in this repo containing some PoC code, it should demonstrate some solutions to your questions.
from napi.
The basic idea is to wrap Haxe's data type with native type. So that Haxe devs (library authors) handle haxe types and native devs (library users) handle native types.
from napi.
You MUST write new data structures to ensure that behaviour is the same on all targets. That is already done by the Haxe team. If you want a native interface for the user, you also will have a native behaviour, which can differ from other target implementations. You could use an adapter to pack a dictionary into a hash map for inputs. Or for outputs you need to unpack your hashmap.
from napi.
In no way i must do something :)
from napi.
I want to help. I am just thinking a bit too loud. Of course you do not have to do anything.
I do not understand every trick in Haxe. I am reading your code, but it is hard to understand right now.
from napi.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from napi.