emacs-devel
[Top][All Lists]
Advanced

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

Re: Question on pcase


From: Michael Heerdegen
Subject: Re: Question on pcase
Date: Mon, 26 Oct 2015 17:20:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Oleh Krehel <address@hidden> writes:

> The reason I dislike `pcase' is not because I don't know how to use it
> (the basic rules are actually pretty simple), it's because I think it
> leads to code that's hard to understand, maintain and transform. I
> dislike the trivial `if-let' and `when-let' for the same reasons.

I like them because I think they make code easier to understand and
maintain.

> I generally dislike any custom macro that includes `if' or binds
> variables. This is because I can't reason about the code that uses these
> macros unless I know exactly what they do in terms of binding variables
> and selecting branches. These macros don't follow the substitution model
> for procedure application (SMPA) [1], which is a valuable debugging
> technique for me.

I wonder how you debug.  With the built in debugger, with edebug,
something else?  Knowing that would help understanding you problem.

> Maybe someone could explain the above, and also suggest the best way the
> create variable bindings from a pcase branch.

`macroexpand' is your only choice if you want to have semantically
equivalent code you can actually run.  If arbitrary `pcase' forms could
be expanded to simpler code, well, we should rewrite `pcase' to expand
to this simpler code.


Michael.



reply via email to

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