FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos Bug in Harbour ATAIL() [False report]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in Harbour ATAIL() [False report]
Posted: Thu Feb 24, 2022 01:06 PM
This is a sample of the problem:

Code (fw): Select all Collapse
FUNCTION MAIN()

    LOCAL aArray[ 10 ]

    ATAIL( aArray ) = 123

    ? aArray[ 10 ]

    INKEY( 0 )

    RETURN NIL


I get

Code (fw): Select all Collapse
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
BUG.prg(5) Error E0022  Invalid lvalue '()'
1 error


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in Harbour ATAIL()
Posted: Thu Feb 24, 2022 04:40 PM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in Harbour ATAIL()
Posted: Thu Feb 24, 2022 05:45 PM
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

Code (fw): Select all Collapse
ATAIL( aArray ) = xValue


just like you can use

Code (fw): Select all Collapse
aArray[LEN(aArray)] = xValue


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in Harbour ATAIL()
Posted: Thu Feb 24, 2022 05:46 PM
I forgot to mention that this works fine using xHarbour:

Code (fw): Select all Collapse
ATAIL( aArray ) = xValue


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 07:10 AM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 08:55 AM

Sorry, I'm not following Harbour development. I don't even know if this bug has been corrected in the latest version.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 10:29 AM
It has not been corrected as lastest commit was on Apr 28, 2021:

https://github.com/harbour/core/commits/master
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 10:38 AM
Dear Enrico,

I just reported it into the Harbour's developers group:

https://groups.google.com/g/harbour-devel/c/ZPvgH-Lt1sY/m/w5z0BUQSAgAJ

many thanks for your great feedback
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 10:50 AM

Thank you.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 11:29 AM

Dear Enrico,

There are already four answers in the conversation, please review them

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 12:00 PM

Unfortunately, I can't test it with Clipper. Can you?

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in Harbour ATAIL()
Posted: Fri Feb 25, 2022 01:33 PM

Tried with Clipper: same error. Ok, I'm going to change my source code...

EMG

Continue the discussion