uaarray.kbs seems odd (Language Help)

by JD Baker, Friday, February 21, 2014, 01:04 (2190 days ago)

To test my newly compiled Basic256 I
ran all prog in examples/test.

uaarray.kbs seems odd...
Example 1 no errors Seems right.
Example 2 no errors?
Example 3 failed on both assignments. Ok.
Example 4 failed on both [] assignments. Ok.

Should not 2 have failed on the 2nd
assignmnet? An auto type conversion from an
integer to a list seems wrong. That does not
seem like apples and oranges more like apples
and water. Two way different kind of containers.

All the rest worked as I expected.

uaarray.kbs seems odd

by Jim ⌂ @, Russell, KY, Friday, February 21, 2014, 16:23 (2189 days ago) @ JD Baker


Wow, I wrote that a long time ago with 4 different bits of code that failed miserably back in 0.9.6... Since then the variable class was created storing variables and arrays in a c++ vector not a mallocd array.

The assigning a list to a variable deletes the old contents (an array or atomic value) and then creates an initialized array. The dim is built in and if you did this assignment to an existing array it would de-allocate the entries first.

Just assigning an array element in a non-array variable still barfs because the behavior of the previous value / or unassigned value is totally undefined in BASIC.

I should probably delete that test :)


RSS Feed of thread
powered by my little forum