Page 1 of 1

1.1.29.00 Display Issue

Posted: 25 May 2018, 15:56
by TLM
Latest version does not display inline values correctly

Code: Select all

MsgBox % ">>" ["A", "B", "C"].Count() "<<"
MsgBox % ">>" ["A", "B", "C"].Length() "<<"
Both display << only..
Isolated works

Code: Select all

MsgBox % ">>" ( ["A", "B", "C"].Count() ) "<<"

Re: 1.1.29.00 Display Issue

Posted: 25 May 2018, 16:25
by swagfag
i dont think this has much to do with the update in and of itself.
here's something on 1.1.28.02:

Code: Select all

; MsgBox % ">>" ["A", "B", "C"].Count() "<<" ; not available in 1.1.28.02

MsgBox % ">>" ["A", "B", "C"].Length() "<<" ; doesnt work, returns: <<

arr := ["A", "B", "C"]
MsgBox % ">>" arr.Length() "<<" ; works, returns: >>3<<

MsgBox % ["A", "B", "C"].Length() ; expression, works, returns: 3

MsgBox % ">>" . ["A", "B", "C"].Length() . "<<" ; explicit concat, works, returns: >>3<<
MsgBox % ">>" (["A", "B", "C"].Length()) "<<" ; forced expression/implicit concat, works, returns: >>3<<

Re: 1.1.29.00 Display Issue

Posted: 25 May 2018, 16:32
by Helgef
This is documented behaviour.
expressions wrote:[v1.0.97+]: Array literal. If the open-bracket is not preceded by a value (or a sub-expression which yields a value), it is interpreted as the beginning of an array literal. For example, [a, b, c] is equivalent to Array(a, b, c)
Hence, if it is, it isn't. (That is ["A","B","C"] tries to do member access on ">>" which isn't valid)
Spoiler
Cheers.

Re: 1.1.29.00 Display Issue

Posted: 25 May 2018, 17:03
by swagfag
Helgef wrote:.. tries to do member access on ">>" which isn't valid..
how so?

Code: Select all

; https://autohotkey.com/docs/Variables.htm#operators
; https://autohotkey.com/boards/viewtopic.php?f=14&t=49605
; 1.1.28.02 btw if that makes any difference

Arr := {"A": {"B": {"C": "kek"}}}
MsgBox, % "Arr" ["A", "B", "C"] ; supposed member access, returns: blank
MsgBox, % Arr["A", "B", "C"] ; actual member access, returns: kek

; >> := {"A": {"B": {"C": "kek"}}} ; moot, cant declare var '>>'
; MsgBox, % ">>" ["A", "B", "C"] ; moot, cant declare var '>>'
; MsgBox, % >>["A", "B", "C"] ; moot, cant declare var '>>'

Re: 1.1.29.00 Display Issue

Posted: 25 May 2018, 17:13
by Helgef
As I said, it is invalid, because you cannot member access a string.
Spoiler
Cheers.

Re: 1.1.29.00 Display Issue

Posted: 25 May 2018, 17:33
by swagfag
i see
Spoiler

Re: 1.1.29.00 Display Issue

Posted: 25 May 2018, 17:41
by jeeswg
- Here's the issue, you can put a space between the object name and the first square bracket.
- If you use a literal string for the object name, it refers to the base object for strings.

Code: Select all

q:: ;get value from object/string
"".base.__get := "f"
Arr := {"A": {"B": {"C": "hey"}}}
MsgBox, % "Arr" ["A", "B", "C"] ;HEY ;surprising
MsgBox, % Arr ["A", "B", "C"] ;hey ;surprising
MsgBox, % "Arr"["A", "B", "C"] ;HEY ;surprising
MsgBox, % Arr["A", "B", "C"] ;hey
return

f()
{
	return "HEY"
}
- I had this issue before, but I've only now fully understood it. (Thanks Helgef.)
possible issue with GetCapacity? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 10#p153010

Re: 1.1.29.00 Display Issue

Posted: 25 May 2018, 21:59
by lexikos
Helgef wrote:As I said, it is invalid, because you cannot member access a string.
It is invalid because strings have no members by default. As you showed, it can be valid.