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

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

Re: Check for redundancy


From: Óscar Fuentes
Subject: Re: Check for redundancy
Date: Thu, 25 Jun 2015 04:03:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

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

>> The term is not specific to programming: expressing things which have been
>> expressed already.
>
> Obviously, Drew knows that.  The issue is that if you want to check for
> redundancy in code, it's presumably by doing it with another piece of
> code.  That other piece of code will have to encode formally what you
> mean by redundancy, so to be able to write it, you'll need to describe
> formally what you mean by redundancy.  And that's pretty damn hard for
> the usual interesting cases of redundancy.

A pretty easy (and safe) way is to define redundancy as "functional
equivalence" (which is what the OP mean, I think) and then compare the
generated bytecode. If it is the same, the functions are equivalent.
That doesn't work if different constructs with the same effects (`if' vs
`cond') compile to different bytecode, but that doesn't preclude its
practical usefulness.

C++ compilers do that for template functions, for avoiding code
explosion. Certain C++ compiler does that for ordinary functions as
well.

[snip]




reply via email to

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