help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to add button to emacs that play a elisp code


From: Emanuel Berg
Subject: Re: how to add button to emacs that play a elisp code
Date: Fri, 12 Sep 2014 04:07:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> You may argue that you can avoid destructive
> operations like `nconc' in your code to prevent that
> problem.

I was just about to say that - almost. While I don't
think side effects are bad by definition, and I
disklike the whole functional paradigm crusade with the
Haskell hysteria and all, in practise it makes sense
most of the time.

But that is more related to your specific example than
to the problem, right?

> But that isn't enough either: when you pass your list
> to some function you didn't define yourself (e.g. a
> function that is part of Emacs), it is passed as
> reference (as usual in Lisp), and it may be modified
> by that function by side effect, so that your program
> "changes" too.
>
> If you are not aware of that problem, it probably
> won't bite you often, but when it does, you'll need a
> lot of time to find out what's actually going on.
>
> BTW, this "effect" can also be used constructively,
> it's not "harmful" per se.

No, I have lots of quoted, and even backquoted stuff,
which would have showed its harmful side by now, so I
suppose I have been using it either "constructively" or
where it doesn't matter which.

By the way - computer science silly buzzword:
idempotence, or "referential transparency".

-- 
underground experts united


reply via email to

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