anz-bank / sysl

Sysl (pronounced "sizzle") is a system specification language
https://sysl.io
Apache License 2.0
122 stars 42 forks source link

Support optional view parameters and return type #1015

Closed andrewemeryanz closed 4 years ago

andrewemeryanz commented 4 years ago

Purpose

View parameters and return types can not currently be optional:

App:
    !view Foo(bar <: string?) -> string? [~abstract]

Results in:

line 2:27 extraneous input '?' expecting CLOSE_PAREN
line 2:39 extraneous input '?' expecting {ABSTRACT, COLON, SQ_OPEN}

Suggested approaches

Include optional attribute against the type:

param:  {
  name:  "bar"
  type:  {
    primitive:  STRING
    opt:  true         # new attribute
  }
}
ret_type:  {
  primitive:  STRING
  opt:  true           # new attribute
}
springwiz commented 4 years ago

Added comments on linked issue https://github.com/anzx/sysl/issues/158.