Fredrik Roos wrote:
I've been experimenting with Ur for a while and I must say it's
impressive work. One serious drawback i have noticed though is the
lack of recursive modules. Given the way urls work in Ur, the module
structure must correspond to the link structure on the website. And
since websites almost always have a graph structure as opposed to a
tree structure, Ur's hierarchal module system becomes an issue.
The workaround for this is putting almost all
url-addressable functions in the toplevel module in a recursive
function definition. And if you want to reference these functions you
either has to put that code in the toplevel module, or pass down
references to them.
The theory of recursive modules scares me. :-) They just seem so
complicated!
I'm well familiar with the problem you mention. I have something of a
"design pattern" I use to get around it. Specifically, I write some
URL-accessible functions to take other URL-accessible functions as
arguments. This way, you can "tie the knot" with usual, value-level
recursion. The compiler is very aggressive about specializing functions
to remove higher-order features, so these extra arguments go away in the
compiled code.
Not the nicest thing, but it's worked for me so far. This is yet
another item to make sure I include in the tutorial I should write Real
Soon Now. :D
It occurs to me that it might be not-so-scary to support recursive
modules that don't use recursion to define types. Maybe I'll try it
some time.
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur