-
Notifications
You must be signed in to change notification settings - Fork 27
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
Revisit record parsing hacks in codegen #659
Comments
An annoying thing here is that we now have two different special-cased records that are special in different ways.
So all-in-all, I'm not sure how much better than this we can do. I think until we have another case of record-in-record I would prefer to keep it special-cased, because it's a smaller change and reduces the chances that some subtle change we make to support the general case breaks some other invariant. |
I'd definitely like to avoid having "if some specific type" in codegen code, that's ... at the very least a yellow flag. Remind me why ValueRecord is impossible to deal with? Naively, what happens if we delete traversal and derive copy where possible? |
I'm not going to say 'impossible to deal with', but ValueRecord has a unique combination of qualities:
That said, ValueRecord generally interacts fine with codegen (in the context of being included in other tables & records.) traversal & Copy are unrelated, so I'll address those separately: Traversal: if we delete traversal, we lose the ability to implement Maybe this is fine? But it is certainly valuable to be able to recursively debug print tables. We would also lose the Copy: I think that deriving |
I think we should disregard the concern about copy; if we screw up and it matters it'll show up in profiling. I think codegen should support record-in-record unless there is a reason this is Very Hard. I accept ValueRecord having hand-written parsing [and writing I would guess?], but I think we should handle it with the annotation mechanism, conceptually |
+1 to copy. Rather than add another annotation, I propose we add |
Add ... where? If the answer is codegen input then ... why is this better than an annotation? - I would not look at that and go "Oh, he wants to hand-write the read/write code" |
It reads as simple and direct to me. We already declare
dyn keyword.
It’s a preference but not a strong one and an attribute is semantically equivalent so I’m fine either way. |
How would you know dyn means I want to hand-write some of the implementation? - I definitely would not get that from seeing dyn in a codegen input. Also it's a step backwards from having a general purpose schema to introduce more Rust syntax. |
That is, if a record has a fixed size we will derive the Copy trait. This will be necessary if we want to use bytemuck, and should let us simplify some other things. - See #659 for previous discussion
That is, if a record has a fixed size we will derive the Copy trait. This will be necessary if we want to use bytemuck, and should let us simplify some other things. - See #659 for previous discussion
We have longstanding hacks for
ValueRecord
in codegen and some additional ones have been added forSbitLineMetrics
(along with use of size one arrays for embeddingBigGlyphMetrics
). Are there ways to better handle these types?Copy
forSbitLineMetrics
: [read-fonts] parse embedded bitmap tables #637 (comment)Copy
for all records?The text was updated successfully, but these errors were encountered: