unexpected values using built-in functions as BoundFunc objects

Report problems with documented functionality
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

unexpected values using built-in functions as BoundFunc objects

22 Apr 2018, 14:28

Code: Select all

limit := 2 ; the maximum number of replacements to allow

MsgBox % Func("StrReplace").bind("H_yst_ck", "a", "_").call(, limit)
MsgBox % Func("RegExReplace").bind("H_yst_ck", "a", "_").call(, limit)
; (because?) the string should remain unchanged as it does not contain 'a'... unexpected results are returned such as 斘/᷸/tack, 斘5᷸5tack etc.
MsgBox % Func("RegExReplace").bind("H_yst_ck", "_", "a").call(, limit) ; Haystack
MsgBox % (f:=Func("RegExReplace").bind("H_yst_ck", "_", "a")).call(, limit) ; Haystack
MsgBox % (Func("RegExReplace").bind("H_yst_ck", "_", "a").call(, limit) == "Haystack") ; Haystack
The behaviour was first rendered in this thread where Helgef give a cogent explanation of it, also underlining that the phenomenon cannot be observed using Autohotkey v2.
Due to an inability to appreciate the scale of possible implications - if any - and, thus, if it is by design, negligible etc. I decided to report the pseudo-problem (since it did not arised and does not seem to be able to arise in any real use case) in the bug reports for assessment.

Thank you.
my scripts
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: unexpected values using built-in functions as BoundFunc objects

22 Apr 2018, 15:09

Hello A_AhkUser. For reference, my guess is based on
docs wrote:Currently in AutoHotkey v1.1, temporary references created within an expression (but not stored anywhere) are released immediately after use.
(changes has been made in v2)

Cheers.
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: unexpected values using built-in functions as BoundFunc objects

22 Apr 2018, 15:32

Hi Helgef,
Helgef wrote:Hello A_AhkUser. For reference, my guess is based on
docs wrote:Currently in AutoHotkey v1.1, temporary references created within an expression (but not stored anywhere) are released immediately after use.
(changes has been made in v2)
Reference-Counting... the esoteric field of the documentation. If it is also documented, I guess the pseudo-problem vanishes, leaving only a solved (false) problem.

Thanks
my scripts

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 16 guests