unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: emacs-devel@gnu.org
Subject: Re: `thunk-let'?
Date: Fri, 24 Nov 2017 10:36:20 +0200	[thread overview]
Message-ID: <83shd49ipn.fsf@gnu.org> (raw)
In-Reply-To: <873755hbpr.fsf@web.de> (message from Michael Heerdegen on Thu, 23 Nov 2017 05:15:44 +0100)

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: emacs-devel@gnu.org
> Date: Thu, 23 Nov 2017 05:15:44 +0100
> 
> Michael Heerdegen <michael_heerdegen@web.de> writes:
> 
> > This helped a lot.  My first version even compiled without error.  I'll
> > post the updated patch soon.
> 
> Ok, here is what I have, with everything discusses included (see also
> attached).  I will proofread it once more, maybe others will want to
> have a look in the meantime, too.

My comments below.

> +@defmac thunk-delay forms...

Please use "forms@dots{}" instead, it produces a prettier ellipsis.

> +Return a thunk for evaluating the @var{forms}.  A thunk is a closure
> +that evaluates the @var{forms} in the lexical environment present when
> +@code{thunk-delay} had been called.

This could be improved as follows:

  @cindex thunk
  Return a @dfn{thunk} for evaluating the @var{forms}.  A thunk is a
  closure (@pxref{Closures}) that evaluates the @var{forms} in the
  lexical environment present when @code{thunk-delay} had been called.

The improvements are:

  . you introduce a new term, so it should be in @dfn, and an index
    entry for it is in order
  . you mention "closures", so a cross-reference to where these are
    described is a Good Thing, because the reader might not know or
    remember what that is

> +@code{thunk-delay} had been called.

"had been called" or "will be called"?

> +@defun thunk-force thunk
> +Force @var{thunk} to perform the evaluation of the forms specified to the
> +@code{thunk-delay} that created the thunk.

"to the thunk-delay" or "in the thunk-delay" (or "for the thunk-delay")?

> +of the last form is returned.  The @var{thunk} also "remembers" that it has

Quoting in Texinfo is ``like this'' (I guess you didn't use the Emacs
Texinfo mode, or typed `C-q "' here.)  makeinfo will then convert
these to the actual quote characters.

> +been forced: Any further calls of @code{thunk-force} on the same @var{thunk}
                                                        ^^
"with"

> +@defmac lazy-let (bindings...) forms...

@dots{} again

> +This macro is analogous to @code{let} but creates "lazy" variable

``lazy''.

> +bindings.  Any binding has the form (@var{symbol} @var{value-form}).

The entire parenthesized expression should be in @code:

  @code{(@var{symbol} @var{value-form})}

I also recommend to wrap that in @w, so that it doesn't get split
between two lines, like this:

  @w{@code{(@var{symbol} @var{value-form})}}

> +@group
> +(f 12)
> +@print{} "Calculating 1 plus 2 times 12"
> +25

This 25 should have @result{} before it, right?

> +to set them (e.g.@ with @code{setq}).

You mean "e.g.@:", right?

> +@defmac lazy-let* (bindings...) forms...

@dots{}

> +binding expressions.  All references to the original variables in the
> +body @var{forms} are then replaced by an expression that calls
> +@code{thunk-force} on the according helper variable.  So, any code

"calls ... on" is slightly awkward English, I think.  How about "calls
thunk-force passing it the according helper variable as an argument",
or calls thunk-force with the according helper variable as the
argument" instead?

> +** Thunk
> +*** The new macros 'thunk-let' and 'thunk-let*' are analogue to `let'
> +and `let*' but create bindings that are evaluated lazily.

I think this should be a single-level entry:

  ** New macros 'thunk-let' and 'thunk-let*'.
  These macros are analogue to `let' and `let*', but create bindings
  that are evaluated lazily.

Thanks again for working on this.



  parent reply	other threads:[~2017-11-24  8:36 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-08 20:12 `thunk-let'? Michael Heerdegen
2017-10-08 22:25 ` `thunk-let'? Michael Heerdegen
2017-10-09  3:10 ` `thunk-let'? Stefan Monnier
2017-10-09 11:40   ` `thunk-let'? Michael Heerdegen
2017-10-09 14:07     ` `thunk-let'? Michael Heerdegen
2017-10-09 14:27       ` `thunk-let'? Michael Heerdegen
2017-10-09 15:38     ` [SUSPECTED SPAM] `thunk-let'? Stefan Monnier
2017-11-08 17:22       ` Michael Heerdegen
2017-11-08 18:02         ` Stefan Monnier
2017-11-09 15:14           ` Michael Heerdegen
2017-11-09 18:39             ` `thunk-let'? Michael Heerdegen
2017-11-09 18:48               ` `thunk-let'? Stefan Monnier
2017-11-22  2:50                 ` `thunk-let'? Michael Heerdegen
2017-11-22  3:43                   ` `thunk-let'? Eli Zaretskii
2017-11-22 16:16                     ` `thunk-let'? Eli Zaretskii
2017-11-22 19:25                       ` `thunk-let'? Michael Heerdegen
2017-11-22 20:00                         ` `thunk-let'? Eli Zaretskii
2017-11-23  2:59                       ` `thunk-let'? Michael Heerdegen
2017-11-23  4:15                         ` `thunk-let'? Michael Heerdegen
2017-11-23 16:34                           ` `thunk-let'? Pip Cet
2017-11-23 23:41                             ` `thunk-let'? Michael Heerdegen
2017-11-24  8:37                               ` `thunk-let'? Eli Zaretskii
2017-11-24  8:51                                 ` `thunk-let'? Stefan Monnier
2017-11-24  9:16                                   ` `thunk-let'? Eli Zaretskii
2017-11-24 13:33                                     ` `thunk-let'? Stefan Monnier
2017-11-27  5:21                                 ` `thunk-let'? Michael Heerdegen
2017-11-27 13:34                                   ` `thunk-let'? Stefan Monnier
2017-11-27 15:44                                     ` `thunk-let'? Eli Zaretskii
2017-11-30 15:19                                       ` `thunk-let'? Michael Heerdegen
2017-11-24  8:36                           ` Eli Zaretskii [this message]
2017-11-30 15:17                             ` `thunk-let'? Michael Heerdegen
2017-11-30 16:06                               ` `thunk-let'? Eli Zaretskii
2017-12-01  8:02                                 ` `thunk-let'? Michael Heerdegen
2017-11-23 16:04                         ` `thunk-let'? Eli Zaretskii
2017-11-22 17:44                   ` `thunk-let'? Gemini Lasswell
2017-11-22 18:04                     ` `thunk-let'? Noam Postavsky
2017-11-22 18:31                       ` `thunk-let'? Michael Heerdegen
2017-11-22 18:29                     ` `thunk-let'? Michael Heerdegen
2017-11-22 19:54                     ` `thunk-let'? Stefan Monnier
2017-11-22 22:47                       ` `thunk-let'? Michael Heerdegen
2017-11-10 10:01             ` [SUSPECTED SPAM] `thunk-let'? Eli Zaretskii
2017-11-08 18:04         ` Eli Zaretskii
2017-11-08 22:22           ` `thunk-let'? Michael Heerdegen
2017-11-08 23:06             ` `thunk-let'? Drew Adams
2017-11-09 17:20             ` `thunk-let'? Eli Zaretskii
2017-11-09 17:39               ` `thunk-let'? Clément Pit-Claudel
2017-11-09 18:06                 ` `thunk-let'? Michael Heerdegen
2017-11-09 21:05                   ` `thunk-let'? Drew Adams
2017-11-09 23:07                     ` Sandbox subr-x? (was: `thunk-let'?) Michael Heerdegen
2017-11-09 23:54                       ` Drew Adams
2017-11-10  7:57                       ` Eli Zaretskii
2017-11-09 21:48                   ` `thunk-let'? Clément Pit-Claudel
2017-11-09 22:43                     ` `thunk-let'? Michael Heerdegen
2017-11-10  7:48                     ` `thunk-let'? Eli Zaretskii
2017-11-09 18:14               ` `thunk-let'? Michael Heerdegen
2017-11-09 20:26                 ` `thunk-let'? Eli Zaretskii
2017-11-09 23:13                   ` `thunk-let'? Michael Heerdegen
2017-11-10  7:58                     ` `thunk-let'? Eli Zaretskii
2017-11-11 15:20                       ` `thunk-let'? Michael Heerdegen
2017-11-11 15:40                         ` `thunk-let'? Eli Zaretskii
2017-11-10 10:10               ` `thunk-let'? Nicolas Petton
2017-11-09 14:34           ` [SUSPECTED SPAM] `thunk-let'? Michael Heerdegen
2017-11-09 17:12             ` Eli Zaretskii
2017-11-09 15:19           ` Michael Heerdegen
2017-10-09  8:00 ` `thunk-let'? Nicolas Petton
2017-12-08 20:38 ` A generalization of `thunk-let' (was: `thunk-let'?) Michael Heerdegen
2017-12-08 21:16   ` A generalization of `thunk-let' Stefan Monnier
2017-12-09 10:33     ` Michael Heerdegen
2017-12-10  4:47       ` Stefan Monnier
2017-12-10  5:34         ` John Wiegley
2017-12-12 14:41         ` Michael Heerdegen
2017-12-13 13:52           ` Michael Heerdegen
2017-12-13 14:09             ` Stefan Monnier
2017-12-13 14:37               ` Michael Heerdegen
2018-01-12 20:03     ` Michael Heerdegen
2017-12-09 21:59   ` A generalization of `thunk-let' (was: `thunk-let'?) Richard Stallman
2017-12-10 17:03     ` A generalization of `thunk-let' Michael Heerdegen

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/emacs/

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

  git send-email \
    --in-reply-to=83shd49ipn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.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).