[racket] Rationale behind missing string-trim

From: Eli Barzilay (eli at barzilay.org)
Date: Wed May 9 11:42:05 EDT 2012

30 minutes ago, Chad Albers wrote:
> I'm having a long running discussion with my colleagues about the
> practically of scheme.  I've argued that it is, and using Racket
> Scheme to prove my point.  However, on the other side of the debate,
> I've noticed that Racket's string API is missing what I consider to
> be a extremely practical procedure - string-trim.  This procedure is
> actually in srfi 13.  While I can 'require' srfi13, I can't import
> it as is, because sfri-13's procedures overlap Racket's string
> procedures.  I believe Racket's require feature allows me to just
> import those procedures I need from srfi 13, but I find that kind of
> awkward.
> My question is, then, why would such a practical procedure missing
> from Racket's string API?

In no particular order:

* If two libraries provide the same name, you'd only run into problems
  if you `require' both -- otherwise, as Laurent showed, there
  shouldn't be any problems.  If you do need to require both, then you
  can use a prefix or grab only the functionality that you need.

* I don't see a big meta point about the practicality of Racket
  ("Scheme" is trickier to talk about) -- we did have regexp
  operations for a long time now, and as any Perl hacker knows, you
  don't need anything more...  But more seriously it definitely means
  that practicality is important.

* The particular functionality that `string-trim' provides is one that
  can easily be done using regexps.  This is why it wasn't an urgent
  addition.  That's not to say that it's not needed -- and in fact
  this exact point came up recently -- it's just that if the main goal
  is to provide some simpler interface than regexps, then it's not
  clear how such an interface should look.

* As a result of the recent discussion, I've added it, and it will be
  included in the next release.  Also, it just happens that you wrote
  this email just when I was working on that exact function.  (We had
  talked about the general interface to these functions and reached
  some conclusions that slightly change the way it's implemented.)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.