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

Drop BigEndian from codegen input #81

Merged
merged 1 commit into from
Oct 26, 2022
Merged

Drop BigEndian from codegen input #81

merged 1 commit into from
Oct 26, 2022

Conversation

rsheeter
Copy link
Collaborator

@rsheeter rsheeter commented Oct 21, 2022

Remove BigEndian from codegen inputs. Output is unchanged, except a few places where a (pointless?) BigEndian<u8> is changed to naked u8. Fixes #71.

  • FieldType can now be PendingResolution at the end of the parse phase
  • There is now an analysis phase that attempts to resolve anything pending
    • it is an error condition to have things pending at the end of analysis

I have a lot of noisy logging that I would ideally like to keep but have toggled off by default, akin to a debug level log in normal Google source. Not sure how best to get that in Rust. EDIT: per @dfrg I added log & env_logger which seem to work well.

@rsheeter rsheeter force-pushed the no_be branch 6 times, most recently from 411239d to e3cfb25 Compare October 23, 2022 01:08
@rsheeter rsheeter changed the title [EXPLORATORY] Drop BigEndian Drop BigEndian from codegen input Oct 23, 2022
@rsheeter rsheeter force-pushed the no_be branch 10 times, most recently from b6f266b to 6798c44 Compare October 23, 2022 02:21
@rsheeter rsheeter marked this pull request as ready for review October 23, 2022 02:21
@rsheeter rsheeter force-pushed the no_be branch 3 times, most recently from 3a0e908 to 40b0156 Compare October 23, 2022 18:11
@rsheeter rsheeter requested review from cmyr and dfrg October 23, 2022 18:46
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

This ended up being quite a bit cleaner than I expected, and the codegen inputs definitely make sense. I think a lot of the things I would otherwise touch on here were mentioned in our call, so I will try to be brief:

  • on returning spanned errors versus panicking: this is definitely a tradeoff? One way to think about it is about whether you're using the tool with a new codegen input, or if you're working on the codegen code itself. If you're working on the codegen code, panciking is useful, but if you're working on a new codegen input this is much less true. Which case matters more? In my work I was optimizing for making it easier to use the codegen tool than to hack on it, so I made an effort to avoid panicking where possible, and focus on reporting errors in the input files.
  • BigEndian: if we don't have it here, we've lost one of the main motivations for having it in the code at all, so this is something to revisit in followup.
  • logging: it took me some googling to figure out what env var I should pass to enable logging, and when I did it seemed to produce a lot of noise. Maybe the solution here is to change the default level to Info, and use Info for things we want to print regardless?

Overall it's definitely encouraging to see you jump in here and make significant changes without too much evident frustration, I definitely wasn't sure how much joy folks would find in modifying the codegen code itself.

font-codegen/src/fields.rs Outdated Show resolved Hide resolved
font-codegen/src/lib.rs Outdated Show resolved Hide resolved
font-codegen/src/main.rs Show resolved Hide resolved
font-codegen/src/parsing.rs Outdated Show resolved Hide resolved
font-codegen/src/parsing.rs Outdated Show resolved Hide resolved
font-codegen/src/lib.rs Outdated Show resolved Hide resolved
font-codegen/src/lib.rs Outdated Show resolved Hide resolved
font-codegen/src/parsing.rs Outdated Show resolved Hide resolved
font-codegen/src/parsing.rs Outdated Show resolved Hide resolved
font-codegen/src/parsing.rs Show resolved Hide resolved
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

lgtm modulo existing comments :)

@rsheeter rsheeter merged commit 850eaba into main Oct 26, 2022
@rsheeter rsheeter deleted the no_be branch October 26, 2022 17:30
@anthrotype
Copy link
Member

Should the codegen tour's section on BigEndian be updated somehow after this PR?

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.

BigEndian in codegen feels like noise
3 participants