From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.help Subject: Re: Check for redundancy Date: Thu, 25 Jun 2015 04:03:19 +0200 Message-ID: <87a8vor1co.fsf@wanadoo.es> References: <558A7875.4050905@easy-emacs.de> <24a1b328-82a8-44ff-8f8d-1425ab89ab67@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1435197831 29951 80.91.229.3 (25 Jun 2015 02:03:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Jun 2015 02:03:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 25 04:03:42 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z7wVx-0007Nv-IB for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jun 2015 04:03:41 +0200 Original-Received: from localhost ([::1]:53577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7wVw-0001js-N0 for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Jun 2015 22:03:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7wVn-0001jh-MF for help-gnu-emacs@gnu.org; Wed, 24 Jun 2015 22:03:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7wVk-0004WI-F9 for help-gnu-emacs@gnu.org; Wed, 24 Jun 2015 22:03:31 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:43331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7wVk-0004W7-8k for help-gnu-emacs@gnu.org; Wed, 24 Jun 2015 22:03:28 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z7wVi-0007CA-08 for help-gnu-emacs@gnu.org; Thu, 25 Jun 2015 04:03:26 +0200 Original-Received: from 100.red-81-44-116.dynamicip.rima-tde.net ([81.44.116.100]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Jun 2015 04:03:25 +0200 Original-Received: from ofv by 100.red-81-44-116.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Jun 2015 04:03:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 24 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 100.red-81-44-116.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:9Gfkm3949Nu0jyhgEl9EOHrWx0g= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105136 Archived-At: Stefan Monnier 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]