Skip to content

constant

pannous edited this page Dec 25, 2023 · 2 revisions

constant

As with mutability, there are two kinds of constance:

  • 'reference constant': constant variables point to the same objects during their lifetime.
  • 'value constant': constant objects don't change (their inner value) during their lifetime.

To simplify the situation, Angle offers the final keyword which means both:

final x = Node()
x = 7 // error can't change variable x
x.y=z // error can't change Node x

In rare cases one may want to combine both concepts though:

mutable x = constant Node()
x = 7 // ok value was constant, not variable
x.y=z // error can't change inner value

constant x = mutable Node()
x = 7 // error
x.y=z // ok can change x

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