jsigbiz / spec

JavaScript signature notation
131 stars 6 forks source link

:= for type assignment #10

Closed junosuarez closed 9 years ago

junosuarez commented 11 years ago

As proposed by @raynos, use TypeName := Signature to indicate concrete types.

:= is used in many languages to disambiguate assignment from equality. Since jsig types may be referenced by subsequent jsig types or be bound to other token identifiers in code, := can help make this connection between as jsig notation and what it is referring to more explicit.

Raynos commented 11 years ago

@jden I actually do the following

// type Continuable := (callback:(Error, Value) => void) => void
// map := (lambda:(A) => B) => (Continuable<A>) => Continuable<B>

So here I say that tokenName := Signature means the token identified by tokenName in the source program in this file has this signature.

I also say that type typeName := Signature means that the typeName is a type and matches the expansion as per signature. When typeName is used in other signature statements you should treat it as a shorthand for the expansion.

Maybe I should use macro typeName := Signature

junosuarez commented 9 years ago

This has been resolved per a conversation with @raynos and @Matt-Esch. The syntax will be :. New symbolic types will be indicated with the type keyword and a label. : can be read as is a and is a static inference relationship between a label and a type signature.