Sealeopard
(KiX Master)
2007-11-10 04:31 AM
4.60 bug: Function

Teh FUNCTION doesn't seem to handle parameters withthe same name as the function correctly:
 Code:
$a=100

$b=a($a)
? 'Kix = '+@kix
? 'a = '+$a
? 'b = '+$b

function a($a)
  $a=100
endfunction

returns
 Code:
Kix = 4.60
a = 100
b =


However,
 Code:
$a=100

$b=a($a)
? 'Kix = '+@kix
? 'a = '+$a
? 'b = '+$b

function a($b)
  $a=100
endfunction

correctly returns
 Code:
Kix = 4.60
a = 100
b = 100


Richard H.Administrator
(KiX Supporter)
2007-11-10 09:44 AM
Re: 4.60 bug: Function

I don't think that this is a bug. Wouldn't you expect this to happen? I would \:\)

You are creating a local variable with the same name as the function return variable, and so obscuring the special variable that you use to return values.

It's similar to having a global and local variable with the same name - you cannot access or change the global variable while the local variable is present.

This behaviour is the same in 4.53


LonkeroAdministrator
(KiX Master Guru)
2007-11-12 10:55 AM
Re: 4.60 bug: Function

I too think this is expected.

paperinik
(Fresh Scripter)
2007-11-12 08:09 PM
Re: 4.60 bug: Function

After some tests,
I think it's definitely NOT a bug.