Bug in Harbour ATAIL() [False report]

Bug in Harbour ATAIL() [False report]

Postby Enrico Maria Giordano » Thu Feb 24, 2022 1:06 pm

This is a sample of the problem:

Code: Select all  Expand view
FUNCTION MAIN()

    LOCAL aArray[ 10 ]

    ATAIL( aArray ) = 123

    ? aArray[ 10 ]

    INKEY( 0 )

    RETURN NIL


I get

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


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in Harbour ATAIL()

Postby Antonio Linares » Thu Feb 24, 2022 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in Harbour ATAIL()

Postby Enrico Maria Giordano » Thu Feb 24, 2022 5: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: Select all  Expand view
ATAIL( aArray ) = xValue


just like you can use

Code: Select all  Expand view
aArray[LEN(aArray)] = xValue


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in Harbour ATAIL()

Postby Enrico Maria Giordano » Thu Feb 24, 2022 5:46 pm

I forgot to mention that this works fine using xHarbour:

Code: Select all  Expand view
ATAIL( aArray ) = xValue


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in Harbour ATAIL()

Postby Antonio Linares » Fri Feb 25, 2022 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in Harbour ATAIL()

Postby Enrico Maria Giordano » Fri Feb 25, 2022 8: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
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in Harbour ATAIL()

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in Harbour ATAIL()

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Re: Bug in Harbour ATAIL()

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in Harbour ATAIL()

Postby Enrico Maria Giordano » Fri Feb 25, 2022 12:00 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in Harbour ATAIL()

Postby Enrico Maria Giordano » Fri Feb 25, 2022 1:33 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 3 guests