[Ur] FFI and transactions
Robin Green
greenrd at greenrd.org
Sat May 28 14:02:34 EDT 2011
Hi,
Some FFI questions:
1. What is the difference between marking a function as effectful (or
benignEffectful) when writing an FFI function, and giving it a
transactional return type? Doesn't one have to do both - and if so, why
the redundancy?
2. In the manual it says benignEffectful is for effects which are local to
the session. Is this synonymous with request-local? I wouldn't expect it
to be - in my understanding of the terms request and session, a user can
make multiple simultaneous requests within a session.
3. What is the recommended way of passing back references to memory
dynamically allocated from foreign code to Ur/Web code - assuming that the
foreign code is going to *write* to that memory in future calls? Since
Ur/web ints are C long longs (which should be at least as wide as a
pointer, as far as I know) I guess casting a pointer to an Ur/web int and
returning that is OK - whereas returning a blob isn't, because that would
end up breaking purity on subsequent calls that write to the blob. I
assume that the function should return a transaction *and* be marked as
benignEffectful?
--
Robin
More information about the Ur
mailing list