Page 1 of 1
Bug in Harbour ATAIL() [False report]
Posted: Thu Feb 24, 2022 1:06 pm
by Enrico Maria Giordano
This is a sample of the problem:
Code: Select all | Expand
FUNCTION MAIN()
LOCAL aArray[ 10 ]
ATAIL( aArray ) = 123
? aArray[ 10 ]
INKEY( 0 )
RETURN NIL
I get
Code: Select all | Expand
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
BUG.prg(5) Error E0022 Invalid lvalue '()'
1 error
EMG
Re: Bug in Harbour ATAIL()
Posted: Thu Feb 24, 2022 4:40 pm
by Antonio Linares
Dear Enrico,
You can not assign a value to a value, so it seems as the error is correct. It is like doing:
nil = nil
Anyhow, if the returned value is an object with a redefined "=" or ":=" operator, then it should accept it
Re: Bug in Harbour ATAIL()
Posted: Thu Feb 24, 2022 5:45 pm
by Enrico Maria Giordano
From Clipper docs:
ATAIL()
Return the highest numbered element of an array
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Syntax
ATAIL(<aArray>) --> Element
Arguments
<aArray> is the array.
Returns
ATAIL() returns either a value or a reference to an array or object.
The array is not changed.
Description
ATAIL() is an array function that returns the highest numbered element
of an array. It can be used in applications as shorthand for
<aArray>[LEN(<aArray>)] when you need to obtain the last element of an
array.
Examples
þ The following example creates a literal array and returns that
last element of the array:
aArray := {"a", "b", "c", "d"}
? ATAIL(aArray) // Result: d
Files: Library is CLIPPER.LIB.
So it should be perfectly legal to use
just like you can use
EMG
Re: Bug in Harbour ATAIL()
Posted: Thu Feb 24, 2022 5:46 pm
by Enrico Maria Giordano
I forgot to mention that this works fine using xHarbour:
EMG
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 7:10 am
by Antonio Linares
Dear Enrico,
Harbour and xHarbour source code for ATail() are the same, so we need to keep searching where the difference comes from.
I would say that the compiler parser does not allows it, so we need to modify Harbour syntax rules.
You should report this Harbour bug on Google groups Harbour developers and the group will decide
thank you
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 8:55 am
by Enrico Maria Giordano
Sorry, I'm not following Harbour development. I don't even know if this bug has been corrected in the latest version.
EMG
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 10:29 am
by Antonio Linares
It has not been corrected as lastest commit was on Apr 28, 2021:
https://github.com/harbour/core/commits/master
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 10:38 am
by Antonio Linares
Dear Enrico,
I just reported it into the Harbour's developers group:
https://groups.google.com/g/harbour-devel/c/ZPvgH-Lt1sY/m/w5z0BUQSAgAJmany thanks for your great feedback
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 10:50 am
by Enrico Maria Giordano
Thank you.
EMG
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 11:29 am
by Antonio Linares
Dear Enrico,
There are already four answers in the conversation, please review them
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 12:00 pm
by Enrico Maria Giordano
Unfortunately, I can't test it with Clipper. Can you?
EMG
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 1:33 pm
by Enrico Maria Giordano
Tried with Clipper: same error. Ok, I'm going to change my source code...
EMG