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

bdw429s

04/22/2022, 2:27 PM
@Mark Takata (Adobe) @priyank_adobe Could one of you please tag an appropriate engineer to help provide a quick sanity check. I noticed Lucee was making some changes to its list functions in order to match Adobe, but I REALLY think Adobe's and Lucee's behaviors are both completely bunk here and I'd like to get a ticket in for Adobe to fix and have Lucee match that if possible. I'll put the details in the thread. Just finding out if there really is some super-compelling (and documented) reason for this or if it's really just an edge case bug no one noticed would be great.
But it boils down to what
listAppend()
and
listPrepend()
do with an empty delimiter.
Instead of behaving consistently with all other list manipulation, the functions just drop data and don't append or prepend the items at all!
Copy code
// Just to confirm basic behavior
writeoutput( listAppend( "brad", "wood", "," ) & '<br>' )    // brad,wood
writeoutput( listprepend( "brad", "wood", "," ) & '<hr>' )   // wood,brad

// No real difference if the delimiter appears inside the strings
// The strings are just slammed together and any contained delims are left in place
writeoutput( listAppend( "br,ad", "wo,od", "," ) & '<br>' )     // br,ad,wo,od
writeoutput( listprepend( "br,ad", "wo,od", "," ) & '<hr>' )    // wo,od,br,ad

// Now establish that an empty delimiter simply treats each char as a list item
writeDump( listToArray( "brad wood", "" ) )   // ["b","r","a","d"," ","w","o","o","d"]
writeoutput( '<hr>' )

// here is where we go off the rails.  Instead of concatenating the values like before now data is randomly lost 
writeoutput( listAppend( "brad", "wood", "" ) & '<br>' )    // brad  (incorrect, should be "bradwood")
// Lucee and Adobe differ here.  Adobe dumps the "list" and Lucee dumps the "value". 
writeoutput( listprepend( "brad", "wood", "" ) & '<hr>' )   //  Lucee returns "brad", but Adobe returns "wood"  (both incorrect, should be "woodbrad")
p

priyank_adobe

04/22/2022, 2:47 PM
@Mark Takata (Adobe) Could you please take a lead on this.
1
m

Mark Takata (Adobe)

04/22/2022, 2:55 PM
I'll take a look & ask an engineer to confirm the behavior & determine next steps.
✔️ 1
r

Rodney

04/22/2022, 3:11 PM
I definitely agree with Brad's assessment on what the output should be but I can't recall ever having the need to append a list with no delimiter. I assume it's in some kind of framework so a standard string concatenation won't work?
b

bdw429s

04/22/2022, 3:16 PM
Thanks @Mark Takata (Adobe) 👍
m

Mark Takata (Adobe)

04/22/2022, 3:18 PM
Sure thing Brad. I'm assuming this is CF2021, latest update? Not that it might have an effect on list functions, but just good to know where to start testing so we're looking at the same codesets.
b

bdw429s

04/22/2022, 3:18 PM
@Rodney Yeah, I can't say I've ever tried to do that before either. it's probably a small edge case. I just saw the Lucee ticket talking about the behavior. Lucee was about to change themselves to match Adobe and I was thinking, "_Whoa, hold up-- let's determine what we SHOULD be doing first!_" 🙂
@Mark Takata (Adobe) My trycf link above is for CF 2021 from trycf, but I wouldn't be surprised if this behavior has been there forever. Honestly, who would use a list function to append with no delim, and who would want the current behavior 😆
@Mark Takata (Adobe) If you add semicolons (so it will compile), the code runs the same all the way back to CF10 on trycf
So it's always been this way, and probalby no one one even noticed.
m

Mark Takata (Adobe)

04/22/2022, 3:23 PM
I'll be honest, in 25 years I don't think I ever ran into a case where I was trying to listAppend this way, nor have I heard of other folks before this getting stuck on it, so it very well could just be a long lost "unintended language feature" 🙂
2
a

Adam Cameron

04/22/2022, 3:41 PM
Is it bad that my immediate thought was "what woodbrad do?"
b

bdw429s

04/22/2022, 3:41 PM
How much wood would brad wood wood if brad wood could wood wood?
a

Adam Cameron

04/22/2022, 3:42 PM
\me suppresses the urge to use "wood" in an inappropriate way here
😆 1
I'm with you, Mister Wood. I can't see any good reason why either CF or Lucee behave the way they do there. I would love to know why.
m

Mark Takata (Adobe)

04/22/2022, 3:47 PM
There is no why, only Zuul.
👍 1
* Something weird exists in CF * Adam:
❤️ 1
s

seancorfield

04/22/2022, 4:49 PM
As a cross-language sanity check, in Clojure
clojure.string/join
does basically the same as
listAppend()
/
listPrepend()
and if you give it an empty delimiter, it joins things together exactly as @bdw429s (and others) seem to expect:
Copy code
dev=> (clojure.string/join "," ["br,ad", "wo,od"])
"br,ad,wo,od"
dev=> (clojure.string/join "" ["br,ad", "wo,od"])
"br,adwo,od"
Having different behavior for an empty string delimiter just seems completely wrong to me...
👍 3
s

sknowlton

04/22/2022, 8:57 PM
what is this 'cross language sanity check' and why would we welcome such blasphemy here
🤔 1
🤣 2
m

Mark Takata (Adobe)

04/22/2022, 8:57 PM
Madness. Sheer and utter chaos.
a

Adam Cameron

04/22/2022, 11:45 PM
"If you wanna do Java, just go do Java"
b

bdw429s

05/23/2022, 5:57 PM
@Mark Takata (Adobe) Did the engineer ever get back with you on this? Should I go ahead and create a ticket?
m

Mark Takata (Adobe)

05/23/2022, 6:05 PM
Go ahead and make the ticket and post the number here so I can upvote. I didn't see a response but my inbox has also been a pit of chaos and horror the last few weeks so I may have missed it. Looking now, but makes sense to get a ticket in. I'll try and mention it tonight at our internal meeting on all things CF.
👍 1
a

Adam Cameron

05/23/2022, 6:11 PM
a pit of chaos and horror
/me rises from his pool of ichor and looks at Mark: "hmmm? Did you want something?"
m

Mark Takata (Adobe)

05/23/2022, 7:05 PM
OK vote submitted
👍 2
Trust me @Adam Cameron, compared to the stuff I've been dealing with this morning, you're a fluffy bunny bringing me cotton candy & scotch lol.
a

Adam Cameron

05/23/2022, 7:10 PM
Oh you got the photo of me in my new outfit then. Cool.
📸 1
m

Mark Takata (Adobe)

05/23/2022, 7:10 PM
Well, you printed it out at a meter tall, framed it and had it delivered to my front door so...
😜 1