[PATCH] introduce attribute exalias

Nathan Sidwell nathan@acm.org
Fri Aug 14 22:12:57 GMT 2020

On 8/14/20 3:24 PM, Alexandre Oliva wrote:
> On Aug 14, 2020, Nathan Sidwell <nathan@acm.org> wrote:
>> This seems a useful feature.  I don;t think it needs language
>> lawyering -- it's an extension, right?
> Well, yeah, but I think it's usually good for even extensions to be
> sound language-wise.
>> By 'same-linkage', do you mean same linkage as the *symbol* of the
>> thing it is aliasing, or same linkage as the language entity it is
>> aliasing?
>> I suspect you mean the former.
> Yeah, ultimately the symbol declared as exalias gets the same
> object-level linkage and visibility properties as those of the primary
> symbol emitted for the language entity.  Conceptually, the entity
> introduced by the attribute is not even visible or accessible in the
> standard language; it can only be referenced by alias attributes and by
> Ada import declarations, but conceptually, in as much as you conceive of
> it as a separate entity, I suppose it makes some sense to say it gets
> the same linkage as the entity it refers to.

thanks for the discussion.  I should have said, 'exalias' sounds either 
like a used-to-be alias, it is an ex alias, it has ceased to be, gone to 
join the choir invisible.

or it sounds like exa-lias, making me wonder what a 'lia' is, and why I 
want 10^18 of them

>> I'm sure we can bikeshed the name 'exalias' doesn't seem very mnemonic
>> to me.  'symbol_alias' or something?
> I don't like symbol_alias; that this feature names a symbol is not a
> distinguishing feature from the preexisting alias attribute.

right,  I realize this is different to the existing alias.  It's always 
struck me that the existing semantics are not c++ friendly.  Perhaps 
alias is not the right name at all.  You're emitting an alternative 
symbol, for use in interfacing to a foreign language/system.  Perhaps 

> 'ex' can be read as both extra, exported, external, and all of these
> sort of make sense, at least for entities that have linkage.
> Even for exclusively internal uses, say to introduce a mnemonic symbol
> for another alias-attributed declaration to refer to, the "ex" prefix,
> that means the opposite of "in", fitting in well with the functionality
> of "ex"posing the symbol through a name that other alias declarations
> can take *in*, *im*port.
> Another possible spelling for this proposed attribute that might be more
> mnemonic is "aka"; unfortunately, that's pretty much a synonym to alias,
> so it might be mistaken as such, rather than as a complementary feature,
> akin to the other end of a power extension cable: whereas alias does the
> job of a plug, *ex*alias provides a socket/*out*let.


Nathan Sidwell

More information about the Gcc-patches mailing list