emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Naming FCRs


From: Stefan Monnier
Subject: Re: Naming FCRs
Date: Sun, 26 Dec 2021 23:12:48 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Po Lu [2021-12-27 09:35:42] wrote:
> How about "functions-with-record"?

Which we'd abbreviate to FWR pronounced "fower", as in "Wow!  this
concept is really fowerful!" ?

There's something do it, tho the implementation doesn't really add any
record to the functions, it just uses the existing representation of
a function.  So maybe a more fitting name would be "functions as records",
abbreviated "far", as in "Wow!  This name is really far-fetched!" ?

Qiantan Hong [2021-12-27 02:33:08] wrote:
> I believe MIT Scheme has what exactly you described, and is called
> “apply-hook”, because it’s like hacking apply so it knows how to call
> an ordinary datum like a function.

These apply hooks are more like CL's funcallable objects, which we can
already simulate in ELisp with a symbol.
Basically `set-apply-hook-procedure!` is `fset`.

In contrast, FCRs are designed to be just normal closures, except they
come with a type and you get direct access from outside the function to
some of the vars that are closed over (and just as with closures, you
don't get to change the code associated with an FCR object).

By design, calling an FCR should not incur *any* overhead compared to
calling the same thing defined as a "normal" function.

Bob Rogers [2021-12-26 19:46:39] wrote:
> Without looking at the code, this sounds more like a closure to me.

Right, I rarely distinguish "closures" from "functions", but indeed,
these are more closures in that their "heap object" characteristics are
made more visible.

> Since the slots are accessible outside the function, that would make it
> a "transparent closure" . . . but I like the internal dissonance of
> "open closure" better.  ;-}

I like that, thank you.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]