Your example is close to working properly. There are two "bugs" in your code, plus a few in the Ur/Web compiler that I've fixed in a patch pushed to the public Mercurial repo.

First, the bugs in your code:

The semantics of '-root' are such that your example here is compiled as though it were written in a single file like:
    structure Top = struct
        structure A = (* ... *)
        structure Main = (* ... *)
    end

The reference in Main.ur to [Top.A] would be dropped in literally, at the appropriate point above, making it an attempt to reference module [Top] recursively in its own definition. Ur/Web doesn't support recursive module definitions, so this is a variable reference error. Instead of [Top.A], you'd just write [A].

The other bug in your code is that [Top] is already a module from the standard library that is included and [open]ed in every project implicitly, so you wind up with some quite confusing name shadowing! I've patched the compiler to complain about such cases.

No one had used this '-root' business in quite a while, so I had to make two more small changes. One was to prevent an overzealous error message from a check that hadn't been tested with '-root'. The other change was to make '-root' support relative filesystem paths (as in your example), rather than just absolute.

On 09/23/2013 05:18 AM, Sergey Mironov wrote:
Hi. Looks like I can't trigger 'Alternate module naming convention' as
stated in the Manual. Here is my simple project:
.
├── App.urp
├── Makefile
└── src
     ├── A.ur
     ├── A.urs
     ├── Main.ur
     ├── Main.urs

Main.ur's content is just

fun main {} =
   t<- Top.A.amazingText {};
   return<xml>
             <head>
               <title>The page</title>
             </head>
             <body>
             {t}
             </body>
           </xml>

A.ur contains amazingText function returning some plain xbody. When I
invoke urweb as follows:

   $ urweb  -root Top src -dbms sqlite  App

it errors with

   /home/grwlf/proj/urdesign/src/Main.ur:3:7: (to 3:24) Unbound structure A

but

   $ urweb  -root Top src -dbms sqlite  App  -moduleOf src/A
   Top.A

Did I found a bug?

_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to