Paolo Veronelli wrote:
I'm working around a ad hoc version of Ports for my project to filter
out unwanted messages.
From
http://www.mozart-oz.org/documentation/tutorial/node9.html#section.stateful.port
I'm hacking the Figure 9.3
(Looks like Chunk.hasFeature produce an error)
Chunk.hasFeature does not exist. It's Value.hasFeature.
Is that an asynchronous Send?
Yes.
Mine should be
proc {Send P M} Mr in
lock Lock then
if {IsRecord M} andthen
for A in {Arity M} default:true return:R do
for V in {Dictionary.condGet Validators A [(fun {$ R} true
end)]} do
if {Not {V M}} then {R false} end
end
end
then M|!!Mr = (P.Name):= Mr end
end
end
Side remark: beware about variable names. Never call a list List, a
lock Lock, or a name Name, because those are module names. (You don't
call yourself "Human", right? ;-)
Note that you can use a real port for putting the message on the stream.
Simply replace the cell exchange by something like
{Port.send P.port M}
IMO the caller will wait for the procedure to complete ....
Exactly. If you don't want the caller to wait, you should send the
message, and filter the stream afterwards.
What happens when I produce that procedure on the internet as a
service.Will it be async?
Yes, provided you use a real port as I suggested above. This is because
distributed cells behave differently. Ports are more efficient.
Cheers,
raph
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users