unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: john <jptmoore@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: sxml boolean
Date: Sat, 31 Mar 2012 11:46:16 -0400	[thread overview]
Message-ID: <878vigixiv.fsf@netris.org> (raw)
In-Reply-To: <CACnQuPwCsdx1JiWw=uKi3uxN_rL-GrMKrw0aBTfNV40LaUpdUQ@mail.gmail.com> (john's message of "Sun, 11 Mar 2012 10:24:38 +0000")

Hi John,

john <jptmoore@gmail.com> writes:
> When using (sxml simple) a conversion from boolean has no value. For
> example,  (sxml->xml '(foo #t)) produces <foo></foo>. Is this intended
> or a bug? I was expecting perhaps something like <foo>true</foo>,
> <foo>1</foo> or <foo>#t</foo>.

(foo #t) is not valid SXML, and 'sxml->xml' assumes valid SXML,
so the result is undefined.  The SXML grammar is defined at:

  http://okmij.org/ftp/Scheme/SXML.html

Arbitrary Scheme values are _not_ allowed, and there is no attempt to
guess how the user would like those to be formatted.  A child of an
element must either be another element, a processing instruction, a
comment, an entity, or character data.  Character data must be
represented as a Scheme string, and all the others are represented by
Scheme lists.  See the spec for details.

> The first two make more sense to me in terms of validating against XML
> Schema but I think any value is better than no value.

We didn't design SXML.  Oleg Kiselyov did.  However, I think he made the
right decision here.  IMO, it would have been a mistake to define a
behavior for other Scheme values.  Whatever behavior he chose, it would
not be what many users wanted, and it would make the definition and
implementation of SXML considerably more complex.

The only advantage would be a minor convenience in case the user
happened to want the same formatting choices that Oleg had made.  It is
easy and far more flexible for the user to write their own converter
that formats Scheme values as they need for their specific application.

Does that make sense?

    Regards,
      Mark



  parent reply	other threads:[~2012-03-31 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-11 10:24 sxml boolean john
2012-03-31  6:56 ` s9nn9s
2012-03-31 14:47   ` john
2012-03-31 15:46 ` Mark H Weaver [this message]
2012-03-31 18:18   ` john

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=878vigixiv.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-user@gnu.org \
    --cc=jptmoore@gmail.com \
    /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).