Repository navigation
Conversation
|
Reference Issue: #2 |
There was a problem hiding this comment.
AFAIK UInt32 is just a static cast from number type. Int32 and Double are the only real types backing them.
|
@obastemur Thanks much for this. Doing the full review now. On the side, I'd like all the documents to word wrap. Found it introduces less noise in the git diff's over time. |
There was a problem hiding this comment.
I don't see Symbol here.
Additionally, how would the types like Array be handled?
There was a problem hiding this comment.
Symbol wasn't in the original definition and may require additional set of native API. I left it to discussion. May I consider your comment as +1 for Symbol?
IMHO, object covers Array as it is not a separate type. API may question an object whether it is an array or not. i.e. JS_CreateArray, JS_IsArray, JS_GetArrayLength ...
There was a problem hiding this comment.
Concerning Array, the one native API users depend on is Array::Length(). Other than that, you're correct in that they're basically the same.
I mention Symbol because usage has been increasing on the JS side, and it will mostly likely be necessary for users to access object properties via a Symbol instead of a string.
There was a problem hiding this comment.
Okay adding Symbol into JSTypes.
API should covert Array::Length
GetLength -> isArray? GetArrayLength : GetStringLength
GetUtf8Length -> isArray? FAIL OR return ToString().utf8Length
There was a problem hiding this comment.
I'll assume that String::GetLength() would return the byte length, or the ucs2 length? Since .utf8Length() would be the equivalent of 'abc'.length
Agree. Will keep in mind. |
There was a problem hiding this comment.
nit: backtick ObjectTemplate and FunctionTemplate. similar to anywhere that is a proper API function/method/etc.
|
@obastemur Thanks much for writing this up. Have a few comments, but other than the word wrapping thing I'd be fine merging this in. I'll give it a day or two for others to ask questions, but will land it if no one chimes in. |
There was a problem hiding this comment.
I think we can drop Buffer from th list? By the time this document becomes relevant, it will be implemented in terms of ArrayBuffer.
There was a problem hiding this comment.
Yes makes sense. Gonna remove Buffer.
There was a problem hiding this comment.
The new Buffer impl is technically based on Uint8Array. Mention this only because in V8, Typed Arrays don't inherit from ArrayBuffers.
May consider a more generic type. V8 has a TypedArray class that all Typed Arrays inherit from. Using something similar, it could contains information about the byte width of each index, etc.
Though ArrayBuffer will also be necessary since it must be possible to access the ArrayBuffer that backs the Typed Array.
|
Left some comments. Can you wrap lines at 80 columns? |
|
s/data_dypes.md/data_types.md/ |
|
Applied the requested changes. Thanks for all the advices.
|
|
@obastemur Awesome. Thanks for this work.
Forgive my dead brain. Mind elaborating this point? I'm happy with it, and further changes can be discussed later. When I'm back close to my computer I'll merge this (with a few nit fixes I didn't want to waste your time with). |
|
@trevnorris Thanks.
Let's say an ASP.NET solution embeds Better I open this subject under another discussion item. |
PR-URL: #4 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
|
Thanks much. Landed with some rewording and whitepaces fixes in b2b6309. |
|
It's still using |
|
@bnoordhuis Not sure. I also noticed that ArrayBuffer wasn't added to the types list, but figured having at least something committed would bring more participation. If you have a change feel free to throw it up. |
|
Intention was to left all those parts for discussion. i.e.
I agree with @trevnorris that there will be many updates and changes to this premature first step. |
A basic documentation for an initial effort to abstract the data types between JS engine(s) and addon(s).