\documentclass{icai}
\begin{document}
%_______________________________________________________________________
\title{Static rules for variable scoping in Erlang}
\thanks{Supported by GVOP-3.3.3-2004-07-0005/3.0 ELTE IKKK
    and Ericsson Hungary}
\author{L\'aszl\'o L\"ovei, Zolt\'an Horv\'ath,
    Tam\'as Kozsik, Roland Kir\'aly}
\institute{Department of Programming Languages and Compilers \\
Faculty of Informatics \\
E\"otv\"os Lor\'and University, Budapest }
%\address{\textbf{Thomas Brown}\\ address of institute\AND
%         \textbf{John Taylor}\\ address of institute}
%_______________________________________________________________________
\begin{ICAIpaper}
\begin{abstract}
Erlang/OTP is a functional programming environment
designed for building concurrent and distributed
fault-tolerant systems with soft real-time characteristics (like
telecommunication systems). The core Erlang language consists of simple
functional constructs extended with message passing to handle concurrency, and
OTP is a set of design principles and libraries that supports building
fault-tolerant systems. The language has a very strong dynamic nature that
partly comes from concurrency and partly from dynamic language features.

Refactoring is a programming technique for improving the design of a program
without changing its behaviour.  In other words, you clean up your code but do
not change what it does. Refactoring may precede a program modification or
extension, preparing the program for the modification, or may be used after
finishing the work in order to bring the program into a nicer shape. The
transformations of refactoring can be used for optimisation as well.

Most of the refactorings Erlang are concerned about variables in some way.
Erlang programs mainly consist of expressions, and expressions can use and
define variables almost anywhere. The meaning of variables in an expression
depends on its context, so the relation of the variables and the context of
the expression must be maintained during a refactoring, otherwise the meaning
of the modified program text would differ from the original.

The relation of variables and expressions is defined in terms of visibility
rules. An expression can only use visible variables, and the visibility of
variables begins with their creation, often in an expression. Every
refactoring that works with variables or expressions must be able to determine
the exact visibility region of every variable.

The exact semantical rules defining variable visibility are given in
\cite{erlspec}, using input and output contexts for every language construct,
which is hard to follow and not really helpful in defining the conditions of a
refactoring. We have created a more compact definition which is suitable for
verifying refactoring conditions.

%\keywords 
%\AMSclassificationnumber
\end{abstract}

\begin{thebibliography}{x}\SizeOfReferences

\bibitem{refactor}
M.~Fowler, K.~Beck, J.~Brant, W.~Opdyke, and D.~Roberts.
\newblock {\em Refactoring: Improving the Design of Existing Code}.
\newblock Addison-Wesley, 1999.

\bibitem{refactsite}
Martin {Fowler}'s refactoring site.
\newblock http://www.refactoring.com/.

\bibitem{hare}
H.~Li, C.~Reinke, and S.~Thompson.
\newblock Tool support for refactoring functional programs.
\newblock {\em Haskell Workshop: Proceedings of the ACM SIGPLAN workshop on
  Haskell, Uppsala, Sweden}, pages 27--38, 2003.

\bibitem{cleanref}
R.~Szab\'o-Nacsa, P.~Divi\'anszky, and Z.~Horv\'ath.
\newblock Prototype environment for refactoring {C}lean programs.
\newblock In {\em The Fourth Conference of PhD Students in Computer Science
  (CSCS 2004), Szeged, Hungary, July 1--4}, 2004.

\bibitem{cleanrefdb}
P.~Divi\'anszky, R.~Szab\'o-Nacsa, and Z.~Horv\'ath.
\newblock Refactoring via database representation.
\newblock In L.~Cs\H{o}ke, P.~Olajos, P.~Szigetv\'ary, and T.~T\'om\'acs,
  editors, {\em The Sixth International Conference on Applied Informatics (ICAI
  2004), Eger, Hungary}, volume~1, page 129.

\bibitem{erlang}
J.~Armstrong, R.~Virding, M.~Williams, and C.~Wikstrom.
\newblock {\em Concurrent Programming in Erlang}.
\newblock Prentice Hall, 1996.

\bibitem{erlfault}
J.~Armstrong.
\newblock {\em Making reliable distributed systems in the presence of software
  errors}.
\newblock PhD thesis, The Royal Institute of Technology, Stockholm, Sweden,
  December 2003.

\bibitem{erlspec}
J.~Barklund and R.~Virding.
\newblock {\em Erlang Reference Manual}, 1999.
\newblock Available from http://www.erlang.org/download/erl{\_}spec47.ps.gz.

\end{thebibliography}
\end{ICAIpaper}
\end{document}
