unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: guile-user@gnu.org
Subject: Re: Meaning of <=> in the context of procedures
Date: Wed, 04 Aug 2021 13:55:42 +0200	[thread overview]
Message-ID: <87bl6dqv9d.fsf@gnu.org> (raw)
In-Reply-To: CAOcxjM7xhWKo0z6XMoiFEJLXffBhTDi7oArh=pdNg4-Fq3znSA@mail.gmail.com

Hi Mortimer,

Mortimer Cladwell <mbcladwell@gmail.com> skribis:

> What does <=> mean/do?
> It can be found in guile-json in the (json record) module, line 33:
>
> 33 #:export (<=> define-json-mapping define-json-type))
>
> Not mentioned in the entire Guile manual. Happens to be defined on line 36
> of the module:
>
> 36  (define <=> '<=>)

I’m very late, but in short, ‘<=>’ is used a “syntactic keyword” in the
‘define-json-type’ macro (IOW, it’s among the “literals” of
‘syntax-rules’).

“Good practice” these days is that syntactic keywords should be bound.
This ‘define’ does just that: binding ‘<=>’.  Its actual value doesn’t
matter.

The advantage of that is that you can renaming bindings (with #:prefix
for instance), you can see when two syntactic bindings clash, and so on.

Quoth the manual (info "(guile) Syntax Rules"):

     A literal matches an input expression if the input expression is an
  identifier with the same name as the literal, and both are unbound(1).

     Although literals can be unbound, usually they are bound to allow
  them to be imported, exported, and renamed.  *Note Modules::, for more
  information on imports and exports.  In Guile there are a few standard
  auxiliary syntax definitions, as specified by R6RS and R7RS:

   -- Scheme Syntax: =>
   -- Scheme Syntax: _
   -- Scheme Syntax: ...
       Auxiliary syntax definitions.

       These are defined as if with a macro that never matches, e.g.:

            (define-syntax else (syntax-rules ()))

HTH!

Ludo’.




      parent reply	other threads:[~2021-08-04 11:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 14:06 Meaning of <=> in the context of procedures Mortimer Cladwell
2021-06-02 16:12 ` Linus Björnstam
2021-06-02 16:21   ` Linus Björnstam
2021-08-04 11:55 ` Ludovic Courtès [this message]

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=87bl6dqv9d.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-user@gnu.org \
    /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).