[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: cond*
From: |
Drew Adams |
Subject: |
RE: [External] : Re: cond* |
Date: |
Mon, 8 Jan 2024 15:20:59 +0000 |
> > Perhaps off-topic, but I think the difficulty
> > of human-parsing pcase sexps can be reduced
> > considerably if each variable bound by the
> > sexp is clearly shown to be just that.
>
> After reading the example, I see the point you're making.
> I suppose the same issue could apply to cond*.
> Do you think it applies equally to both?
> The only pertinent difference is that cond*
> would use match* or bind* around constructs that can make bindings.
My point about pcase was made originally in
the context of (IMHO) poor examples in the
Elisp manual.
I've only cursorily followed this cond* thread.
My point about pcase not signalling well that
something is a variable binding may not apply
to cond*, if variabless in cond* are always
introduced with a label that signals a binding.
That's akin to the use of an explicit "let" to
signal bindings - not a problem.
> > Even just following a trivial convention,
> > such as prefixing each variable name with,
> > `?', would help.
>
> Supposing that cond* could benefit from this idea, how can we make
> this idea fit the framework of Emacs Lisp? `?' has a different
> meaning. Of course, it does not _have_ to take the form of `?', but
> what could it be?
I don't know. Some Lisp pattern-matching
contexts have used a cons such as `(? VAR)'
(instead of just `?VAR') to indicate a
variable `VAR'. And in some such contexts,
the cons can even be updated destructively
to unify (logic programming) or instantiate.
My guess is that if you use a label such as
`match*' or `bind*', and if in that context
it's clear enough which things are the vars,
then you don't also need a syntax convention
(or enforcement) such as a `?' prefix.
So my comment about this may be off-topic in
a strict sense for this thread. In a more
general way it might still be relevant or
helpful.
I really do guess that much of the bother
people have with pcase and learning its
syntax comes from _vars not being obvious_.
For lispers used to backquote syntax I
think variables not signaling themselves
is likely to be more of an obstacle than
the use of backquote.
A third obstacle, IMO, is the mixing of
variable-binding constructs with control
(conditional) constructs. That's also
the case for `loop' and even things like
`if-let'. But `if-let' & compagnie are
simple, compared to `loop' and `pcase'.
Among (1) unobvious var bindings, (2)
backquote syntax, and (3) mixing of
control structure with pattern-matching
/ var-binding, the degree to which each
presents an obstacle to understanding/
reading/learning is debatable.
- Re: cond*, Ihor Radchenko, 2024/01/01
- Re: cond*, Richard Stallman, 2024/01/02
- Re: cond*, Ihor Radchenko, 2024/01/03
- Re: cond*, Richard Stallman, 2024/01/04
- Re: cond*, Ihor Radchenko, 2024/01/06
- RE: [External] : Re: cond*, Drew Adams, 2024/01/06
- Re: [External] : Re: cond*, Richard Stallman, 2024/01/07
- RE: [External] : Re: cond*,
Drew Adams <=
- map seq and radix-tree-leaf, in pcase, Richard Stallman, 2024/01/08
- Re: cond*, Richard Stallman, 2024/01/07
- Re: cond*, Ihor Radchenko, 2024/01/10
- Re: cond*, Richard Stallman, 2024/01/12
- Re: cond*, Adam Porter, 2024/01/13
- Re: cond*, Richard Stallman, 2024/01/15
- Re: cond*, Ihor Radchenko, 2024/01/13
- Re: cond*, Richard Stallman, 2024/01/14
- Re: cond*, Richard Stallman, 2024/01/07
- Re: cond*, Ihor Radchenko, 2024/01/08