[Ur] Some more questions:
Adam Chlipala
adamc at impredicative.com
Fri Nov 5 17:28:02 EDT 2010
Marc Weber wrote:
> 1)
> When using channels is the data which still has to be sent to clients
> stored in databases? CGI / FASTCGI have multiple processes so there must
> be kind external storage, correct?
>
CGI doesn't support channels, while FastCGI involves multiple threads in
a single process. Pending channel sends are only stored in-memory and
would certainly be lost in a sudden crash.
> 2) abstract constructors?
> Chat example:
> datatype lines = End | Line of string * source lines
>
> basis.urs defines
> con source :: Type -> Type
> val source : t ::: Type -> t -> transaction (source t)
>
> I don't think I understand how its used yet. Is it taken from another
> language I could look it up from?
> Where is the implementation of that particular abstract constructor?
>
This constructor is, in effect, built into the language, though, for
convenience and simplicity, it is exposed through the signature of
[Basis]. Sources are like extended versions of [ref] types in ML;
they're mutable cells, and the extension is that they facilitate certain
kinds of automatic change propagation.
I tried to take the terminology from standard works on functional
reactive programming, so you might get some mileage out of reading
papers on that subject.
> 3)
> manual says #X is a field name.
>
> The demos contain code like this:
>
> <tr> <th>D:</th> <td><checkbox{#D}/></td> </tr>
> <tr> <th/> <td><submit action={add} value="Add Row"/></td> </tr>
>
> With some imagination you can understand that #D part of an imaginary
> record which is passed to add (?) - How do I know which record this
> field refers to?
>
Your imaginative intuition is a good one. Forms implicitly build up
records that represent all widget values. This record contains one
field for each widget, using the field name given at the point where
that widget is defined.
It's important to understand the code [#D] as a literal, just like [0]
or ["hi"]. The literal is not referring to any particular record.
> Thesee usages clearly show me that I don't understand anything:
>
> more/bid.ur
> <dyn signal={papers<- signal papers;
> return (List.mapX (fn (pid, extra, ints) => <xml>
> <hr/>
> #{[pid]}: {summarizePaper extra}:
>
I think here you're misled by a misparsing of the code. The '#' in this
example is a literal character to be shown to the user in HTML. It has
no connection with field literals.
> So which documentation to read to understand what's happening here ?
>
For readers familiar with formal semantics, the typing rules in the
manual should explain everything. For others, I think it's
unfortunately true that there isn't any accessible introduction yet. I
hope my clarifications in this thread can be sufficient.
You can do a lot with Ur/Web without understanding any of the details of
fields and records, beyond normal ML and Haskell features. It's
probably most practical to treat the forms notations as magic for now. ;)
More information about the Ur
mailing list