Repository navigation
Add inferred constructors - #3
Merged
Merged
Conversation
Member
Author
|
I'm going ahead with the merge because this is working great for me. Let me know if you see anything weird here though! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Generated Julia messages can now infer length parameters from constructor inputs. For example,
ControlParameters(motors = motors, ...)obtainsNfrom the vector length, while a field declared asMotorParameters{N}[M]obtainsNfrom its concrete elements andMfrom the collection length.Design
Type{N,...}constructor. That constructor remains available and continues to perform length validation, field conversion, and storage reordering.C++ generation and the generated type layouts are unchanged.
Validation
julia --project=test test/runtests.jlpasses locally, including compiled C++ interoperability tests. Constructor tests cover regular Julia vectors, nested scalar messages, arrays and matrices of nested messages, conflicting lengths, keyword calls, and a parameter that cannot be inferred.