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

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

Re: Help setting nadvice for indent-region


From: Emanuel Berg
Subject: Re: Help setting nadvice for indent-region
Date: Tue, 09 Feb 2016 00:13:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

John Mastro <john.b.mastro@gmail.com> writes:

> Your solution requires you to define a new `dwim'
> function every time you want overload a function
> like this

Yes, which is very fast and accurate.

> whereas with advice you can simply add it to the
> list of functions to be adviced (assuming it will be
> adviced in the same way).

If you write a defun, you know for sure what it does
and that it will be used as intended.

If you start muck around with existing code you have
two places to look when you want to know what happens,
instead of one place. Only at one of those places is
there even an indication there is another place to
look (i.e., where the advice is, but not where the
original code is).

Also, with a defun, it is used explicitly, but with
the advice or self-modifying code, what make sense for
you can be completely incomprehensible/invisible to
another person or program that uses the same piece of
code, and this makes debugging much more difficult -
also for the reason above (two places), by the way.

Remember the whole monolithic kernel vs.
microkernel thing.

>> It it also more natural and "human-ish" to read
>> without all the computer lingo (`funcall' etc.).
>
> Avoid funcall because it has a fun-y (haha) name?
> This part I can't get behind at all.

Just because people program computer doesn't mean
anyone is benefited from the people themselves turning
into, or acting like, computers. If the code is all
computer lingo this is a bad sign.

Compare the old-school C code which was constantly
pointers, references, bitmasks, all computer stuff,
enough to make your head spin - what does all this
stuff *do*? /* You are not expected to understand this */
To get the size of a vector ("array" in the C lingo),
simple! do

    int n = sizeof(a)/sizeof(a[0]);

compare this to the Lisp `length'.

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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