I'm curious about adobe's implementation of member...
# adobe
s
I'm curious about adobe's implementation of member functions.... in lucee, I can immediately use a member function on complex values when I use implicit notation to create an array/structure/etc.... however in ACF I can only immediately use member functions on strings, and complex values need to be defined in a separate variable: As an example:
Copy code
<cfscript>
//This works on both
WriteOutput("123".find(2));
//This works in Lucee, but errors in Adobe CF
WriteOutput([1,2,3].find(2));

//In Adobe CF I need to do this to use a member function on an Array
a=[1,2,3];
WriteOutput(a.find(2));
</cfscript>
I like the option to not have to define another variable in cases where I don't need to like I can in Lucee, so I was wondering if that is something that might be addressed in a future release?
☝️ 1
t
There's definitely a tracker issue about this. It's been talked about here before, i think maybe brad opened it? I don't have a link to it though.
m
s
ok... I gave it a vote
I'm sure they'll get right on it now!
m
After 8 years? For sure!
🤣 2
s
I left a comment too.... that way they can see how inconvenient it was for me to have to type more.
m
Can we please have @Mark Takata (Adobe) look at this?
s
and of course, after I posted my comment (that I can't edit on the tracker site), I notice the bug in my code that would cause the 11s,12s, and 13s after 100 to not correctly use th! so now my fixed function is:
Copy code
function OrdinalFormat(n) {
return n&=arrayfind([1,2,3],n%10)&&!arrayfind([11,12,13],n%100)?listgetat('st,nd,rd',n%10):'th';
}
Or on lucee:
Copy code
function OrdinalFormat(n) {
return n&=[1,2,3].find(n%10)&&![11,12,13].find(n%100)?['st','nd','rd'][n%10]:'th';
}
@Mark Takata (Adobe) is there a bug tracker ticket for the modifying the bug tracker so that comments are editable and my mistake is not there for everyone to see for all time? lol
m
You're opening a huge other can of worms if you're getting into the shortcomings of the tracker itself. 😅
s
I like to stir the pot!
m
I love that the comment you put about editing the tracker is, itself, edited. I actually snorted lol
s
Yes… I always see my mistakes right after I hit enter
m
I'm also a serial editor.
s
Probably like ~87~% 97% of things I type need editing
😂 2