-
Notifications
You must be signed in to change notification settings - Fork 20
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
refactor: remove remaining chalkConfig field accesses #329
Conversation
src/config.nim
Outdated
# Create the item section if required. | ||
if item notin getContents(keys): | ||
discard attrLookup(keys, [item], 0, vlSecDef) | ||
doAssert attrSet(keys, item & ".use", pack(true), Con4mType(kind: TypeBool)).code == errOk |
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.
these sets are all kind of really ugly to follow. can we use util template or something to do the same but to make api easier to use?
doAssert attrSet(keys, item & ".use", pack(true), Con4mType(kind: TypeBool)).code == errOk | |
con4mAttrSet(keys, item & ".use", pack(true)) |
internally it can get its type from box.kind
so no need to pass Con4mType
directly
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.
We need to specify the type so that we call the correct overload:
But all the calls will be changing here soon, and there aren't many attrSet
, so I don't think it's worth adding a util template.
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.
internally the util will still pass the Con4mType
, but the caller of the utility will just pass a Box
and it can normalize internally as necessary
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.
I don't want to abstract too much here, but I've pushed 644ed8f. In particular, it'd be more confusing for me at the call site if passing three arguments causes the four-argument overload to be called internally.
We had some attrSet
already, but they only acted on ConfigState
(for which there is another overload). I've updated all our attrSet
to use con4mAttrSet
, and only implemented the necessary overloads.
Co-authored-by: Miroslav Shubernetskiy <[email protected]>
This clarifies that we're appending a tuple.
CHANGELOG.md
if necessaryIssue
#214
Description
Continue from #235, #236, and #237, removing (nearly) every remaining access of a
ChalkConfig
field.With this PR, the remaining field accesses of
chalkConfig
are the below:Similar to previous PRs, I don't love this class of change, but we can add back some more compile-time safety around this later. The direction was to remove c4autoconf first.
Testing
Hopefully the existing tests are sufficient.