all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: help-gnu-emacs@gnu.org
Subject: Re: What is the :eval form ?
Date: Sat, 09 Jun 2012 10:34:02 +0200	[thread overview]
Message-ID: <87zk8cc29x.fsf@gnuvola.org> (raw)
In-Reply-To: <tq4nqlasyb.fsf@news.eternal-september.org> (Richard Riley's message of "Sat, 09 Jun 2012 08:40:44 +0200")

() Richard Riley <rileyrg@gmail.com>
() Sat, 09 Jun 2012 08:40:44 +0200

   Is that also true in a function call? 

   ,----
   |   (notifications-notify  :title "Wazzup!?" :message message))
   `----

   title and message are not keywords here. 

   Or is the keyword "symbol" here?

In Emacs Lisp keywords and symbols are not disjoint.
A keyword is a symbol whose name begins with colon.
That's all (conceptually).

  ;; -*- emacs-lisp -*-
  (symbolp 'foo)
  t
  
  (symbolp :foo)
  t
  
  (keywordp 'foo)
  nil
  
  (keywordp :foo)
  t

In this *scratch* excerpt, we see that relationship
and note that all occurances are "in a function call"
(i presume to mean "arg to a function"), the functions
being ‘symbolp’ and ‘keywordp’.

But design and implementation are likewise not disjoint:

In the prior example, ‘notifications-notify’ is called
with four args, the even-indexed keywords, the odd-indexed
a string and whatever ‘message’ happens to be.

If you instrument (advise) ‘notifications-notify’ to call
‘type-of’ on each of the args it receives, you will find
that ‘type-of’ is not so smart:

  (type-of 'foo)
  symbol
  
  (type-of :foo)
  symbol

You might be tempted, then, to write:

  (defun excruciatingly-correct-type-of (object)
    (let ((guess (type-of object)))
      (case guess
        (symbol (if (char-equal ?: (aref (symbol-name object) 0))
                    'keyword
                  guess))
        (t guess))))
  
  (excruciatingly-correct-type-of 'foo)
  symbol
  
  (excruciatingly-correct-type-of :foo)
  keyword

Or not.  Personally, i stressed about this a while back but now
have mellowed out a bit.  Willful ignorance tastes different once
you go around the circle (at least once :-D).



  reply	other threads:[~2012-06-09  8:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 18:39 What is the :eval form ? Philippe M. Coatmeur
2012-06-08 17:56 ` Eli Zaretskii
2012-06-08 18:01 ` Drew Adams
2012-06-08 18:02 ` Tassilo Horn
2012-06-09  6:40   ` Richard Riley
2012-06-09  8:34     ` Thien-Thi Nguyen [this message]
2012-06-09 14:08     ` Drew Adams
2012-06-08 18:08 ` Tassilo Horn
2012-06-08 18:10 ` Drew Adams
2012-06-08 18:21 ` Barry Margolin
     [not found] ` <mailman.2446.1339178928.855.help-gnu-emacs@gnu.org>
2012-06-08 19:19   ` Philippe M. Coatmeur

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

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

  git send-email \
    --in-reply-to=87zk8cc29x.fsf@gnuvola.org \
    --to=ttn@gnuvola.org \
    --cc=help-gnu-emacs@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.