Skip to content

significant whitespace

pannous edited this page May 11, 2023 · 35 revisions

Angle shamelessly has many situations with significant white-space:

  • 2x ≠ [2 x] implicit multiplication vs lists
  • 1 + 1 ≠ 1 +1 == [1 1] (addition vs sign)
  • 1 - 1 ≠ 1 -1 == [1 -1] (addition vs sign)
  • a{x} ≠ a {x} == [a x] // sure?
  • f() ≠ f () == [f ø] // function invocation f() vs empty list () // sure?
  • friends=[bob tom]; 1.friend is bob // dot followed by symbol is index, otherwise number+dot is number 1.0 !
  • "abc"#3 = 'c' # yet with whitespace, '#' indicates comments
  • a b c:d versus to skin a cat : do something vs a :symbol
  • a.b ≠ a. b property versus statement separator

Many border-cases might be ill defined:

  • (a b):c == a b : c ≠ a b:c == a (b:c)
  • while a < b : c ≠ while a < b:c == while a < (b:c)
  • a{x} b{x} ≠ a{x}b{x} ( meta field b belongs to property a, example: age{value}set{value=it} ) todo: what did I mean in the last example? getters and setters? age{get{} set{}}??

Problematic is the ambiguity in mixing 'and', comma and other operators

x, y == a, b 
x, (y == a) , b   

The last reading is sometimes the desired one, e.g. in argument lists

x, y as point == x, (y as point) or x, y as point == (x, y) as point == point(x,y)


Since these are border cases there is a compiler pragma/directive/flag to switch to each desired behavior on demand  
e.g. when parsing lisp, sexp, wasp, csv or kdl [[data]]; each such mode is also activated by file extension.

Done: compiler warning: a {x} => DYM a{x} or a,{x}  
Done: make +1 compiler warning: who writes unnecessary plus signs?  
Todo: general warning or error as in swift "inconsistent white space on both sides of operator"

# significant colon?
one day we MAY want to make type declaration keywords such as `struct point` a structural feature
`point:{x:int y:int} point{1 2}`

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally