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

range values #246

Open
ratmice opened this issue Jun 2, 2020 · 5 comments
Open

range values #246

ratmice opened this issue Jun 2, 2020 · 5 comments
Labels
feature A new feature for the syntax or library. help wanted

Comments

@ratmice
Copy link

ratmice commented Jun 2, 2020

It doesn't look (or at least isn't documented whether or not) Ron supports the rust range syntaxes 0..5 etc, I think it would be nice to support these perhaps.

@kvark kvark added the feature A new feature for the syntax or library. label Jun 2, 2020
@kvark
Copy link
Collaborator

kvark commented Jun 2, 2020

Yes, this would be greatly appreciated if we could do this.
On the other hand, this is complicating the spec and grammar, so there is a trade-off.
Perhaps, the right path here is making this a RON extension.

@torkleyy
Copy link
Contributor

torkleyy commented Jun 6, 2020

IIRC ranges can be deserialized as tuples, that is (0, 5) instead of 0..5.

Given that serde implements this behaviour, I don't see how RON could implement this syntax while limiting it to ranges only.

@ratmice
Copy link
Author

ratmice commented Jun 6, 2020

@torkleyy I'm not really familiar with the serde code base, so could be misunderstanding, however
it looks to me like it just serializes it as a struct range with fields to and from serialize and there is also a deserialize specific to Range, and that deserialize returns Result<Range,...>, I wouldn't expect a impl Deserialize for Range at all if it was serializing to tuples.

That said, I have yet to actually try it, So holding out hope you are remembering something specific to a data format.

There would be a related problem if it serialized RangeInclusive to the same thing as Range it uses the same to, and from fields, but has a different structure name RangeInclusive so hopefully it seems like we can differentiate those based on the structure name.

@kvark no qualms with an extension if it need be, I'd had a look

@github-actions
Copy link

Issue has had no activity in the last 180 days and is going to be closed in 7 days if no further activity occurs

@github-actions github-actions bot added the stale label Nov 18, 2021
@kvark kvark reopened this Dec 3, 2021
@kvark
Copy link
Collaborator

kvark commented Dec 17, 2021

comment

@kvark kvark reopened this Dec 17, 2021
@github-actions github-actions bot removed the stale label Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature for the syntax or library. help wanted
Projects
None yet
Development

No branches or pull requests

4 participants