Copyright © 2006-2011 Huiqing Li, Simon Thompson
Authors: Huiqing Li , Simon Thompson [web site: http://www.cs.kent.ac.uk/projects/wrangler].
Wrangler is an Erlang refactoring tool that supports interactive refactoring of Erlang programs. The current snapshot (Wrangler 0.9.2) is still a prototype, made available so that you can play with basic refactoring supports for Erlang programs, and give us feedback or bug reports.
Refactoring is the process of improving the design of a program without changing its external behaviour. While refactoring by hand is possible, tool support for refactoring is invaluable as it is more reliable, and allows refactoring to be done (or undone) easily. Wrangler is such a tool that supports interactive refactoring of Erlang programs. The current snapshot of Wrangler supports a number of basic Erlang refactorings, such as renaming of variable/function/module names, generalisation of a function definition, etc.
Built on top of the functionalities provided by the Erlang syntax-tools package, Wrangler is embedded in the Emacs editing environment, and makes use of the functionalities provided by Distel, an Emacs-based user interface toolkit for Erlang, to manage the communication between the refactoring tool and Emacs.
In collaboration with the Erlide team, we are now also in the process of integrating Wrangler with the Eclipse Environment.
Below is a snapshot of Wrangler embedded in Emacs, which shows a particular refactoring scenario. The user has selected the expression
io:format("Hello") in the definition of
repeat/1 , has chosen the Generalise Function Definition command from the Refactor sub-menu, and has just entered a new parameter name A in the mini-buffer.
The result of this refactoring is shown in the snapshot below.
Preview of the changes to be made by a refactoring is supported, and the user could choose to commit or abort the refactoring result after preview.
All the implemented refactorings are module-aware. In the case that a refactoring affects more than one module in the program, a message telling which files have been modified by the refactorer will be given after the refactoring has been successfully done. The Customize Wrangler command from the Refactor sub-menu allows the user to specify the boundary of the program, i.e. the directories that will be searched and analysed by the refactorer, as shown in the example snapshot below.
Undo is supported by the refactorer. Applying undo once will revert the program back to the status right before the last refactoring performed. However, PLEASE NOTE that the refactorer undo is currently separate from the Emacs undo, and undoing a refactoring will lose all the editing activities after the refactoring.
Below is a snapshot of Wrangler embedded in Eclipse + Erlide.
Wrangler makes use of functionalities provided by the
epp_dodger module from Erlang SyntaxTools to parse Erlang source code, and should be able to
refactor Erlang modules containing preprocessor directives and macro applications, as long as the macro definitions are syntactically "well-behaved".
Wrangler accepts Erlang programs with syntax errors or macro definitions that cannot be parsed by SyntaxTools. In the case that the program under consideration has syntax errors or unparsable macros, functions/attributes to which these syntax errors belong are not affected by the refactoring process, however warning messages asking for manual inspection of those parts of the program are given after the refactoring.
The current implementation of Wrangler does not support typed records and type specifications yet; functionalities to support these features are being added however.
Our Refactoring Functional Programs project website contains more information and references about refactoring functional, especially Haskell, programs; and our progress and ideas about refactoring Erlang programs are available at our FORSE project webpage.
Generated by EDoc, Jan 18 2011, 11:56:21.