-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat: infer unknown lengths from context in from_buffers
#2732
Conversation
Codecov Report
Additional details and impacted files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very sensible. And it's a good procedure for strict rules during early development to be relaxed later as the system gets more understood.
This PR follows up from #2718 by relaxing some rules:
from_buffers
is able to deduce the length.This requirement was originally made for safety reasons — if something went wrong during rehydration etc., we would see placeholders without known lengths in contexts where they should be known. However, by imposing this restriction, the caller would need to recreate much of
from_buffers
to compute lengths from offset buffers. Thus, we relax this rule, and permitfrom_buffers
to update placeholders (via a new placeholder) with new known lengths.Originally we wanted this to be an error so that we could clearly identify strange touching behaviour. However, in general it should be possible to refer to the same buffer multiple times within a form, so we should remove this rule.