See steps to reproduce.
On ColdFusion, this yields a five-element array with each character as an element. On Railo it's just a single-element array with the whole string in the first element.
ColdFusion's behaviour dates back to at least CFMX7 (that's the oldest version I have on tap).
There is no suggestion one way or the other in the ColdFusion docs (http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f0f.html) whether an empty string should be allowable as a delimiter like this, but CF has worked this way since before Railo existed, so that's perhaps an adequate precedent? I could see arguments either way, but if a zero-length delimiter is illegal, then this should perhaps raise an exception. If it's valid, it should work the same as ColdFusion does, I think?
Cheers.
In my book the definition of a bug is when behavior strays from documentation.
I personally don't think that we should support this, as empty-string is Not a delimiter (while I do like the ability to iterate over the chars in a string).
Let's see what Micha thinks.
--
typos, misspels, and other weird words brought to you courtesy of my mobile device.
a blank space, comma, or other character or symbol that indicates the beginning or end of a character string, word, or data item
A delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams.
At the risk of repeating myself -- I'm with Matt on this one :-)
--
typos, misspels, and other weird words brought to you courtesy of my mobile device.
In my book the definition of a bug is when behavior strays from documentation.
I personally don't think that we should support this, as empty-string is Not a delimiter (while I do like the ability to iterate over the chars in a string).
Let's see what Micha thinks.
Space IS indeed a very valid delimiter. We're not talking about a Space here but about an empty-string.
--
typos, misspels, and other weird words brought to you courtesy of my mobile device.
String.split() is a Java method and in the absence of a method with that name in ACF/Railo it is resolved via reflection at runtime.
--
typos, misspels, and other weird words brought to you courtesy of my mobile device.
Whenever you try to access a property/method of an object, if it is not found then Railo/ACF attempts to resolve it in java via reflection.
This is very useful when you use a 3rd party library or ad-hoc java classes.
--
typos, misspels, and other weird words brought to you courtesy of my mobile device.
For me the discussion is a little bit like, "how does the shape of a car change when you drive against a wall?"
Adding a bif called split as alias for listtoarray makes sense from my point of view.
I would actually love it if we had member functions like isEmpty() and len() on strings
--
typos, misspels, and other weird words brought to you courtesy of my mobile device.
I would actually love it if we had member functions like isEmpty() and len() on strings
Adam wrote:
> The upside for everyone is that it'll be briefer this time
Heh, if that's a briefer version, I think they did us all a favour! ;)
I agree though: the sensible choice is between throwing an error or being compatible with CF.
Is there some reason such a fix would be bad for the language ( splitting the string to chars kind of seems like the expected behavior ) ?
Not that this specific feature matters to me much - just trying to figure out how the process gets decided in general.
I guess the question I'm really asking, is just, how compatible can I expect the stable version of Railo 4 to be (or not be) with legacy CF 7/8/9 code.
How many behaviors will have been modified based on what "should be", vs, what is?
How many behaviors will have been modified based on what "should be", vs, what is?
I think this feature was missed from the documentation and we do strive to keep it very compatible, and if not, be able to offer good work rounds.How compatible? well you really should perform your own tests in all honesty. Maybe I am jaded but I have seen some insane code over the last few years that much of the time makes me say "Surely that cannot work, it's obviously wrong" but turns out it works, despite my eyes bleeding.
How many behaviors will have been modified based on what "should be", vs, what is?It's a tough decision, do we do a great product or just a compatible one? I would prefer a great product that makes sense for all concerned would be first and compatibility second, but that is *MY* personal opinion.
I would say much of your code should work as expected but there *ARE* edge cases that crop up from time to time.I am sorry if I cannot be more precise, but with something like 130 tags and 597 functions, keeping track on how compatible they are with 4 different versions of another product is fairly *hard*.
Let's say that CF 7/8/9 code should be PRETTY compatible.
And by the way, I never knew you could do ListToArray("bladadada", "") and get an array of the characters, I would have never done that personally and aside from this thread, never have come across it (and I see a lot of code) (but I know you will all prove me wrong by saying you do this day in day out and I am an idiot for not knowing such a handy function)