- From: <bugzilla@wiggum.w3.org>
- Date: Wed, 06 Jan 2010 18:26:08 +0000
- To: public-qt-comments@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=8662 --- Comment #1 from John Snelson <john.snelson@oracle.com> 2010-01-06 18:26:08 --- 1) Construct to Define Local Recursive Functions --------------------------------------------- There are two related possibilities here: a. Allow definition of named, scoped, local functions, ie: declare function outer($a) { declare function f1($b) { $a, f2($b) }; declare function f2($b) { $b, f1($b) }; f1#1; }; b. Many functional languages have a recursive "let" whose variables are all in scope for any of the bound expressions: letrec $f1 := function($b) { $a, $f2($b) }, $f2 := function($b) { $b, $f1($b) } return $f1 I think I'm personally in favour of a solution like this. 2) Reference to self ----------------- I dislike the idea of a special named function which is only in scope sometimes, and has a different type signature depending on where it is in scope. If we went this route, I would prefer a special variable like $this or $self of type function(*), which contains a reference to the current function. Of course as you point out, this would not solve the mutually recursive function problem. 3) Recursive Global Variables -------------------------- Another (possibly tangential but related) issue is the rules about not allowing a global variable that references itself. It seems odd to allow this: declare function f() { 1, f() }; but not this: declare variable $f := 1, $f; Both the function f() and the variable $f evaluate perfectly well on an implementation using lazy evaluation. Maybe we could make our prolog rules simpler by allowing variables to refer to themselves. -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug.
Received on Wednesday, 6 January 2010 18:26:10 UTC