-
Notifications
You must be signed in to change notification settings - Fork 1
SoftTypeSyntaxProposal
Bruce Mitchener edited this page Jan 6, 2014
·
2 revisions
Parameter specializers and variable types are difficult to read in their current form. It is easy to get lost in all the parentheses.
- be consistent.
- be concise.
Add special infix syntax for adding type annotation to variables.
Syntax:
varspec ::= ,onevarspec | ,tupvarspec onevarspec ::= ,name [ | ,type ]] tupvarspec ::= (tup ,varspec ...) retvarspec ::= ,oneretvarspec | ,tupretvarspec oneretvarspec ::= [,name | ]],type tupretvarspec ::= (TUP ,oneretvarspec ...) paramlist ::= (,varspec ... [=> ,retvarspec]]) type ::= ,expression
(dm + (x|<int> y|<int> => <int>) ...) (dm + (x|<int> y|<int> => (tup <int> <int>)) ...) (let x|<int> 0) (let (tup div|<int> rem|<flo>) (floor/ a b))
is this too ad hoc?
There is already a precedent for adding some level of ad hoc syntax to parameter lists (e.g., &rest).