http://coldfusion.com logo
#adobe
Title
# adobe
b

bockensm

04/19/2022, 5:39 PM
Looking for confirmation that the JVM argument to not mutate the original query when using
queryFilter
is NOT available on CF2016
The arg in question is
coldfusion.query.filter.mutateinputquery
m

Mark Takata (Adobe)

04/19/2022, 5:44 PM
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-m-r/queryfilter.html In cf2021, QueryFilter by default should not mutate the original query. However, if you want it to, the mutateinputquery flag was added. It did not exist in 2018 nor 2016.
b

bockensm

04/19/2022, 5:47 PM
I expected it was a 2021 flag and older installs were out of luck based on the wording there
no sweat, just need to set expectations with our devs.
1
m

Mark Takata (Adobe)

04/19/2022, 5:51 PM
Ah gotcha, yeah the flag was not backported to 2018 or 2016. Sorry bout that...
😞 1
b

bdw429s

04/19/2022, 6:12 PM
@Mark Takata (Adobe) Ruby has a convention for all it's member functions that controls whether they mutate the original object or not.
That feels a lot cleaner than a handful of JVM args
The main issue would be the fact that some member functions in CFML mutate the original while others don't so a clean convention across the board isn't really possible now :/
In Ruby, from my understanding it's more like
Copy code
// leave obj untouched
obj.memberFunction()

// mutate obj
obj.memberFunction!()
a

aliaspooryorik

04/20/2022, 8:20 AM
It still boggles my mind that the original implementation did mutate the query - which is inconsistent with arrayFilter - I assume it was deliberate though!
b

bdw429s

04/20/2022, 4:05 PM
Yeah, CF is a bit of a mess with the consistency there. I think early on, a lot of the member functions were specifically mutators like
array.append()
, etc and some of the newer member functions followed that precedent, while others were modeled after more FP languages where immutability is standard.
But it defo causes confusion. I was just helping a client trying to use member functions and they were getting bit by this exact thing where some of their functions mutated the original data structure and others didn't and it wasn't clear just by reading the code what they should expect!
a

aliaspooryorik

04/20/2022, 4:06 PM
I think it's pretty clear, if it's a Tuesday and raining, it mutates, else it doesn't. What's hard about that?
2
2 Views