is there anything good?

2 views
Skip to first unread message

Raoul Duke

unread,
Jun 1, 2022, 5:08:12 PM6/1/22
to pi...@googlegroups.com
"because history" seems to be the leaky truth about abstractions of new programming languages trying to still fit in with existing ecosystems. 

for example, are there languages & runtimes that help statically and dynamically prove and guarantee that addObserver() removeObserver() pairs will be absolutely correct, short of some intervening panic()? 

especially obviously in light of concurrency. 

David Barbour

unread,
Jun 2, 2022, 10:52:15 AM6/2/22
to pi...@googlegroups.com
API design has many of the same challenges as PL design. I would say that 'addObserver' is fine, but 'removeObserver' is a buggy API. 

Instead, like channels connecting to a remote service, we should be able to '.close()' the observer from the receiver's end, and the remote end should be able to '.check()' whether the observer is closed, and simply drop all the closed connections every time it's about to send an update.

Additionally, sending messages to a closed observer shouldn't be an error, will just drop the message then return.

This API is much more robust in context of concurrent connections and closing of connections. 
Reply all
Reply to author
Forward
0 new messages