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 a$(1 to 0) which fits the 
criteria above.


Line 120: a$(0) should be fine also. It represents the string length. 
Assignment to this location is also acceptable:


DIM a$(10):  remark Define/Make space
a$(0) = 10:        remark Set size
BGET#channel; a$(to 10):  remark Get 10 bytes from channel

This works with JS and Minerva (both with TK2 V3.32+), and SMSQ/E

Line 110: This is clearly an error and is treated as such.

Per
On 08/01/2024 17:51, Wolfgang Lenerz via Ql-Users wrote:

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 105 makes no sense to me, just what should one expect from 
that? (maybe the reversed string (2 to 4)???), this should probably 
raise an error, just like line 110 does.


line 115 results in an empty strin,g - there is nothing before 0, so 
nothing can be obtained. Again, this should probably raise an error.


Have fun

WOlfgang


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 of slicing strings was already discused here many years 
ago. I think it was Marcel Kilgus who gave us some explanation.


François Van Emelen



___
QL-Users Mailing List


___
QL-Users Mailing List


___
QL-Users Mailing List


[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 105 makes no sense to me, just what should one expect from that? 
(maybe the reversed string (2 to 4)???), this should probably raise an 
error, just like line 110 does.


line 115 results in an empty strin,g - there is nothing before 0, so 
nothing can be obtained. Again, this should probably raise an error.



Have fun

WOlfgang


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 of slicing strings was already discused here many years ago. 
I think it was Marcel Kilgus who gave us some explanation.


François Van Emelen



___
QL-Users Mailing List


___
QL-Users Mailing List


[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 of slicing strings was already discused here many years ago. 
I think it was Marcel Kilgus who gave us some explanation.


François Van Emelen



___
QL-Users Mailing List