Skip to content

SoftTypeSyntaxProposal

Bruce Mitchener edited this page Jan 6, 2014 · 2 revisions

ISSUE: Soft Type Syntax Proposal

REVISION HISTORY:

STATUS: open

RELATED ISSUES:

CATEGORY: change

PROBLEM DESCRIPTION:

Parameter specializers and variable types are difficult to read in their current form. It is easy to get lost in all the parentheses.

PRINCIPLES:

  • be consistent.
  • be concise.

PROPOSAL:

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

EXAMPLES:

(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))

QUESTIONS:

is this too ad hoc?

RATIONALE:

There is already a precedent for adding some level of ad hoc syntax to parameter lists (e.g., &rest).

COST TO IMPLEMENTORS:

COST TO USERS:

PERFORMANCE IMPACT:

DOCUMENTATION IMPACT:

IMPLEMENTATION NOTES:

FUTURE FEATURES: