all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* anaphora in emacs-lisp?
@ 2014-08-08 20:29 Nic Ferrier
  2014-08-09  2:57 ` Thien-Thi Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nic Ferrier @ 2014-08-08 20:29 UTC (permalink / raw)
  To: emacs-devel

Is there any objection to us adding anaphora to EmacsLisp?

I have just written an alias for ibuffer's functions for about the
50-millionth time.

Simply aliasing the main functions implemented in ibuffer would be
trivial. It could be namespaced, as per Stefan's preference, with "a".

  (defalias 'aif 'ibuffer-aif)

etc...

Can we not do that?


Nic



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: anaphora in emacs-lisp?
  2014-08-08 20:29 anaphora in emacs-lisp? Nic Ferrier
@ 2014-08-09  2:57 ` Thien-Thi Nguyen
  2014-08-09 12:58 ` Stefan Monnier
  2014-08-09 17:24 ` Richard Stallman
  2 siblings, 0 replies; 8+ messages in thread
From: Thien-Thi Nguyen @ 2014-08-09  2:57 UTC (permalink / raw)
  To: Nic Ferrier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

() Nic Ferrier <nferrier@ferrier.me.uk>
() Fri, 08 Aug 2014 21:29:00 +0100

   Can we not do that?

Maybe you can move ‘cool-cond’ (see 2013 archives) forward,
as a basis for these.

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: anaphora in emacs-lisp?
  2014-08-08 20:29 anaphora in emacs-lisp? Nic Ferrier
  2014-08-09  2:57 ` Thien-Thi Nguyen
@ 2014-08-09 12:58 ` Stefan Monnier
  2014-08-09 17:24 ` Richard Stallman
  2 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-08-09 12:58 UTC (permalink / raw)
  To: Nic Ferrier; +Cc: emacs-devel

> Is there any objection to us adding anaphora to EmacsLisp?

I don't really want to veto it, but I'm not thrilled about it, because
I don't like introducing variables whose name is not provided by the
macro caller (and I find the benefit of things like `aif' rather small).

But maybe the new `if-let' (in subr-x.el) satisfies your needs:

  (aif E1 E2 E3) ~= (if-let ((it E1)) E2 E3)

> I have just written an alias for ibuffer's functions for about the
> 50-millionth time.

Please submit those packages incrementally (say by groups of 1 million),
so we're not drowned.


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: anaphora in emacs-lisp?
  2014-08-08 20:29 anaphora in emacs-lisp? Nic Ferrier
  2014-08-09  2:57 ` Thien-Thi Nguyen
  2014-08-09 12:58 ` Stefan Monnier
@ 2014-08-09 17:24 ` Richard Stallman
  2014-08-10 23:18   ` Josh
  2 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2014-08-09 17:24 UTC (permalink / raw)
  To: Nic Ferrier; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

    Is there any objection to us adding anaphora to EmacsLisp?

Concretely, what feature are you proposing?

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: anaphora in emacs-lisp?
  2014-08-09 17:24 ` Richard Stallman
@ 2014-08-10 23:18   ` Josh
  2014-08-11  1:46     ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Josh @ 2014-08-10 23:18 UTC (permalink / raw)
  To: rms; +Cc: Nic Ferrier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

On Sat, Aug 9, 2014 at 10:24 AM, Richard Stallman <rms@gnu.org> wrote:

>     Is there any objection to us adding anaphora to EmacsLisp?
>
> Concretely, what feature are you proposing?
>

It sounds like Nic is proposing something much like what I did last
year[0], for much the same reasons.  Though AFAIK Emacs currently
ships with only two anaphoric macros, namely `ibuffer-aif' and
`ibuffer-awhen', others such as `acond' would also be welcome
additions to elisp proper.  These macros and others are discussed in
more detail here[1].

[0] http://lists.gnu.org/archive/html/emacs-devel/2013-07/msg00480.html
[1] dunsmor.com/lisp/onlisp/onlisp_18.html

[-- Attachment #2: Type: text/html, Size: 1275 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: anaphora in emacs-lisp?
  2014-08-10 23:18   ` Josh
@ 2014-08-11  1:46     ` Richard Stallman
  2014-08-11  7:09       ` David Kastrup
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2014-08-11  1:46 UTC (permalink / raw)
  To: Josh; +Cc: nferrier, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

    It sounds like Nic is proposing something much like what I did last
    year[0], for much the same reasons.

That text doesn't directly tell me what the feature is.  (I could send
mail to fetch the page, but that would delay my response till
tomorrow.)

Fortunately, Nic was more directly explicit:

    aif, awhen, acond - decision macros that capture the value of the test
    expression in the variable "it" for use later in the body.

In principle, such features are desirable, but the syntax tends to be
either inelegant or clumsy.  If the variable gets a fixed name, it is
inelegant; if you specify the name, it does not save you much.  If the
variable is always called 'it', that's the inelegant variety.
`when-let' is an example of the variety that doesn't save you much.

Also, names such as 'aif' are unhelpful.  Only people who have studied
linguistics know what "anaphora" means, and nobody will guess what the
'a' stands for.

If they were called 'if-it', 'when-it', and 'cond-it', they would be a
little less inelegant, because the variable name to be bound appears
visibly (albeit in the name of the macro).  Also, these names would
suggest what the constructs do.  So these names are much better.

If we have these, we should also have 'unless-it' and 'case-it'.


-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: anaphora in emacs-lisp?
  2014-08-11  1:46     ` Richard Stallman
@ 2014-08-11  7:09       ` David Kastrup
  2014-08-13  3:55         ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: David Kastrup @ 2014-08-11  7:09 UTC (permalink / raw)
  To: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> If we have these, we should also have 'unless-it' and 'case-it'.

unless-it seems fabulously pointless: `it' would always be nil.

-- 
David Kastrup




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: anaphora in emacs-lisp?
  2014-08-11  7:09       ` David Kastrup
@ 2014-08-13  3:55         ` Richard Stallman
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2014-08-13  3:55 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

    > If we have these, we should also have 'unless-it' and 'case-it'.

    unless-it seems fabulously pointless: `it' would always be nil.

We seem to envision two different calling conventions.
I envisioned

   (unless-it (+ x y) (> it 5)
     ...)

but I suppose you envision that 'it' is bound to the object
whose value is tested.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-13  3:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08 20:29 anaphora in emacs-lisp? Nic Ferrier
2014-08-09  2:57 ` Thien-Thi Nguyen
2014-08-09 12:58 ` Stefan Monnier
2014-08-09 17:24 ` Richard Stallman
2014-08-10 23:18   ` Josh
2014-08-11  1:46     ` Richard Stallman
2014-08-11  7:09       ` David Kastrup
2014-08-13  3:55         ` Richard Stallman

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.