forgetting a comma when definining a Map results in strings Topic is solved

Discuss the future of the AutoHotkey language
20170201225639
Posts: 144
Joined: 01 Feb 2017, 22:57

forgetting a comma when definining a Map results in strings

12 Aug 2023, 21:49

This definition of a map,

Code: Select all

obj := Map(
	3, 4
	12, 2
	12, 58
)
actually succeeds in defining a Map with a Count of 2, mapping 3 to "412" and mapping "212" to 58.

I'm sure this behavior is intended, but:
1. I'm wondering which section of the docs contain materials relevant for deducing this behavior (I skimmed continuation sections but couldn't see anything directly relevant)
2. I also wonder whether if it's not more intuitive to just throw an error about the lack of commas. The current behavior turn what are almost certainly typos into something meaningful but unintended.
lexikos
Posts: 9635
Joined: 30 Sep 2013, 04:07
Contact:

Re: forgetting a comma when definining a Map results in strings  Topic is solved

13 Aug 2023, 19:37

Auto-concat

Obviously, you are expecting the lines to be combined. This is the same:

Code: Select all

obj := Map(	3, 4	12, 2	12, 58)
20170201225639
Posts: 144
Joined: 01 Feb 2017, 22:57

Re: forgetting a comma when definining a Map results in strings

13 Aug 2023, 21:40

Thanks for the pointers, just me and lexicos!

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 12 guests