[erlang-questions] Re: Adoption of perl/javascript-style regexp syntax
Bengt Kleberg
bengt.kleberg@REDACTED
Thu Jun 4 09:38:05 CEST 2009
Greetings,
I am writing under the assumption that "you" below is directed to all of
us reading erlang-questions.
My opinion is that there is no therapy involved when having to
read/write double (or more) escaping in strings. The alternative (not
using strings, to avoid the problem) is therapeutic.
bengt
On Thu, 2009-06-04 at 07:44 +0200, Ulf Wiger wrote:
> Richard O'Keefe wrote:
> >
> > On 3 Jun 2009, at 6:50 pm, mats cronqvist wrote:
> >>
> >> this discussion is about how to represent strings with many escapes,
> >> not about regexps per se.
> >
> > You did read the subject?
>
> I even went back and read the original mail.
> He did say in there:
>
> "The only issue I have with it is that I have to
> specify regexps as strings."
>
> So presumably the OP is eagerly awaiting a library which
> supports regexps represented as something other than
> strings... ROK, you have a small project on your hands. :)
>
> > Actually, it's about people mistakenly THINKING they need
> > strings with many escapes, when what they really need is
> > to get away from strings.
>
> There's no getting away from strings in practice,
> and some strings have many escapes in them.
>
>
> Going back to the OP, the string "(?<!\\\\)#" can of course
> already be expressed in Erlang without escaping issues:
>
> [40,63,60,33,92,92,41,35]
>
> Forgoing *all* syntactical convenience, we would instead write:
>
> [40|[63|[60|[33|[92|[41|[35|[]]]]]]]]
>
> ...but of course that would be awkward.
> (Of course, when generating code, I will have to write it as
> 'cons' tuples, but when generating code, this is fine.)
>
> Surely we can all agree that syntactic sugar is sometimes
> a Good Thing. Too much of it is not, and one man's convenience
> is another man's cruft.
>
> Perhaps we can agree that there can be differences in opinion
> as to whether there is still room for more syntactic sugar
> regarding strings in Erlang?
>
> The claim that anyone who's unhappy with the current convenience
> level is simply confused, and in need of the therapeutic pain
> caused by rubbing up against double escaping in complex strings,
> is subjective. Wouldn't you agree?
>
> BR,
> Ulf W
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
More information about the erlang-questions
mailing list