Open osa1 opened 4 months ago
We use square brackets for type parameters and type applications:
-- Function definition with type parameter fn id[T](a: T): T = a -- Type application in expression context id[I32](123)
We could still use square brackets for array access, but that reuses [...] a bit too much I think.
[...]
I think Scala uses function call syntax for array access, something like:
array(0) // desugared to `array.apply(0)`, which for the array type gets the element at index array(0) = "hi" // desugared to `array.update(0, "hi")
which we could copy.
This is not urgent as we can always just call the methods: map.get(key), map.set(key, value) etc.
map.get(key)
map.set(key, value)
We use square brackets for type parameters and type applications:
We could still use square brackets for array access, but that reuses
[...]
a bit too much I think.I think Scala uses function call syntax for array access, something like:
which we could copy.
This is not urgent as we can always just call the methods:
map.get(key)
,map.set(key, value)
etc.