Re: [Ql-Users] bug in String handling

2024-01-13 Thread pjw via Ql-Users
Well, whatever you guys choose to believe, please no one try to "fix" it as this behaviour appears to be consistent across the board - at least as far as JS, Minerva and SMSQ/E are concerned. If programmers keep their indices in order the issue should never arise anyway. Per On 13/01/2024

Re: [Ql-Users] bug in String handling

2024-01-13 Thread Dilwyn Jones via Ql-Users
I wonder if part of the reason that this arose is that some BASICs from that era just returned a null string "" if string slicing errors arose, without an error message and people remembered that? While that was probably convenient for the casual programmer, it must have made debugging difficult

[Ql-Users] bug in String handling

2024-01-13 Thread Wolfgang Lenerz via Ql-Users
Norman Dunbar wrote: I still think that returning "" for a specific string slice from (a to a-1) is a bug! I tend to agree. x$ (a to b) where b is smaller than a should rise an error.The only way that would make any kind of sense to me would be if this returned the array contents in the

Re: [Ql-Users] bug in String handling

2024-01-12 Thread Norman Dunbar via Ql-Users
Morning Jan, That matches with Jan Jones. Arrays index from zero, but simple strings from 1. Cheers, Norm. -- Author of "Arduino Software Internals" and "Arduino Interrupts". ___ QL-Users Mailing List

Re: [Ql-Users] bug in String handling

2024-01-12 Thread John Southern via Ql-Users
Could the reference be the SBASIC/SuperBASIC reference manual? That says When a string array is set up with DIM, each entry is set to a nul string (“”). The zero’th element of each string array contains the actual length of that string, for example: DIM a$(10,10): a$(1)='Hello': PRINT a$(1,0)

Re: [Ql-Users] bug in String handling

2024-01-12 Thread Jan Bredenbeek via Ql-Users
On 12-01-2024 16:20, Norman Dunbar via Ql-Users wrote: If I remember correctly, all the way back to 1984-85, I'm almost certain that the supplied QL manual, in the large, heavy, A$ folder, mentioned that string lengths are indeed stored in a$(0)---or at least, can be accessed from there.

Re: [Ql-Users] bug in String handling

2024-01-12 Thread Norman Dunbar via Ql-Users
On 08/01/2024 18:46, pjw via Ql-Users wrote: > 100 a$ = "1234567890" > 105 b$ = a$(4 to 3): REMark This works > 110 REMark c$ = a$(4 to 2): REMark This fails with an error. > 115 c$ = a$( to 0) : REMark no error returned > 120 c$ = a$(0):: REMark no error returned BUT ERROR IF QLIBERATED

Re: [Ql-Users] bug in String handling

2024-01-12 Thread Norman Dunbar via Ql-Users
On 08/01/2024 16:51, Wolfgang Lenerz via Ql-Users wrote: Line 120 is due to the fast that strings are not 0 based index. So what would a$(0) be? Under SMSQ/E at least, print a$(0) in the above example would give "10" - which is the length of the string... Since this seems to be an unorthodox

Re: [Ql-Users] bug in String handling

2024-01-08 Thread pjw via Ql-Users
Line 105: The construct a$(n to n - 1) represents the empty string (even when n = 1). Since it is replicated in JS, Minerva and SMSQ/E Im assuming it is by design. It also makes sense as there would be no other way to represent a string slice of null. Line 115: I guess a$( to 0) is read as

[Ql-Users] bug in String handling

2024-01-08 Thread Wolfgang Lenerz via Ql-Users
Hi, Line 120 is due to the fast that strings are not 0 based index. So what would a$(0) be? Under SMSQ/E at least, print a$(0) in the above example would give "10" - which is the length of the string... Since this seems to be an unorthodox behaviour, it's no wonder Qlib balks at it. Line

[Ql-Users] bug in String handling

2024-01-08 Thread François Van Emelen via Ql-Users
Hi, Some other anomalies 100 a$ = "1234567890" 105 b$ = a$(4 to 3): REMark This works 110 REMark c$ = a$(4 to 2): REMark This fails with an error. 115 c$ = a$( to 0) : REMark  no error returned 120 c$ = a$(0):    : REMark  no error returned  BUT ERROR IF QLIBERATED 125 pause:stop The problem