[erlang-questions] Changes to string module
Sun Jul 23 21:53:42 CEST 2017
A big thumbs up for your work on Erlang, but...
At risk of being tagged culturally insensitive, Is it presumptions of me to ask if we could please split the new Unicode string functions into a separate library and preserve the ascii string functions as we find them in older Erlang versions?
I've been working with ascii string functions but now find the new docs much harder to work with, e.g. to my eye too much visual noise, plus stuff like this:
- string:chr/2 (and rchr/2) returns an index into a string. But we're told "This function is [ obsolete ]( http://erlang.org/doc/man/string.html#oldapi ). Use [ find/2 ]( http://erlang.org/doc/man/string.html#find-2 )."
find/2, however, returns "returns the remainder of the string or nomatch...."
- similarly, string:cspan/2 is marked "This function is [ obsolete ]( http://erlang.org/doc/man/string.html#oldapi ). Use [ take/3 ]( http://erlang.org/doc/man/string.html#take-3 )."
But string:take/3 returns leading and trailing data.
Plus, I dread the future necessity of rewriting string code.
I can certainly see the value of adding functions that support Unicode. And applaud them. But stomping on existing ascii functions seems like a stretch too far.
From: "Dan Gudmundsson" <dgud@REDACTED>
Sent: Friday, July 21, 2017 10:17am
To: "Lloyd R. Prentice" <lloyd@REDACTED>, "zxq9" <zxq9@REDACTED>
Subject: Re: [erlang-questions] Changes to string module
On Fri, Jul 21, 2017 at 4:02 PM Lloyd R. Prentice <[ lloyd@REDACTED ]( mailto:lloyd@REDACTED )> wrote:Hi all,
I can appreciate the reasons for the changes, but it has created moments of frustration for me.
I'm running an earlier version of Erlang. Plan to upgrade, but not yet. My work habit is to frequently consult on-line Erlang docs.
The other day I looked up string:span/2, which I've used in various places throughout my code. But what's this? It's marked "obsolete - use take/2."
I must have caught the docs at a point of transition since there was no take/2 in the list of string functions. What to do? What to do?
That version of the docs seems to have been updated. Both take/2 and span/2 are now in the list.
OK, I can live with momentary and passing frustration. But now, when I upgrade Erlang, do I have to worry that span/2 will be dropped at some point--- after all, it's "obsolete."
It might be dropped at some point, but not in any near future, not until OTP-23 and probably not in that release either.
We will deprecate (and add warnings) and remove the docs of the old functions in OTP-21.
The old functions will be kept.
Or do I have run two versions of Erlang?
Plus, I now find the string docs much harder to use since I have to think about whether a given function is in my version of Erlang or not.
Petty issues and, perhaps the price of progress. But it does illustrate that library revision may have unintended consequences.
The only difference right now (in OTP-20) is the addition of new functions and the text that warns that the old ones will be deprecated in 21.
So the only problem you might get in OTP-21 is deprecated warnings for using old functions which you can suppress.
Sent from my iPad
> On Jul 21, 2017, at 4:46 AM, zxq9 <[ zxq9@REDACTED ]( mailto:zxq9@REDACTED )> wrote:
> I missed it when looking through R20 release notes, but on referencing the string module I noticed a LOT of changes have happened there. String objects are now more or less based on unicode:chardata() and utf8 graphemes.
> Whoever is responsible for this -- THANK YOU.
> For those of us in East Asia life just got a bit easier. Not 100% easy, because what fun would that be, but this sure is a lot nicer.
> erlang-questions mailing list
> [ erlang-questions@REDACTED ]( mailto:erlang-questions@REDACTED )
> [ http://erlang.org/mailman/listinfo/erlang-questions ]( http://erlang.org/mailman/listinfo/erlang-questions )
erlang-questions mailing list
[ erlang-questions@REDACTED ]( mailto:erlang-questions@REDACTED )
[ http://erlang.org/mailman/listinfo/erlang-questions ]( http://erlang.org/mailman/listinfo/erlang-questions )
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions