[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs contributions, C and Lisp
From: |
Perry E. Metzger |
Subject: |
Re: Emacs contributions, C and Lisp |
Date: |
Fri, 9 Jan 2015 09:17:52 -0500 |
On Fri, 09 Jan 2015 10:48:39 +0200 Eli Zaretskii <address@hidden> wrote:
> > Date: Thu, 8 Jan 2015 19:43:42 -0500
> > From: "Perry E. Metzger" <address@hidden>
> > Cc: Óscar Fuentes <address@hidden>, address@hidden
> >
> > 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...".
>
> 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
--
Perry E. Metzger address@hidden
- Re: Emacs contributions, C and Lisp, (continued)
- Re: Emacs contributions, C and Lisp, David Kastrup, 2015/01/07
- Re: Emacs contributions, C and Lisp, Richard Stallman, 2015/01/07
- Re: Emacs contributions, C and Lisp, Óscar Fuentes, 2015/01/07
- Re: Emacs contributions, C and Lisp, Richard Stallman, 2015/01/08
- Re: Emacs contributions, C and Lisp, Óscar Fuentes, 2015/01/08
- Re: Emacs contributions, C and Lisp, Eli Zaretskii, 2015/01/09
- Re: Emacs contributions, C and Lisp, Richard Stallman, 2015/01/09
- Re: Emacs contributions, C and Lisp, Perry E. Metzger, 2015/01/09
- Re: Emacs contributions, C and Lisp, Perry E. Metzger, 2015/01/08
- Re: Emacs contributions, C and Lisp, Eli Zaretskii, 2015/01/09
- Re: Emacs contributions, C and Lisp,
Perry E. Metzger <=
- Re: Emacs contributions, C and Lisp, Richard Stallman, 2015/01/09
- Re: Emacs contributions, C and Lisp, Perry E. Metzger, 2015/01/09
- Re: Emacs contributions, C and Lisp, Richard Stallman, 2015/01/10
- Re: Emacs contributions, C and Lisp, Daniel Colascione, 2015/01/10
- Re: Emacs contributions, C and Lisp, Richard Stallman, 2015/01/12
- Re: Emacs contributions, C and Lisp, Perry E. Metzger, 2015/01/10
- Re: Emacs contributions, C and Lisp, David Kastrup, 2015/01/10
- Re: Emacs contributions, C and Lisp, Thien-Thi Nguyen, 2015/01/11
- Re: Emacs contributions, C and Lisp, David Kastrup, 2015/01/09
- Re: Emacs contributions, C and Lisp, Eli Zaretskii, 2015/01/09