emacs-devel
[Top][All Lists]
Advanced

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

Re: pcase generates an unprintable expansion for a form in test erc--res


From: F . Jason Park
Subject: Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors
Date: Mon, 27 May 2024 13:14:58 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Stefan,

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> FWIW, I'm wondering what's the value of this specific test.
> Do we really care about the specific shape of the returned code?

No, we don't care. This test is indeed useless and will be removed.

> It seems terribly brittle: every minute change to the macro will require
> matching changes to the test, and I have no idea what is the intention
> of this test so if it every fails I wouldn't know whether the error is
> in the test or in the code.

A test _like_ this might make some sense in a case where the code under
test is itself deceptively brittle due to being tightly coupled to a
dependency, such as the specific shape of another, more complicated
macro whose expansion it modifies in ways that aren't easily detectable
through behavior alone [1]. In such cases, copying over ("vendoring")
the entirety of the complicated "upstream" macro's definition merely to
tweak minor aspects, presumably ones that can't easily be overridden or
redefined after evaluation, due to side effects, may be deemed a bigger
maintenance burden. IOW, after weighing the trade offs, it may be
decided such modifications would be better handled through brittle
twiddling/surgery during expansion. The point of such a test [2] would
then be to "fail fast" so as to alert you to upstream's changes as they
happen. Obviously, such a thing should not be done across ownership
boundaries. And better practices, like breaking up the complicated
dependency into reusable pieces, would be more sustainable long term.

Thanks,
J.P.

[1] 
https://gitlab.com/emacs-erc/edge/-/blob/fa37e9945df07e8bdb377bd5f5f30d6543521d1e/erc-common.el#L841
[2] 
https://gitlab.com/emacs-erc/edge/-/blob/fa37e9945df07e8bdb377bd5f5f30d6543521d1e/test/erc-tests.el#L3888



reply via email to

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