gracelang / language

Design of the Grace language and its libraries
GNU General Public License v2.0
6 stars 1 forks source link

Non-existant reference in Spec #122

Closed apblack closed 7 years ago

apblack commented 7 years ago

There is exactly one mention of Singleton types in the spec:

In the section on object initialization, it says:

Fifth, types are evaluated and bound to their declarations. Types cannot depend on runtime values; if they depend on the type of a constant (because the constant is treated as a Singleton type), then that constant, if overridden in a subclass, can be overridden only by another object with the same type.

Singleton type is a link, but to nothing. What happened to the destination?

In the old version of the spec, which is still in the subversion repository, these is a subsection called Singleton Types (on line 2142). It says:

\kjx{How does this work with the ``new'' pattern matching interpretation? I think singleton objects must be self-matching for this to work reliably}

The names of singleton objects, typically declared in object declarations, may be used as types. Singleton types match only their singleton object. Singleton types can be distinguished from other types because Grace type declarations are statically typed. \apb{I don't understand the last remark.
And the idea of a Singleton type is in stark opposition to the idea of structural typing.}

As I recall, when we talked about this, I argued that it's fine for Singleton objects to be patterns that match themselves. I don't recall that we ever decided what a "Singleton Type" is.

apblack commented 7 years ago

In issue #100, it says that we agreed to take the text about Singleton Types out of the spec, because we thought they can be defined in a library. So that explains why they are not there any more. Unfortunately, #100 also says that this doesn't quite work.

apblack commented 7 years ago

With issue #100 resolved by taking Singleton types out of the spec, this issue was resolved by ... taking singleton types out of the spec (in commit 7bae9d22d).