Lucee code parsing bug here it seems: <https://try...
# lucee
a
Lucee code parsing bug here it seems: https://trycf.com/gist/3024664fd918d90d8932a4e68fd28e60/lucee5?theme=monokai
Copy code
st = {}

[
	"tahi",
	"rua",
	"toru",
	"wha"
].each((n) => writeOutput(n))
Errors with:
Invalid Syntax Closing []] not found on line 5
Copy code
st = {}; // <--- say hello to my little friend

[
	"tahi",
	"rua",
	"toru",
	"wha"
].each((n) => writeOutput(n))
Works fine 😐
z
ACF vomits as well
a
Ah yeah but CF doesn't even claim to support calling methods on literals though. https://trycf.com/gist/142b1e274235245ad226c64865e6ab89/acf2021?theme=monokai
d
i guess it parses as a bracket access,
Copy code
st = {}["tahi"]; // key tahi doesn't exist
st = {}["tahi", "rua"]; // not a valid bracket access expression
st = {tahi: 42}["tahi"]; // ok
which is maybe not too unreasonable
👍 1
a
Good observation. JS errors similarly here. CF can't do the method call on the literal, but both Lucee and CF error on just:
Copy code
st = {}

[
	"tahi",
	"rua",
	"toru",
	"wha"
]
Invalid Syntax Closing []] not found on line 5
/
Context validation error for the cfscript tag. on line 1
respectively. There's obvs some syntax in JS I don't know about. This is interesting:
Copy code
> st = {
	"tahi" : 1,
	"wha" : 4

}

[
	"tahi",
	"rua",
	"toru",
	"wha"
]

<- 4
So it'll take a list as the index value and return the value of the last one?
This would suggest so:
Copy code
> st = {
	"tahi" : "one",
    "rua" : "two",
    "toru" : "three",
	"wha" : "four"

}

[
	"toru",
	"rua"
]

<- 'two'
Anyhow... agreed on the CFML front... not a bug.