guild icon
Toit
#Can't call result of evaluating expression list[12:]
Thread channel in help
addshore
addshore 10/08/2024 10:06 AM
I have some basic code, simplified, it is as follows...

constructor.fromList list/List: d := list[12:]

but I get the following error

<pkg:..>: error: Can't call result of evaluating expression d := list[12:] ^~ Compilation failed Error: exit status 1

As far as I can tell im following the docs per https://libs.toit.io/core/collections/class-List#operator%20%5B..%5D(2%2C0%2C0%2Cfrom%2Cto)
floitsch
floitsch 10/08/2024 10:12 AM
It's d := list[12..]
floitsch
floitsch 10/08/2024 10:12 AM
The 12: is interpreted as a call to 12 with the block : (empty block).
addshore
addshore 10/08/2024 10:13 AM
thats the one! :🤦:
floitsch
floitsch 10/08/2024 10:13 AM
too much Go :😉:
addshore
addshore 10/08/2024 10:13 AM
.. looks like : to me too :😛: I was staring at the docs and all! :😄:
floitsch
floitsch 10/08/2024 10:13 AM
it has two dots :😉:
addshore
addshore 10/08/2024 10:13 AM
indeed
addshore
addshore 10/08/2024 10:13 AM
maybe my head was a bit tilted
floitsch
floitsch 10/08/2024 10:13 AM
hehe
10 messages in total