|
Post by Pjot on Mar 21, 2023 17:41:35 GMT 1
All,
For your information, in BaCon 4.6.1 there's a bug when using SPLIT.
SPLIT "one two three four" TO array$
FOR x = 0 TO 3 PRINT array$[x] array$[x] = array$[x] & "five" PRINT array$[x] NEXT
The string concatenation fails:
one
two
three
four
This bug is fixed in the 4.6.2 beta release:
one onefive two twofive three threefive four fourfive
BR Peter
|
|
|
Post by bigbass on Mar 25, 2023 18:42:52 GMT 1
Hello Peter I Know you must have fixed it but it is not in the latest beta listed as a fix
and the "bug" is still there I think you forgot to add it to fossil? pushed to the website ?
bacon -v
BaCon version 4.6.2 on Linux armv7l - (c) Peter van Eerten - MIT License.
./split one
two
three
four
I tested in javascript here (nice to have a port of the same thing )
let array = "one two three four".split(" ");
for (let x = 0; x <= 3; x++) { console.log(array[x]); array[x] = array[x] + "five"; console.log(array[x]); }
node ./split5.js one onefive two twofive three threefive four fourfive
==================================
UPDATE
I can get the correct result with a little hack using c notice I commented out the original and tried CONCAT$ but that failed too strcat works for a limited demo
OPTION PARSE FALSE SPLIT "one two three four" TO array$
FOR x = 0 TO 3 PRINT array$[x] ' array$[x] = array$[x] & "five" strcat(array$[x], "five") 'array$[x] = CONCAT$(array$[x], "five") PRINT array$[x] NEXT
Joe
|
|
|
Post by Pjot on Mar 26, 2023 8:07:49 GMT 1
Hi Joe, I just ran into this issue myself as well. It was fixed but with my latest "optimization" using realloc, the bug was there again. But now it is really fixed in the latest beta. Really Thanks for reporting, Peter
|
|