jamiebuilds / ghost-lang

:ghost: A friendly little language for you and me.
302 stars 10 forks source link

Readonly sugar #4

Closed aleclarson closed 5 years ago

aleclarson commented 5 years ago

WDYT of adding sugar for readonly properties (or even objects/arrays)?

I like Flow's + syntax.

jamiebuilds commented 5 years ago

Everything in the language will be immutable unless marked otherwise, there is currently no way to mutate values in Ghost

aleclarson commented 5 years ago

@jamiebuilds Can I assume generators will be immutable, too? (so no need for libraries like https://github.com/pelotom/immutagen)

jamiebuilds commented 5 years ago

Ghost doesn't have "generators" as they are in Python and JavaScript. Ghost has "iterable functions" and yield does not wait for a value to be passed to iter.next(value).

As such iter.next() is idempotent (and immutable).