Zach Tellman writes:
> I will note, though, that &env is an implicit argument to the macros, so
> anything which
> works "exactly" like the compiler needs to mimic that as well.
I certainly agree, and I'll put this on the to-do list for tools.macro
(as soon as JIRA will let me in again, but t
Hi Nils,
Thanks for the link, I hadn't seen that before. Happily, what you describe
is pretty much exactly what Riddley does, in this case by accessing the
compiler internals. An example of how macrolet or symbol-macrolet could be
implemented using this is linked above in my response to Konrad.
Sorry, that documentation reflected 0.1.1-SNAPSHOT, which I've just
released as 0.1.1. Let me know if you have any other issues.
Zach
On Thu, Sep 5, 2013 at 6:26 AM, Stathis Sideris wrote:
> Thanks for this library Zach,
>
> It seems that the released version is a bit behind in comparison to
Hi Konrad,
Okay, I think I was just being dense. I thought you were talking about a
different macroexpansion strategy, rather than just doing full
macroexpansion without interleaved compilation. Thanks for your patience
in explaining what you meant.
I will note, though, that &env is an implicit
Thanks for this library Zach,
It seems that the released version is a bit behind in comparison to the
generated documentation [1]. For example, walk-exprs is advertised as being
able to accept a special-forms parameter, but that's not the case in the
jar that leiningen retrieved when I used [ri
Hi Zach,
you might want to look at this paper explaining how to write a correct
macroexpand-all (which requires a code walker) in Common Lisp:
http://www.merl.com/publications/TR1993-017/
The compiler certainly has to do something like that, but might not do all
of the macroexpansion before sta
Zach Tellman writes:
> I guess I'm confused, then. You contrast "complete recursive
> expansion" with what the compiler does, and then say it's recursive
> prewalk expansion, which is exactly what the compiler does. Can
> you clarify the difference between what you're doing and what the
I guess I'm confused, then. You contrast "complete recursive expansion"
with what the compiler does, and then say it's recursive prewalk expansion,
which is exactly what the compiler does. Can you clarify the difference
between what you're doing and what the compiler does?
On Wed, Sep 4, 2013 a
--On 4 septembre 2013 09:27:12 -0700 Zach Tellman
wrote:
So "complete recursive expansion" is postwalk macroexpansion? It seems
like that could break anaphoric macros, and likely others. A macro has
the option of calling macroexpand-all on its own contents if it wants
only special forms, but
Postwalk expansion would break macros that inspect their argument forms for
e.g. writing special-purpose queries, if they *also* adopt the symbols
"and" and "or" for conjunction or disjunction. Korma's "where", for
instance, does this; one can write
(select my-table (where (and (...) (...
And
Actually, postwalk expansion (if that is in fact what you were describing)
would ignore any binding forms created by the outer macro. This means that
something simple like:
(defmacro with-db [db & body]
`(with-open [~db (create-db)]
~@body))
would be expanded without any knowledge of the
So "complete recursive expansion" is postwalk macroexpansion? It seems
like that could break anaphoric macros, and likely others. A macro has the
option of calling macroexpand-all on its own contents if it wants only
special forms, but it shouldn't be forced to take only special forms.
Also, her
On Wed, Sep 4, 2013, at 09:25 AM, Zach Tellman wrote:
I'm not sure what you mean by "complete recursive expansion".
Could you expand
on that?
Completely ;-)
By complete recursive expansion I mean that you get a form that is
fully reduced to
the core language, i.e. it contains no m
I'm not sure what you mean by "complete recursive expansion". Could you
expand on that?
As for replicating the behavior of the compiler, I'd assert that unless
&env is precisely what it would be without ahead of time macroexpansion,
the compiler's behavior isn't being replicated. The tools.macro
Zach Tellman writes:
> I see. This is honestly something I hadn't considered, but since
> Riddley actually uses the Clojure compiler internals to track
> locals, this would be as simple as a (when-not (contains?
> (riddley.compiler/locals) (first expr)) ...) guard in the
> macroexpansion.
I
--On 3 septembre 2013 02:08:23 -0700 Zach Tellman
wrote:
Hey Konrad, you can maybe speak with more authority as to what
tools.macro does and doesn't provide, but my reading of it is that it
does expression walking to prevent bound variables from being incorrectly
symbol-macroexpanded. This se
On Tue, Sep 3, 2013 at 12:41 PM, Konrad Hinsen <
googlegro...@khinsen.fastmail.net> wrote:
>
> Not quite. It expands only terms that are evaluated, using a built-in
> table of special forms, and it allows local macro definitions (macrolet).
> But most importantly, it tracks local bindings
Local
I see. This is honestly something I hadn't considered, but since Riddley
actually uses the Clojure compiler internals to track locals, this would be
as simple as a (when-not (contains? (riddley.compiler/locals) (first expr))
...) guard in the macroexpansion. As Ben points out, using the compiler
Hey Konrad, you can maybe speak with more authority as to what tools.macro
does and doesn't provide, but my reading of it is that it does expression
walking to prevent bound variables from being incorrectly
symbol-macroexpanded. This seems only important in the context of symbol
macros, however; i
--On 2 septembre 2013 13:49:01 -0700 Zach Tellman
wrote:
The resulting library is called Riddley [2]. For obvious reasons, I've
named it after a book which is written entirely in a barely-readable
pidgin dialect. While there may be lingering issues, it's good enough to
replace the code-walkin
When I announced Proteus [1], it was rightfully pointed out that it didn't
play nicely with macros which rely on &env, as well as a few forms like
'letfn' that I hadn't explicitly handled. This flaw has been shared by
pretty much every library of this sort, and since this is a problem I've
hal
21 matches
Mail list logo