[Ur] interfacing with C or other languages - example system

Marc Weber marco-oweber at gmx.de
Sun Nov 28 15:24:27 EST 2010


> Just to repeat what I said the last time someone brought this up: it is 
> impossible to support this in Ur/Web in the most general way, without 
> allowing for the possibility of some crazy behavior.  The runtime system 
> feels free to restart program execution at any time, which wouldn't work 
> well with effectful commands that can't be undone.
Error triggers unlimited retry: Couldn't allocate new heap chunk contiguously

So it seems urweb tries with small heap and if everything fails it
retries with more?

> Currently, Ur/Web doesn't allow C FFI functions to return values in 
> algebraic datatypes besides those that can be represented with C enums.  
> However, you can easily provide the same set of operations (as 
> additional C FFI functions) on a new abstract type.
I think it would be cool if you could hardcode record types such as
  result.blob
  result.code

By reading existing code I came to the same conclusion.
You can find the results here:

http://gitorious.org/some-urweb-utility-libraries/uw-process
It includes a test case which triggers the retry shown above.

Right now I want to use it to outsource some jobs urweb can't do
natively yet.

I'd love to add additional information such as "time out while waiting
for cmd sleep 2h" which will be very helpful. But you don't expose ctx using
the urweb.h file, do you? and the check function does not accept
additional strings as parameters.

I'll add a library section to the wiki.

Marc Weber



More information about the Ur mailing list