Fundament-Software / scopes

Fundament fork of the Scopes language
Other
3 stars 1 forks source link

String __@ allows accessing `str @ (countof str)` #25

Open LunNova opened 1 year ago

LunNova commented 1 year ago
$0 ► using import String
$0 ► "test" as String
$0 = test
$1 ► $0 @ 4
$1 = 0:i8
$2 ► $0 @ 3
$2 = 116:i8
$3 ► 'last $0
$3 = 116:i8

https://github.com/Fundament-Software/scopes/blob/e4bae70c7b6b0fbbf68bb47893fec05ed45f0c8c/lib/scopes/String.sc#L290-L293

Feels incorrect to allow this. Having 0 at the end is an implementation detail for compat with C stuff. Last index you can @ should agree with 'last str