These are chat archives for ProtoDef-io/node-protodef

3rd
Mar 2017
Romain Beaumont
@rom1504
Mar 03 2017 12:10
@roblabla how do you decide what's the main type ?
ie, can you generate the read/write code for any other type than packet ?
I'm thinking about how to implement node-protodef compiler, and I want to keep the ability to encode/decode all types
but at the same time I like the fact you (and elixir-protodef) have no functions
does it mean I have to duplicate the code ?
ha
well very clearly you are both doing that
which mean you cannot handle circular dependencies ( https://github.com/PrismarineJS/prismarine-nbt/blob/master/nbt.json#L27 )
maybe I should keep my functions after all
Romain Beaumont
@rom1504
Mar 03 2017 12:16
as long as I drop the typeargs
wonder why I was saying it means losing 10x of perf though
ah "eliminate the context object" right
well well
still think the "no function" way makes everything so much simpler
maybe if it means not having circular dependencies it's ok ?
that makes defining nbt as protocol.json impossible though
feels manually written
Romain Beaumont
@rom1504
Mar 03 2017 12:35
well well
except even the numerical reading/writing code in node is ugly
oh well
I know what should be done
take the ProtoDef tests
manually write code in js that read these types perfectly
then try to generate the same thing
Romain Beaumont
@rom1504
Mar 03 2017 13:10
doing that
all these offset manipulation
it will never look as good as the rust or elixir code
Hans Elias J.
@hansihe
Mar 03 2017 16:40
elixir_protodef can handle using subtypes compiled into functions no problem
the issue is that you wouldn't be able to use super across function boundaries
Romain Beaumont
@rom1504
Mar 03 2017 16:42
yeah that's fine
but can it handle recursively defined "subtypes" ?
Hans Elias J.
@hansihe
Mar 03 2017 16:42
yes
you would have to put a configuration entry in the compiler context, but it's only like one line
Romain Beaumont
@rom1504
Mar 03 2017 16:43
ok
Hans Elias J.
@hansihe
Mar 03 2017 16:44
this is from memory by the way, so there might be some things I remember wrong
but in any case the general design of the compiler is compatible, so making it would would only require small tweaks
making it work*