#162010 - 2006-05-18 01:33 AM
Bug with arrays
|
It_took_my_meds
Hey THIS is FUN
Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
|
Hi All,
I have come across a strange bug with arrays so I am posting it here to bring it to Ruud's attention. The following code shows the problem.
Code:
Break On
$a = 2,3,4,5,6,7 $b = "a","b","c","d","e","f" ? $a[1] ; 3 ? $b[3] ; "d" ; $b[$a[1]] should equal "d" ; KiX evaluates instead of assigning in the next 2 lines ? $b[$a[1]] = "d" ;True ? $b[$a[1]] = "j" ;False ? $b[$a[1]] ;hasn't been changed to "j" it still equals "d"
Get $
Instead of assigning "j" to $b[$a[1]], KiX evaluates whether or not $b[$a[1]] equals "j". I believe this is incorrect behaviour.
Regards,
Richard
Edited by It_took_my_meds (2006-05-18 02:49 AM)
|
Top
|
|
|
|
#162015 - 2006-05-19 01:28 AM
Re: Bug with arrays
|
It_took_my_meds
Hey THIS is FUN
Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
|
Interestingly, the bug only works one way. Code:
$j = $b[$a[1]] works as expected
|
Top
|
|
|
|
#162017 - 2006-05-21 05:32 PM
Re: Bug with arrays
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
To remove the duplicity of the "=" sign, that is evaluation of equality and assignment of a value, should Ruud consider providing different operators for each function in the 5.x timeframe?
Perl uses:
eq, ne for string equality evaluation == for numeric evaluation
= for assignment of a value to a variable.
I am not advocating that KiX become Perl like. It is just an example of the different functionality.
|
Top
|
|
|
|
#162019 - 2006-05-22 02:50 PM
Re: Bug with arrays
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I realize that "==" already a place in KiX, I am sure he could rationalize some replacement.
|
Top
|
|
|
|
Moderator: ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 466 anonymous users online.
|
|
|