J. David Bryan wrote:
On 25 Feb 2003 at 14:47, Frank Heckenbach wrote:
As another small step towards cleaning up the `external' mess in GPC, I'm now implementing `external name', i.e.
procedure Foo; external name 'bar';
[...]
But there are cases where you need to set the asmname of a non-external routine or variable. But perhaps we can just use `name' then, e.g.:
var Foo: Integer; name 'bar';
That is orthogonal with the above usage and so is less confusing than:
var Foo: Integer; attribute (name ('foo'));
There is nothing inherently wrong with using "attribute." However, there is a lack of symmetry between:
var Foo: Integer; external; name 'bar'; { external variable }
It's `external name' in BP -- without a semicolon in between.
and:
var Foo: Integer; attribute (name ('foo')); { global variable }
It would seem to be desirable to have global and external entity names specified with similar syntax. So I would suggest either specifying both with "name" or both with "attribute" but not a mix of the two.
Specifying both with `attribute' is no problem -- I've implemented this now, and both `attribute (name ('foo'))' and `attribute (name = 'foo')' will work.
The problem with `var Foo: Integer; name 'bar';' would be that `Name' is often used as an identifier.
If we'll handle such conditional keywords like I suggested in the other thread, it would mean that `var Foo: Integer; name 'bar';' would work as long as `Name' is not used as an identifier (while `var Foo: Integer; external name 'bar';' would work as long as `External' is not used as an identifier, whereas `Name' might be).
I'd say this is acceptable -- if you want to use `name' (without `external') as a directive, just don't use it as an identifier. And if you want to use these identifiers, you can always use `attribute' (which is a little longer to write, but without conflicts -- of course, as long as you don't use `attribute' as an identifier ;-).
So I think allowing for both ways (`attribute' and plain `name') for both external and non-external declarations is reasonable.
Frank