[nem-en] nested local fun with same name

Dmitry Ivankov divanorama at gmail.com
Fri Mar 23 15:17:06 CET 2007


What are the rules for local functions with the same name?
1) Can there be 2 functions at the same level? (seems that it's true)
Like
def f () {};
..
def f () {smth};
2) Can we do "def x=..; def x = x + 1" with functions?
Like
def f () {};
def f () { f(); smth }; //for now it's infinite loop
3) Can we "def f (){} and f (x){} and g (){};"? Choosing function
by number of arguments.
4) Almost the same as 3, but with nested functions
def f (x,y) {
 def f (x) { f (x, y); } //it won't compile, but  def f = fun (x) { f (x,
y); }  will work as supposed
 if (x == 0)
  y
 else
  f(x - 1) + y
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20070323/525cb4e2/attachment.html


More information about the devel-en mailing list