FourierTransformer / lua-simdjson

simdjson bindings for lua
Apache License 2.0
13 stars 8 forks source link

haxe specific implementation discussion PR (don't merge!) #12

Closed jdonaldson closed 4 years ago

jdonaldson commented 4 years ago

I was intrigued by the simdjson library, and happy to see that you wrote a Lua wrapper for it.

I'm targetting lua using a transpiler (Haxe). Haxe has first class arrays, and they're different than Lua tables in these ways:

I think the two approaches I see that could work are:

  1. Add some additional arguments to convert_element_to_table : This is easy for specifying a starting index, and the metatable, but would need an additional operation to set the length.
  2. Add a haxe-specific method (e.g. parseHaxe) : This would be way easier to specify, but perhaps you don't want to maintain that method.
  3. Add a special "customization" object to convert_element_to_table that manages all the configuration via callbacks. (E.g. sax-like parsing options like "start_array", "end_array", etc.)

In any event, thanks for the library. I know it's a work in progress, but it's covering some initial goals I had in mind.

FourierTransformer commented 4 years ago

Thanks for reaching out! I unfortunately don't know much about haxe, and you're right in that I don't really want to maintain any haxe-specific code. You are welcome to fork the repo and create a haxe/lua version! It seems like it would be the cleanest approach. You could add a length operator and then try to make arrays start from 0. You could potentially also create a lua shim that sets up the metatables and stuff after parsing. The arrays starting at 0 might be a little tricky

However, it seems like a lot of Haxe users could get some benefit from the simdjson parser, so if you wrote the extension at the haxe level (assuming that's possible, again, I don't know much about haxe) that could be quite beneficial!

jdonaldson commented 4 years ago

Thanks, this is good to know. I’ll fork this to something haxe-specific for now. However, I’ll keep tabs on your original version and share any significant updates/improvements with you.