There were quite a few mentions of it in this thread…
Not a fan of the syntax myself (not keen on whitespace significance in languages)…
let name: String
var _hunger_level: U64
var _thirst_level: U64 = 1
new create(name': String) =>
name = name'
_hunger_level = 0
new hungry(name': String, hunger': U64) =>
name = name'
_hunger_level = hunger'
Pony and Whitespace
Whitespace (e.g. spaces, tabs, newlines, etc.) in Pony isn’t significant.
Well, it mostly isn’t significant.
Mostly insignificant whitespace
Pony reads a bit like Python, which is a whitespace significant language. That is, the amount of indentation on a line means something in Python. In Pony, the amount of indentation is meaningless.
That means Pony programmers can format their code in whatever way suits them.
There are three exceptions:
- at the beginning of a line starts a new expression (unary negation), whereas a
- in the middle of an expression is a binary operator (subtraction).
( at the beginning of a line starts a new expression (a tuple), whereas a
( in the middle of an expression is a method call.
[ at the beginning of a line starts a new expression (an array literal), whereas a
[ in the middle of an expression is generic formal parameters.
That stuff may seem a little esoteric right now, but we’ll explain it all later. The
- part should make sense though.