So, do we have a timetable for when the Perl 6 interpreter is going
handle closures?

Also, consider the following:

  sub fac($n) {
    when 0  { 1 }
    default { $n * fac($n - 1) }
  }

  print1 fac(10);

Compiling this barfs because there's 'no topic in fac', despite the
apocalypse stating that the first argument to a function shall be the
default topic. So, putting in an explicit 'given', we have:

  sub fac($n) {
    given $n {
      when 0  { 1 }
      default { $n * fac($n - 1) }
    }
  }

  print1 fac(10);

Which throws a runtime 'Wrong type on top of stack!' error. 

So, am I doing something utterly wrong, or is it really impossible to
write recursive functions with the current perl6 compiler?

-- 
Piers

   "It is a truth universally acknowledged that a language in
    possession of a rich syntax must be in need of a rewrite."
         -- Jane Austen?

Reply via email to