-
Hi all I just read this declaration in a library file
Its a bit hard to search for. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It the "slice" operator of Toit. When the compiler sees It is used in strings and lists to get subsections of them:
Note that slices are generally implemented as views into the object. This means that a slice of a big string might keep the string alive. |
Beta Was this translation helpful? Give feedback.
It the "slice" operator of Toit.
When the compiler sees
o[x..y]
(where bothx
andy
can be omitted), then that expression resolves to the operator[..] --from=x --to=y
.It is used in strings and lists to get subsections of them:
Note that slices are generally implemented as views into the object. This means that a slice of a big string might keep the string alive.
Similarly, a slice of a list is a view into the list. Changing one, affects the other.