SeedV / SeedLang

An embeddable and visualizable scripting engine for .Net and Unity.
https://seedv.github.io/SeedLang/
Apache License 2.0
9 stars 1 forks source link

Error message is not clear when assigning a value to a slice #205

Closed wixette closed 2 years ago

wixette commented 2 years ago
SeedLang.Shell 0.2.1-preview20220606152801
Copyright 2021-2022 The SeedV Lab.

Enabled Visualizers: 

>>> a = [1, 2, 3]
---------- Source ----------
1     a = [1, 2, 3]

---------- Run ----------
>>> a[0:2] = 5
---------- Source ----------
1     a[0:2] = 5

---------- Run ----------
1     a[0:2] = 5
: 20220606232813946 Fatal (SeedLang.VM) <> [Ln 1, Col 0 - Ln 1, Col 9] 18: RuntimeErrorNotCountable

RuntimeErrorNotCountable looks not clear here.

See Python's message:

Python 3.9.13 (main, May 24 2022, 21:13:51) 
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = [1, 2, 3]
>>> a[0:2] = 5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only assign an iterable