Data Types
Every value in Acton is of a certain type. The type specifies what kind of data is being specified and how to work with that data. Acton has a number of built-in data types.
- integers, like
1
,2
,123512
,-6542
or1267650600228229401496703205376
int
is arbitrary precision and can grow beyond machine word sizesi16
,i32
,i64
,u16
,u32
,u64
are fixed size integers
- float 64 bit float, like
1.3
or-382.31
- complex complex numbers like
1+2j
bool
boolean, likeTrue
orFalse
str
strings, likefoo
- strings support Unicode characters
- tuples for structuring multiple values, like
(1, "foo")
or(a="bar", b=1337)
In Acton, mutable state can only be held by actors. Global definitions in modules are constant. Assigning to the same name in an actor will shadow the global variable.
module level constant |
|
this will print the global foo |
|
set a local variable with the name foo, shadowing the global constant foo |
|
print local foo, then call printfoo() |
|
Output:
local foo, shadowing the global foo: 4
global foo: 3
u16: 1234