Am Sonntag, 1. März 2026, 00:54:47 Mitteleuropäische Normalzeit schrieb 
Nathaniel Shead:
> I'm slightly concerned about ordering based on DECL_UID for imported
> namespace-scope names as that will depend on when lazy loading occurs
> for the entity in question, which will not generally be predictable at
> all.  
I thought about this while working on the ordering issue for 
members_of(^^class). As there seem to be no restrictions on ordering according 
to the standard for members_of(^^ns), the most stable sorting would be by 
name.

While a lexical sort for large namespaces can be quite expensive, i personally 
would expect something like `members_of(^^std)` to be expensive.

> Maybe we should check for DECL_MODULE_ENTITY_P, and always order
> them at the end based on their index in entity_ary or something?  Not
> sure if that is actually much better though.

I would think that would just move the issue. For example adding an already 
exported type as a dependency to another, could lead up to a completly 
different ordering during the stream-out. 

> But it should still be at least deterministic as far as I'm aware, so I
> think this could be improved upon incrementally.

The only ordering requirements i could find are defined for class members and 
unnamed bitfields.
> Reflections of class members and unnamed bit-fields that are declared appear 
in the order in which they are declared. [Note 2 : Base classes are not 
members. Implicitly-declared special members appear after any user-declared 
members (11.4.4). — end note]

Thomas

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to