From: Aaron Ecay <aaronecay@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Lexical binding bug in org-list.el?
Date: Sat, 07 Nov 2015 21:30:58 +0000 [thread overview]
Message-ID: <87a8qpts31.fsf@gmail.com> (raw)
In-Reply-To: <87twox92nx.fsf@nicolasgoaziou.fr>
Hi Nicolas,
2015ko azaroak 7an, Nicolas Goaziou-ek idatzi zuen:
>
> Aaron Ecay <aaronecay@gmail.com> writes:
>
>> On a broader scope, this is just one part of org that is written in this
>> style (one large let that defines many functions which call each other;
>> the body of the let is just a call into one of these functions). This
>> isn’t idiomatic elisp (at least, I’ve never seen it outside org), and it
>> seems suboptimal for at least two reasons:
>> 1. The interface between the functions isn’t well-defined – they could
>> exchange information via arguments and/or by modifying variables
>> introduced by their containing let.
>
> They are mutually recursive functions. I don't think that is
> un-idiomatic in the Lisp world. I don't think why the reason above would
> make them sub-optimal, too.
I guess it’s a scheme-ism. <http://cl-su-ai.lisp.se/msg04741.html>.
Grepping for it in emacs sources, I see 4 uses in vc-* libraries, 1 in
octave, and 1 in emacs-lisp mode. cl-labels is also implemented in
terms of letrec. Org has 16 uses so far, all of them introduced since
the lexical binding change (or in any case since the last merge with
emacs).
I’m not saying we shouldn’t use it just because it’s rare, or a
scheme-ism. Just satisfying my own curiosity out loud. :)
>
>> 2. It’s impossible to unit test the small let-bound functions.
>
> Why would you want to unit test them? They are an implementation detail.
> Only `org-list-parse-list' should be tested here.
I don’t think we should unit-test only public API functions. Indeed, I
find it easier to write unit tests for small functions, since I don’t
have to construct a lot of extra context to exercise all the corner
cases.
>
>> In view of this, do you think it would be desirable in the long term to
>> refactor code like this into top-level functions?
>
> No, I don't. I see no reason to pollute name space with these very
> specific functions.
I’m not sure I get it – interned symbols are cheap, and with the new-ish
double-dash convention for private functions users/downstream developers
can be pretty sure they don’t need to worry about them.
If it’s for us as org devs, I think the benefits outweigh the drawback
of having the extra function names to sift through in code completion
popups (which is the only one I can think of). But opinions can differ,
and maybe I haven’t considered all the potential negatives.
[...]
> My take on the problem at hand is
>
> - change `org-list-parse-list' to provide a simpler output and update
> Babel should to use that new output.
>
> - re-implement `org-list-to-subtree' using directly Elements, or even
> string massaging.
OK, these both sound do-able.
>
> - start a poll on the ML to guess the potential user base for radio
> lists. Depending on the results, we might either deprecate the whole
> thing, as you suggest, or implement in a more powerful and clean
> way. Note that first item implies `org-list-to-generic' should be
> updated to handle new output for `org-list-parse-list'.
Given that no one’s ever asked for better radio lists despite us
advertising the feature and its unflattering comparison with more
powerful radio tables, I doubt there will be any interest. But it’s
worth asking. Should one of us start a new thread to ask this question?
--
Aaron Ecay
next prev parent reply other threads:[~2015-11-07 21:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 19:43 Lexical binding bug in org-list.el? Kaushal Modi
2015-11-06 19:47 ` Kaushal Modi
2015-11-06 20:45 ` Aaron Ecay
2015-11-06 21:13 ` Kaushal Modi
2015-11-07 0:20 ` Nicolas Goaziou
2015-11-07 11:54 ` Aaron Ecay
2015-11-07 16:48 ` Nicolas Goaziou
2015-11-07 21:30 ` Aaron Ecay [this message]
2015-11-08 14:57 ` Nicolas Goaziou
2015-11-08 19:55 ` Aaron Ecay
2015-11-09 15:23 ` Kaushal Modi
2015-11-11 9:33 ` Nicolas Goaziou
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8qpts31.fsf@gmail.com \
--to=aaronecay@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).