unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: Paul Jarc <prj@po.cwru.edu>, guile-devel@gnu.org
Subject: Re: Unrecognized \ sequences and Elisp
Date: 28 Jan 2004 17:03:35 +0000	[thread overview]
Message-ID: <m3d694gg48.fsf@laruns.ossau.uklinux.net> (raw)
In-Reply-To: <1075207814.23541.1113.camel@localhost>

>>>>> "Roland" == Roland Orre <orre@nada.kth.se> writes:

    Roland> On Tue, 2004-01-27 at 10:04, Paul Jarc wrote:
    >> Then portable programs cannot use other escape sequences, which means
    >> that implementations can invent meanings for other escape sequences
    >> without breaking portable programs.
    Roland> OK, the question  then is what to do with those escape sequences which
    Roland> are not understood? My view is that with a minimum of defined escape
    Roland> sequences as in R5RS you have a lot of freedom but not understood
    Roland> sequences should then not generate error, only be passed through.
    Roland> The follow up question then is of course, should "foo\(bar" pass
    Roland> as "foo(bar" or "foo\(bar"?

The position as regards portable Scheme programs is clear: a portable
R5RS program should not use anything that is not defined by R5RS,
which includes \(.

If a supposedly portable program accidentally uses something
non-portable, it is usually better to get a clearly signaled error,
than (silently) some behavior which may not be what was intended.

Guile by default goes a long way beyond R5RS, so there is no good
portability argument against allowing \( in Guile at all.  If there
was, then an exactly analogous argument could be made against Guile's
many non-R5RS primitives that are provided in the default environment:
it could be argued that Guile should signal an error if any non-R5RS
procedure was assumed to exist.

Guile also provides a strict R5RS mode, though, where the last clause
is true.  In this mode, use of \( should signal an error.

Finally, there is the fact that \( per se isn't actually useful, other
than for handling existing Elisp code.  This tends to suggest that \(
should not be on by default, even outside strict R5RS mode.

Therefore I propose to reinstate \( support, but subject to the
SCM_ENABLE_ELISP #define and a runtime read option.  I also propose to
do the same for any other bits of Elisp read syntax that I need.
(Currently this is [ ] for vectors and \).)  This means that to make
\( etc. work, you'd need both to configure with --enable-elisp, and to
set a read option using (read-enable 'escaped-parentheses).

Does this sound OK?

    Roland> Yes, I agree to a certain extent, but this can be handled other ways,
    Roland> (string-append "foo" (string #\nl) "bar") 
    Roland> is of course a lot uglier than "foo\nbar" but in ordinary code you
    Roland> don't need this very often. This facility is mostly useful in
    Roland> format strings, and I consider it is better to be kept there.
    Roland> One way to view the question is, do we want the strings to actually
    Roland> contain what control characters etc we feed into them, or do we
    Roland> only want them to be printed in a certain way?
    Roland> When I (define foobar "foo\nbar") do I want it to really evaluate to
    Roland> "foo
    Roland> bar"
    Roland> or do I just want it to print a newline when passed through a certain
    Roland> write command? For my own I consider the latter the more useful
    Roland> approach.

What a fascinating idea!  I'd never thought of things like this
before.

However, I agree with others' replies that it would be odd for Guile
to differ in its interpretation here from most other programming
languages.  I also think it would be counter intuitive to be able to
form a string by concatenating "foo\" and "nbar", and then for this
string to print with a newline in the middle of it.  I also worry that
your approach would affect the ability to repeatedly write and reread
strings (the intention being that you get an equivalent string back,
of course).

So in summary, I'm afraid I don't think we should switch to your
alternative.

    Roland> Well, emacs regexp expressions uses e.g \( and \| where guile regexp
    Roland> uses only  ( and |.

Just to avert any possible confusion here, note that this difference
is one level higher than the current string syntax issue.  As strings,
these are:

  "\\(" and "\\|" in emacs
  "(" and "|" in guile.

Regards,
        Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  parent reply	other threads:[~2004-01-28 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-27  3:37 Fwd: Re: Unrecognized \ sequences and Elisp Roland Orre
2004-01-27  9:04 ` Paul Jarc
2004-01-27 12:50   ` Roland Orre
2004-01-27 16:26     ` tomas
2004-01-27 17:43     ` Stephen Compall
2004-01-28 17:03     ` Neil Jerram [this message]
2004-02-08 19:16       ` Neil Jerram
2004-02-08 22:06         ` Marius Vollmer
2004-02-10 19:27           ` Neil Jerram
2004-02-18 21:10             ` Marius Vollmer
  -- strict thread matches above, loose matches on Subject: below --
2004-01-26 23:26 Neil Jerram
2004-01-27  2:45 ` Paul Jarc
2004-01-27  6:44   ` Stephen Compall
2004-01-27  8:55     ` Paul Jarc
2004-01-28 16:32       ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3d694gg48.fsf@laruns.ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.org \
    --cc=prj@po.cwru.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).