Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make count more general #35

Open
rom1504 opened this issue Nov 21, 2015 · 5 comments
Open

Make count more general #35

rom1504 opened this issue Nov 21, 2015 · 5 comments

Comments

@rom1504
Copy link
Member

rom1504 commented Nov 21, 2015

roblabla: something like "count": "$variable", "count": "@type", "count": 64
roblabla: having both count and countType annoys me
roblabla: and beside that would be reusable for other stuff too like conditionals and stuff

useful for https://github.com/mhsjlw/minecraft-classic-protocol/blob/master/src/datatypes/minecraft.js http://wiki.vg/Classic_Protocol#Protocol_Data_Types

(+ what about padding ?)

@roblabla
Copy link
Collaborator

Concerning padding, I'm thinking of adding a min/max datatype. Something like ["min", 64, ["container", []] or ["max", 64, ["container", []]. This is for replacing the current garantee that we know the datatype size in NMP. With the same datatype, we could add a padding value so that if it doesn't reach that value, it adds that padding until it does.

@rom1504
Copy link
Member Author

rom1504 commented Feb 18, 2016

handling "count":64 is indeed useful. (need it for node-raknet)
I think I'll add that soon

@rom1504
Copy link
Member Author

rom1504 commented Feb 18, 2016

can't see how that would eliminate countType.

countType means "add the length before the array", count doesn't do that

@roblabla
Copy link
Collaborator

The idea is that in places where we can accept both a static number or a protocol-defined number (or anything else for that matter), we should have a standardized way to do it. A "selector".

count: 64
count: "$var"
count: "@type"

This pattern comes up quite often in datatypes (array, the fixed data-type I talk about in #57, a few other datatypes I wrote myself in other projects) so having a standardized way to do it with tools to easily operate with that would be good.

@rom1504
Copy link
Member Author

rom1504 commented Feb 29, 2016

Ah, this would allow compareTo:"value".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants