ceylon/ceylon-spec — Issue #57: Syntax for attribute metamodel references
Author: gavinking
Created: 2011-11-21 19:48:02+00:00
State: open
Labels: request for feedback

For member attributes the syntax `Person.name` would work. But:

- this does not work for toplevel attributes,
- it's kinda verbose to use it inside the body of `Person`, and
- it would not work if we ever decided that locals and parameters should have metamodels.

Therefore, I propose that we introduce a syntax for referencing an attribute without evaluating it. i.e. for turning something that would be of type `T` into a `Callable`. There are a couple of cases:

1. in the case of `person.name`, it would be a plain `Callable`, but
2. in the case of `null`, it would be a `Value`, the metamodel for `null`.

There are a couple of punctuation symbols that to me feel kinda reasonable:

- the C address-of operator `&`, or
- the Pascal address-of operator `@`, or even, perhaps
- a backslash `\`.

And we also need to decide if this character would come before or after the identifier.

&null, person.&name
@null, person.@name
\null, person.\name

null@ person.null@
null&, person.null&

Also see the discussion in #54.

Feedback, please.