Skip to content

all-your-base: Be decisive about zeroes #1001

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

Merged
merged 2 commits into from
Nov 11, 2017
Merged

all-your-base: Be decisive about zeroes #1001

merged 2 commits into from
Nov 11, 2017

Conversation

petertseng
Copy link
Member

@petertseng petertseng commented Nov 10, 2017

all-your-base 2.0.0

In #280 we made
the explicit choice to leave various cases expected: null where tracks
can make their own decisions (leading zeroes, the representations of
zero, whether empty sequence is acceptable as input).

There are four affected cases.

#473 results in
a discussion that some post-processing is necessary, based on the
decisions that a given track makes. One might even imagine that each
individual generator may have to reimplement base translation to arrive
at the proper answers for each case.

To ease the process of translation, instead we make some canonical
choices, explicitly show what the choices are, and offer that tracks may
make a different choice if desired.

A previous proposal did not receive support:
#468

However, this proposal differs because it does change the comments at
the top of the file.

Closes #1002 by mutual exclusion

all-your-base 2.0.0

In #280 we made
the explicit choice to leave various cases `expected: null` where tracks
can make their own decisions (leading zeroes, the representations of
zero, whether empty sequence is acceptable as input).

There are four affected cases.

#473 results in
a discussion that some post-processing is necessary, based on the
decisions that a given track makes. One might even imagine that each
individual generator may have to reimplement base translation to arrive
at the proper answers for each case.

To ease the process of translation, instead we make some canonical
choices, explicitly show what the choices are, and offer that tracks may
make a different choice if desired.

A previous proposal did not receive support:
#468

However, this proposal differs because it does change the comments at
the top of the file.

Closes #1002 by mutual exclusion
@petertseng
Copy link
Member Author

The intent is that #1000 will be merged and zero or one of (#1001, #1002) will be merged.

I gain very little benefit from #1001.

"It's up to each track do decide:",
"This canonical data makes the following choices:",
"1. Zero is always represented in outputs as [0] instead of [].",
"2. In no other instances are leading zeroes present in any outputs.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not really a choice that I expect there to be controversy on, so I guess it is just here to be a foil to choice 1.

"This canonical data makes the following choices:",
"1. Zero is always represented in outputs as [0] instead of [].",
"2. In no other instances are leading zeroes present in any outputs.",
"3. Leading zeroes are accepted in inputs.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be relatively obvious that the opposite choice is "rejected", so a clause, "rather than being rejected" was not added.

Copy link
Contributor

@Insti Insti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this.
It's good for canonical data to be definite.

Copy link
Contributor

@ferhatelmas ferhatelmas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was writing a generator for it yesterday and didn't like this canonical data since we needed to make choices. This is great!

@petertseng
Copy link
Member Author

I think I'll make this 1.2.0 since this commit doesn't introduce any new types that were not already present in this file. That way I can merge this then #1000 and end with version 2.0.0 rather than 3.0.0 or 2.1.0 or something. Not that there's any benefit to being minimal with version changes.

That means we temporarily restore the "invalids are null" text, only to
remove it in #1000
@petertseng petertseng merged commit b3a735c into exercism:master Nov 11, 2017
@petertseng petertseng deleted the ayb-be-decisive branch November 11, 2017 08:02
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

Successfully merging this pull request may close these issues.

3 participants