[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making a function than can only be used interactively
From: |
Stefan Monnier |
Subject: |
Re: Making a function than can only be used interactively |
Date: |
Mon, 04 Jul 2022 15:40:13 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> Only after byte-compile of a file?
> So there is no way to actually make a function interactive only?
Please define what it is you mean by "make a function interactive only".
Do you mean that it should be illegal to write code that calls the
function directly, so whoever writes it can be sued?
Would it be acceptable for someone to just think about writing such code
as long as they don't actually write it?
More seriously, what are you trying to gain by "mak[ing] a function
interactive only"? Usually, the reason why one might want to make
a function "interactive only" is that code that calls this function is
probably incorrect and would likely be served better by some
other function. So the purpose is to help people write better code.
For this reason the declaration only has an effect in terms of
byte-compiler warnings: those who don't bother to byte-compile their
code presumably don't care about the quality of their code anyway.
Emacs doesn't offer any pre-defined way to really enforce that
a function is only used interactively, and in large parts this is
because, as a matter of design principle, Emacs makes no effort to stop
people from shooting themselves in the foot (instead, it tries to make
it easier for people not to shoot themselves in the foot).
Stefan
- Re: Making a function than can only be used interactively, (continued)
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/03
- Re: Making a function than can only be used interactively, Stefan Monnier, 2022/07/03
- Message not available
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/04
- Re: Making a function than can only be used interactively, Tassilo Horn, 2022/07/04
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/04
- Re: Making a function than can only be used interactively, Stefan Monnier, 2022/07/04
- Re: Making a function than can only be used interactively, Robert Pluim, 2022/07/04
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/04
- Re: Making a function than can only be used interactively, Jean Louis, 2022/07/05
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/04
- Re: Making a function than can only be used interactively,
Stefan Monnier <=
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/04
- Re: Making a function than can only be used interactively, Stefan Monnier, 2022/07/04
- Re: Making a function than can only be used interactively, Jean Louis, 2022/07/05
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/06
- Re: Making a function than can only be used interactively, Jean Louis, 2022/07/07
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/07
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/07
- Re: Making a function than can only be used interactively, Emanuel Berg, 2022/07/07
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/07
- Re: Making a function than can only be used interactively, Emanuel Berg, 2022/07/07