Skip to content

[augmentations] Making the order of part directives be semantically significant #4685

@bwilkerson

Description

@bwilkerson

The proposal for augmentations reads

In some cases (enum values, with clauses, etc.), the order that augmentations are applied is user-visible, so must be specified.

It then goes on to specify a fairly complex, though reasonably intuitive set of rules for deciding the order. One of those rules makes the order of part directives significant.

I don't know whether there's any better way to specify the order, but I do wonder how this will impact agents. If agents don't understand the implications of the ordering (and it seems likely that they won't when the feature is first released) they might attempt to sort the directives.

That observation led me to wonder whether there might be a way to catch when the semantics aren't right because of them being re-ordered. I don't have any ideas at this point, but one possibility that occurred to me is to make the ordering more explicit in the code in the first place so that the order of the directives isn't the deciding factor.

This issue is to see whether the language team has considered this issue and what thoughts you might have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    augmentationsIssues related to the augmentations proposal.questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions