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.
offshoot of #24964
I first tried to make
importc
types a new kind of type and allow it to accept it's Nim equivalent, but this was difficult, took a lot of time and in the end I couldn't get it to fully work. The main problem was that Nim converts types to and fromimportc
types regularly, so this new type had to do a bunch of odd things to not break those behaviors.Trying this out was much easier since I could just re-use most of the logic for
distinct
however there are some concerns I have at this time:sameType
proc might need some attentionseq[T]
varients and suchConversions are still needed in some situations with this where they weren't before, but so far I haven't seen anything that looked like it should work. For example a previous automatic conversion from a non literalint
tocint
needed a patch, but why did that work without a conversion in the first place?primitive conversion semantics probably have to be looked at again but I forget where that is / how that worksin general I think that something like
always must mean that the backend will map Nim's representation of
int32
toint
, if this is not a guarantee then something likenodecl
and a proper exclusive definition has to be used to make the type opaque and I don't think there is a way around that.