You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
change substitutions to the more familiar name of generic arguments in the compiler.
this work was started in #113591 but there are still some uses of the old terminology left.
How to work on this
grep for remaining uses of subst, substitution and substitute and figure out how to replace them with the new terminology: instantiate and generic argument
I realize it's too late to ask for this now, but... was there ever an MCP for this?
I personally find "substitute" a lot more clear than "instantiate". "instantiate" works when a generic function is instantiated, but once we are inside a generic function, we have a whole bunch of terms and types that reference generic parameters. I seems strange to say that we "instantiate" these terms, I never encountered this use of the term "instantiate" before -- what we do is we substitute the generic parameters for their concrete values.
Not all jargon is bad. Subtle technical concepts need precise terms to describe them.
I think the situation is unfortunate and looking back it would have likely been better to open separate MCPs for each individual change. Because the original second was a "I agree with most of these changes, idc about the others" and then we never really got official confirmation for any of them, so any actual name changes have been somewhat vibe based :/
🤷 maybe I'm in the minority here. I teach substitution in class so I'm obviously biased towards finding this a completely natural term to begin with, so I have a fairly high bar for what I consider a good replacement.
Hmm, would it be better to change it into other suitable name? Maybe I just opened PR without sufficient considerations.
TBH I myself prefer more academic terms in codes like substitutions or skolemizations(unrelated here but IIRC it is also renamed in rustc some time ago).
The reason I worked on this is, while reading rust compiler dev guide book to learn about rustc, I saw some naming mismatches between the book and rustc, and thought that this would be a good first issue to work on 😅
As a compiler amateur, I also find "substitute" to be more intuitive than "instantiate". My understanding is (correct me if I'm wrong): you take a type representation with generic values and you substitute those generic values with concrete types to produce another type representation. I think the word was helpful for me to build that mental model when digging into rustc.
Also worth mentioning, we have a type called Instance in rustc that shows up quite a bit. However, the new usage of "instantiate" is unrelated to that -- we're now instantiating types and MIR statements and whatnot, without there being an Instance in these cases. "Instance" refers to the specific case of instantiating a generic function, not an arbitrary generic thing.
Activity
[-]`Substs` -> `GenericArgs`[/-][+]update internal terminology: `Substs` -> `GenericArgs`[/+]lcnr commentedon Apr 25, 2023
This does require some familiarity with the compiler as I assume it to be very annoying to rebase in case there are issues with the implementation.
mdibaiee commentedon Jul 11, 2023
@AnakinSkywalkeer are you still working on this? If not I would like to work on this.
mdibaiee commentedon Jul 11, 2023
@rustbot claim
Auto merge of rust-lang#113591 - mdibaiee:genericargs-cleanup, r=oli-obk
7 remaining items
ShoyuVanilla commentedon Jan 23, 2024
@rustbot claim
RalfJung commentedon Feb 12, 2024
I realize it's too late to ask for this now, but... was there ever an MCP for this?
I personally find "substitute" a lot more clear than "instantiate". "instantiate" works when a generic function is instantiated, but once we are inside a generic function, we have a whole bunch of terms and types that reference generic parameters. I seems strange to say that we "instantiate" these terms, I never encountered this use of the term "instantiate" before -- what we do is we substitute the generic parameters for their concrete values.
Not all jargon is bad. Subtle technical concepts need precise terms to describe them.
lcnr commentedon Feb 12, 2024
yes-ish
rust-lang/compiler-team#451 which was discussed in https://rust-lang.zulipchat.com/#narrow/stream/233931-xxx/topic/Rename.20various.20internal.20things.20compiler-team.23451
after quite a while @oli-obk then opened #110254 which was discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/naming.20bikeshedding
I think the situation is unfortunate and looking back it would have likely been better to open separate MCPs for each individual change. Because the original
secondwas a "I agree with most of these changes, idc about the others" and then we never really got official confirmation for any of them, so any actual name changes have been somewhat vibe based :/RalfJung commentedon Feb 12, 2024
That MCP suggested
subst → replace_generics, which sounds better to me than "instantiate". I guess it was avoided because it was too long?lcnr commentedon Feb 12, 2024
https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/naming.20bikeshedding/near/349032402
RalfJung commentedon Feb 12, 2024
🤷 maybe I'm in the minority here. I teach substitution in class so I'm obviously biased towards finding this a completely natural term to begin with, so I have a fairly high bar for what I consider a good replacement.
ShoyuVanilla commentedon Feb 12, 2024
Hmm, would it be better to change it into other suitable name? Maybe I just opened PR without sufficient considerations.
TBH I myself prefer more academic terms in codes like substitutions or skolemizations(unrelated here but IIRC it is also renamed in rustc some time ago).
The reason I worked on this is, while reading rust compiler dev guide book to learn about rustc, I saw some naming mismatches between the book and rustc, and thought that this would be a good first issue to work on 😅
RalfJung commentedon Feb 12, 2024
I'm happy the skolemization term is gone as I was never convinced that this was actually skolemization in the sense it is used in e.g. logic. ;)
ShoyuVanilla commentedon Feb 12, 2024
Didn't know that cause I was not using rust that day 😄
camsteffen commentedon Feb 12, 2024
As a compiler amateur, I also find "substitute" to be more intuitive than "instantiate". My understanding is (correct me if I'm wrong): you take a type representation with generic values and you substitute those generic values with concrete types to produce another type representation. I think the word was helpful for me to build that mental model when digging into rustc.
RalfJung commentedon Feb 12, 2024
Yes that understanding sounds right.
Also worth mentioning, we have a type called
Instancein rustc that shows up quite a bit. However, the new usage of "instantiate" is unrelated to that -- we're now instantiating types and MIR statements and whatnot, without there being anInstancein these cases. "Instance" refers to the specific case of instantiating a generic function, not an arbitrary generic thing.Rollup merge of rust-lang#120958 - ShoyuVanilla:remove-subst, r=oli-obk
Rollup merge of rust-lang#120958 - ShoyuVanilla:remove-subst, r=oli-obk
Unrolled build for rust-lang#120958