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

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

Re: Strange eval behaviour


From: Michael Heerdegen
Subject: Re: Strange eval behaviour
Date: Sat, 19 Nov 2016 00:35:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Stefan Huchler <stefan.huchler@mail.de> writes:

> Or did you refer here to something different you saw? bytecompiling
> only throw warnings about this params variables. And thats only
> warnings...

But the warnings are there for a reason, and the reason is that the code
can potentially error when being run.  In general, the warnings mean
that you do something you definitely should not do.  Let's fix these
warnings, and then I can have a look at the code again if you want.

Also try to follow the essence of functional programming: reduce side
effects of functions to a minimum.  When a function has side effects,
make it clear (e.g. in the doc or the name of the function).  If you
really need to set any global variable, declare that variable with
`defvar' and prefix its name with the prefix of your library.  In
general, the way functions transfer information in Lisp is by the return
value, not by setting variables.  For avoiding some bad habits it's very
helpful to use lexical-binding - you can enable it with a specification
in the file's first line.

Maybe consider reading a good book about lisp (since learning by doing
is not a good approach in Lisp).  Maybe "Land of Lisp" (haven't read it,
but it has a good title song) or "On Lisp" by Graham (a classical, but
harder to read; reading some of the first chapters might be a good idea
anyway).


Regards,

Michael.



reply via email to

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