From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Nobis Newsgroups: gmane.emacs.help Subject: Re: Check for redundancy Date: Sat, 27 Jun 2015 09:40:41 +0200 Organization: albasani.net Message-ID: References: <558A7875.4050905@easy-emacs.de> <24a1b328-82a8-44ff-8f8d-1425ab89ab67@default> Reply-To: stefan@familie-nobis.de NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1435391121 18528 80.91.229.3 (27 Jun 2015 07:45:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Jun 2015 07:45:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jun 27 09:45:21 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 1Z8kng-0008Ds-V5 for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Jun 2015 09:45:21 +0200 Original-Received: from localhost ([::1]:34753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8kng-0008Lw-BH for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Jun 2015 03:45:20 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!1.eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 Original-X-Trace: news.albasani.net YYp5xKNx9hRG6o3R1f20Cw25Xi8Wg5mpW+MFnfKU73GGQS457WLrfbgLZPUpLdzkED5MvWGzzaWXOu0Z9Q2IHJcKnOdwEqMgByRZ9GT7d1GzBeFnddeW+ygpH5VdRx+R Original-NNTP-Posting-Date: Sat, 27 Jun 2015 07:40:42 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="Tr3LTX5LNwTgbmNiw6DJIH26xZrmcPV53W2+pXQh8p2Ci2Aa8RzRnS8fPrD1KxzLW7tlUJLVkyzhceZMi/sFkTSMxMYM4gIXY3ZWoBgcbBOYUoK1YPiMCxJWr0m+fCcpb20zr6XO4qcolqQ7jpoXfPVw0A36gOQJc2u+v+Rody4="; mail-complaints-to="abuse@albasani.net" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:EkuyDbvc7JMY/DGkZMOsTTm6eaY= sha1:KZ/+TQy7N5OFlXb4/wLrWMahjQE= Original-Xref: usenet.stanford.edu gnu.emacs.help:212931 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:105216 Archived-At: Emanuel Berg writes: > Is it really that difficult for a computer to do this? Depends on the question you ask. :) IMHO the most interesting part would be to identify similar code blocks (even using different functions and variables internally), that can be refactored to a new, more generalized function with apropriate parameters. But this "similiarity" is quite difficult. In the general case you could summarize all your code blocks into one single function and on the other hand there might be quite some functions that are quite similiar but should stay separated because this way the intentions are better expressed and the the code using these function will be more readable. Therefore training an AI to produce really helpful recommendations will be quite difficult, me thinks. > The suggestion to have defuns byte-compiled individually and then > just compare the result sounds much more straightforward. This will give less false positives, but I think it will miss many opportunities to refactor similar code blocks. -- Stefan.