On 4/6/12 7:09 PM, Timon Gehr wrote:
On 04/06/2012 12:53 PM, Walter Bright wrote:
On 4/6/2012 3:27 AM, Ary Manzana wrote:
@safe, @nothrow, etc., require a lot of semantic support in the
compiler. They cannot pretend to be user defined attributes.

Yes they can. That's how it is done in C# and Java. In fact, IUnknown is
pretending to be an interface and has semantic support in the compiler.

All the semantics of @safe are in the compiler. None of it can be user
defined. There's just no point to trying to make it user defined. It's
like trying to make int user defined.

IUnknown's semantics are nearly all user-defined.


The proposal is not to make the semantics of @safe user defined. I think
he proposes to make 'safe' a symbol that is looked up like an user
defined symbol.

Some languages do the same for the built-in integer type.

The compiler does the same for TypeInfo, TypeInfo_ClassDeclaration or what ever, Object, etc.

I'm just proposing @safe to be seen as a user-defined attribute, but implemented in the compiler with special semantic.

I'm saying it so that lookup rules become easier: just search. No special cases like "if the attribute name is safe". Of course, treat the special cases later inside the compiler code.

Reply via email to