Umbrella term for protocol requirements and members?

this is a protocol requirement:

protocol P
{
    var x:Void { get }
}

this is a protocol member:

extension P
{
    var y:Void { return }
}

this is a struct member:

struct S
{
    var z:Void
}

this is also a struct member:

struct S
{
    struct T {}
}

do we have an umbrella term for all four kinds of declaration? so far i have been overloading the word “member” to mean both non-requirement nested declarations, and all nested declarations in general. but this is confusing.

3 Likes

The BNF in the language reference refers to them all as members, and I can't think of anything else to call them. If your uneasiness is due to the metaness of a protocol, so those members aren't really data structures, I can but agree.

1 Like

i am using SymbolGraphGen’s taxonomy, it uses member to describe nested declarations (including nested types) that are not requirements, and requirement to describe, well, requirements. the distinction is actually quite useful, which is why i’m reluctant to use “member” to describe nested declarations in general.

aside: nested types can witness associatedtype requirements, so they really do have things in common with callable members.

1 Like
struct S
{
    struct T {}
}

A nested type?

protocol P
{
    var x:Void { get }
}

A requirement clause?

3 Likes

How about nested/sub-declarations?

1 Like

thanks everyone, i think nested is probably the best term to use here. (but it is kind of an odd noun to use as a name.)

at least in my use-domain, sub has a special meaning, i use it to refer to declarations that override, inherit from, or defaultly-implement (?) other declarations.

2 Likes

:face_with_open_eyes_and_hand_over_mouth:

2 Likes