Signature
From Erights
(finish subst) |
Kevin Reid (Talk | contribs) (describe Signature design) |
||
Line 5: | Line 5: | ||
(REVIEW: Should we adopt Signature in place of TypeDesc?) | (REVIEW: Should we adopt Signature in place of TypeDesc?) | ||
- | (REVIEW: What should the expansion of the nonkernel "interface" expression be, given that we eliminate MessageDesc and ParamDesc which it uses? | + | (REVIEW: What should the expansion of the nonkernel "interface" expression be, given that we eliminate MessageDesc and ParamDesc which it uses?) |
- | + | ||
- | + | ||
(XXX [[User:Kevin Reid]] needs to review the experimental code and add other design decision questions to this page.) | (XXX [[User:Kevin Reid]] needs to review the experimental code and add other design decision questions to this page.) | ||
Line 14: | Line 12: | ||
* <code>objectExpr</code> :[[ObjectExpr]] | * <code>objectExpr</code> :[[ObjectExpr]] | ||
- | * <code>env</code> :[[ | + | * <code>env</code> :[[Scope]] |
* <code>supers</code> :[[List]]<nowiki>[</nowiki>[[Signature]]] | * <code>supers</code> :[[List]]<nowiki>[</nowiki>[[Signature]]] | ||
* <code>mirandaSignature</code> :[[Signature]] | * <code>mirandaSignature</code> :[[Signature]] | ||
Line 20: | Line 18: | ||
The most important fields of a signature are the ''object expr'' and ''env''. | The most important fields of a signature are the ''object expr'' and ''env''. | ||
- | The object expr is the expression of the object which this is the signature of (or the closest approximation, if the object is not written in E), except | + | The object expr is the expression of the object which this is the signature of (or the closest approximation, if the object is not written in E), except that the method and matcher bodies have been replaced with UnspecifiedExpr, a new [[EExpr]] introduced for this purpose, and the auditors (<code>implements</code> clause) have been eliminated. |
- | The environment field contains | + | The environment field contains a [[Scope]] with bindings for every free noun in the object expr. (These will mostly be guards.) |
- | (REVIEW: This proposal therefore exposes every object mentioned in a parameter list. Is this too hazardous? (MarkM feels that the simple rule of "everything between the braces is public" (i.e. from the { of the object to the { of a method) helps.) Are there practical ways to reduce the potential harm from mentioning authority-bearing objects? | + | (REVIEW: This proposal therefore exposes every object mentioned in a parameter list. Is this too hazardous? (MarkM feels that the simple rule of "everything between the braces is public" (i.e. from the { of the object to the { of a method) helps.) Are there practical ways to reduce the potential harm from mentioning authority-bearing objects?) |
- | The supers field lists additional signatures of protocols which this object also implements, such as by <code>[[extends]]</code>, or explicit protocols | + | The supers field lists additional signatures of protocols which this object also implements, such as by <code>[[extends]]</code>, or explicit protocols. |
- | + | ||
- | + | ||
(NOTE: A planned extension is to allow type-parameterized protocols. This will be done by allowing nouns not bound in the env, but bound by a parameter list instead. Such a signature responds to get/N returning a concrete protocol.) | (NOTE: A planned extension is to allow type-parameterized protocols. This will be done by allowing nouns not bound in the env, but bound by a parameter list instead. Such a signature responds to get/N returning a concrete protocol.) | ||
== Maker protocol == | == Maker protocol == | ||
- | |||
- | |||
=== asType/0 === | === asType/0 === | ||
{{asType|Signature}} | {{asType|Signature}} | ||
- | {{maker msgdoc|run|2|objectExpr :[[ObjectExpr]], env :[[ | + | {{maker msgdoc|run|2|objectExpr :[[ObjectExpr]], env :[[Scope]]|[[Signature]]}} |
As run/3 but with the supers field being <code>[]</code>. | As run/3 but with the supers field being <code>[]</code>. | ||
- | {{maker msgdoc|run|3|objectExpr :[[ObjectExpr]], env :[[ | + | {{maker msgdoc|run|3|objectExpr :[[ObjectExpr]], env :[[Scope]], supers :[[List]]<nowiki>[</nowiki>[[Signature]]]|[[Signature]]}} |
{{unspecified message}} | {{unspecified message}} | ||
Line 53: | Line 47: | ||
Accessor; see state description. | Accessor; see state description. | ||
- | {{instance msgdoc|getEnv|0||[[ | + | {{instance msgdoc|getEnv|0||[[Scope]]}} |
Accessor; see state description. | Accessor; see state description. | ||
Line 65: | Line 59: | ||
Accessor; see state description. | Accessor; see state description. | ||
- | {{instance msgdoc|getFQName|0||[[ | + | (REVIEW: Should this be a [[ConstSet]] instead of a [[ConstList]]?) |
+ | |||
+ | {{instance msgdoc|getFQName|0||[[List]]<nowiki>[</nowiki>[[Signature]]]}} | ||
Returns the [[fully-qualified name]] constructed from the environment's FQN prefix and the object expr's pattern. | Returns the [[fully-qualified name]] constructed from the environment's FQN prefix and the object expr's pattern. | ||
- | ( | + | (REVIEW: This was introduced for legacy compatibility; should it exist, be deprecated, or not exist?) |
+ | |||
+ | {{instance msgdoc|getDocComment|0||[[nullOk]]<nowiki>[</nowiki>[[String]]]}} | ||
+ | |||
+ | Returns the object expr's docComment. | ||
+ | |||
+ | (REVIEW: This was introduced for legacy compatibility; should it exist, be deprecated, or not exist?) | ||
[[Category:ELib specification]] | [[Category:ELib specification]] | ||
[[Category:Unresolved design issues]] | [[Category:Unresolved design issues]] |
Revision as of 01:34, 11 August 2008
A Signature describes the protocol of another object.
This type is proposed to replace TypeDesc, MessageDesc, and ParamDesc; the motivation for doing so is that while TypeDesc allows for message parameters' guards to be presented, it is difficult to define the means for doing so as a miranda method; Signature is defined so as to simplify this. Furthermore, it is arguably "fewer moving parts" in that rather than having the TD/MD/PD structure imitating a subset of what Kernel-E can express, we use Kernel-E directly.
(REVIEW: Should we adopt Signature in place of TypeDesc?)
(REVIEW: What should the expansion of the nonkernel "interface" expression be, given that we eliminate MessageDesc and ParamDesc which it uses?)
(XXX User:Kevin Reid needs to review the experimental code and add other design decision questions to this page.)
Contents |
State
-
objectExpr
:ObjectExpr -
env
:Scope -
supers
:List[Signature] -
mirandaSignature
:Signature
The most important fields of a signature are the object expr and env.
The object expr is the expression of the object which this is the signature of (or the closest approximation, if the object is not written in E), except that the method and matcher bodies have been replaced with UnspecifiedExpr, a new EExpr introduced for this purpose, and the auditors (implements
clause) have been eliminated.
The environment field contains a Scope with bindings for every free noun in the object expr. (These will mostly be guards.)
(REVIEW: This proposal therefore exposes every object mentioned in a parameter list. Is this too hazardous? (MarkM feels that the simple rule of "everything between the braces is public" (i.e. from the { of the object to the { of a method) helps.) Are there practical ways to reduce the potential harm from mentioning authority-bearing objects?)
The supers field lists additional signatures of protocols which this object also implements, such as by extends
, or explicit protocols.
(NOTE: A planned extension is to allow type-parameterized protocols. This will be done by allowing nouns not bound in the env, but bound by a parameter list instead. Such a signature responds to get/N returning a concrete protocol.)
Maker protocol
asType/0
asType() :Guard
Returns the Signature guard, which all products of this maker pass.
run/2
run(objectExpr :ObjectExpr, env :Scope) :Signature
As run/3 but with the supers field being []
.
run/3
run(objectExpr :ObjectExpr, env :Scope, supers :List[Signature]) :Signature
The specification for this message has not been written.
Protocol
getObjectExpr/0
- Signature: getObjectExpr() :ObjectExpr
Accessor; see state description.
getEnv/0
- Signature: getEnv() :Scope
Accessor; see state description.
getMirandaSignature/0
- Signature: getMirandaSignature() :Signature
Accessor; see state description.
getSupers/0
- Signature: getSupers() :List[Signature]
Accessor; see state description.
(REVIEW: Should this be a ConstSet instead of a ConstList?)
getFQName/0
- Signature: getFQName() :List[Signature]
Returns the fully-qualified name constructed from the environment's FQN prefix and the object expr's pattern.
(REVIEW: This was introduced for legacy compatibility; should it exist, be deprecated, or not exist?)
getDocComment/0
Returns the object expr's docComment.
(REVIEW: This was introduced for legacy compatibility; should it exist, be deprecated, or not exist?)