From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Perry E. Metzger" Newsgroups: gmane.emacs.devel Subject: Re: Emacs contributions, C and Lisp Date: Fri, 9 Jan 2015 09:17:52 -0500 Message-ID: <20150109091752.4cc626b5@jabberwock.cb.piermont.com> References: <83bnxuzyl4.fsf@gnu.org> <8761nusb90.fsf@uwakimon.sk.tsukuba.ac.jp> <87vbkovhh7.fsf@engster.org> <87387rvobr.fsf@engster.org> <83ppat84hk.fsf@gnu.org> <20150106143933.0090bc83@jabberwock.cb.piermont.com> <83r3v77ij6.fsf@gnu.org> <20150106154539.3d0752c4@jabberwock.cb.piermont.com> <87wq4ype3z.fsf@fencepost.gnu.org> <878uherlf3.fsf@wanadoo.es> <20150108194342.1bd83ed1@jabberwock.cb.piermont.com> <83egr45ogo.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1420813564 15613 80.91.229.3 (9 Jan 2015 14:26:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Jan 2015 14:26:04 +0000 (UTC) Cc: ofv@wanadoo.es, rms@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 09 15:25:58 2015 Return-path: Envelope-to: ged-emacs-devel@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 1Y9aPi-0003F7-HO for ged-emacs-devel@m.gmane.org; Fri, 09 Jan 2015 15:19:46 +0100 Original-Received: from localhost ([::1]:50812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9aPh-00086y-Vw for ged-emacs-devel@m.gmane.org; Fri, 09 Jan 2015 09:19:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9aNw-0006vr-OX for emacs-devel@gnu.org; Fri, 09 Jan 2015 09:17:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9aNv-0003tN-MW for emacs-devel@gnu.org; Fri, 09 Jan 2015 09:17:56 -0500 Original-Received: from hacklheber.piermont.com ([2001:470:30:84:e276:63ff:fe62:3400]:45770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9aNu-0003mh-2B; Fri, 09 Jan 2015 09:17:54 -0500 Original-Received: from snark.cb.piermont.com (localhost [127.0.0.1]) by hacklheber.piermont.com (Postfix) with ESMTP id 53776119; Fri, 9 Jan 2015 09:17:53 -0500 (EST) Original-Received: from jabberwock.cb.piermont.com (jabberwock.cb.piermont.com [10.160.2.107]) by snark.cb.piermont.com (Postfix) with ESMTP id 265702DEA0D; Fri, 9 Jan 2015 09:17:53 -0500 (EST) In-Reply-To: <83egr45ogo.fsf@gnu.org> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.25; x86_64-apple-darwin14.0.0) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:470:30:84:e276:63ff:fe62:3400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181098 Archived-At: On Fri, 09 Jan 2015 10:48:39 +0200 Eli Zaretskii wrote: > > Date: Thu, 8 Jan 2015 19:43:42 -0500 > > From: "Perry E. Metzger" > > Cc: =D3scar Fuentes , emacs-devel@gnu.org > >=20 > > There are refactorings that are impossible without statement level > > structure, such as semantic patches, that is, refactorings that > > are aware of higher level information such as "has this value that > > resulted from bar() being called been checked against NULL since > > the last call to foo(), and if not, bracket the variable it was > > assigned to in the following if statement...". >=20 > Can you show a concrete example of such refactoring? How much detail do you want? An obvious example of something of the flavor is this: you add an error return code to a function, and you then want to add code throughout the program to check for the error return code, but only if the error is possible from context. (For example, your call might have an optional parameter, and the error return might tell you that the optional parameter is invalid, but you only want to check for such a return if the optional parameter has been passed at all.) I could make up a synthetic example but I think most programmers have seen such things. A second, inverse example might be this: you find a bug caused by failing to check an error return code, and you would like to go through all your code looking for similar instances of the same call. There are thousands of such calls and almost all of them are correct, so you only want to see the ones where the error return code hasn't been checked for. Your search is then not on some short string but rather on a fairly arbitrary pattern over the AST. Again, I could make up a synthetic example, but I think most programmers have seen such things before. If it will help, though, I can invent an example. Perry --=20 Perry E. Metzger perry@piermont.com