[racket-dev] pr 12683 and using something like text:nbsp->space?

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Apr 12 17:10:44 EDT 2012

An hour ago, Danny Yoo wrote:
> In all three scenarios, I can see that it's possible the user really
> does want to leave zero-width characters unmolested.

There's an easier scenario to confirm this: pasting/typing some text
strings.  The frustration that you'd have when you just can't type
something sounds to me even worse than confusing identifiers.  To make
a stupid example:

  (define (my-append x y [avoid-ligatures? #f])
    (string-append x (if avoid-ligatures? "​" "") y))


> Possible actions for remediation:
>     1. Quietly and automatically translate the characters.

... with this feature, copy+pasting this code into DrRacket will be
broken, and IIUC, what you suggest is basically forcing the use of
unicode escapes to be practical.  (Since I definitely think that this
will be more than just zero-width characters, this would apply to any
text that you think might be changed in the future.)  Even worse: what
happens when I save that code with an editor that leaves it in (for
example, using drracket now), and later on openning it in a future
drracket changes the file?  If I do that for some other editing, I'm
very likely to not even notice that the file was shown as dirty to
begin with, and I can end up with a very confusing bug.

>     2. Bring up a dialog with the user asking whether the character
> should be translated or not.

IMO, this is obligatory.  I think that the above can be bad enough
that there should not even be a preference for it.  (Since I can see
myself using it because it's more convenient now, and forgetting about
it when it bites me a year later.)

> Is there another action or use case that I'm missing?  I like #1
> from a beginner's perspective: if I'm a beginner and have no clue
> what a zero width space is, why shouldn't DrRacket just fix it for
> me?

I think that this is confusing the concept of a "beginner" -- for
example, we've had racket beginners who were experienced linguists,
and are likely to use such weird characters.

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

Posted on the dev mailing list.