[Cuis-dev] A small experiment with OMeta as intepreter for push-pull streams (e.g. network)

Michał Olszewski miolszewski at outlook.com
Thu Jul 18 13:14:20 PDT 2024


Hi,

Thanks! I was inspired by VPRI's ascii art language for tcp/ip stack. I 
thought it would be interesting if you could read directly (i.e. not 
trying to read N bytes to in-memory buffer then actually parse it) from 
network stream; that is, keep parsing and putting messages 
asynchronously into a shared queue, as they go.

One thing that might be slightly worrying is additional indirection via 
BlockClosure evaluation, especially because it's valued in #everything 
method - the most fundamental rule for OMeta and might even further 
cripple performance for typical use cases.

The idea was born out of distraction, so I didn't bother significantly 
rewriting fetching the next element but I think it's possible to avoid 
it - or just put the feature as preference? Cheaper to check "if" than 
always send #value.

But hey, as was said some time ago: all problems in computer science can 
be solved by another level of indirection.

Cheers,
Michał

On 17.07.2024 03:47, Phil B wrote:
> Very cool, I'll look at merging these as well. I've found OMeta quite 
> useful over a network as well, though I tend to use higher level 
> protocols (right now I mainly just piggyback on http/https using 
> various 'web standards' to shuttle things back and forth which is 
> handy when you only control the client or server, but not both)  
> Things tend to get ugly when you start throwing network errors into 
> the mix, but if you're in a clean networking environment where things 
> are reliable/controlled, you could definitely have fun implementing 
> (or even defining new) protocols in OMeta.
>
> On Thu, Jun 20, 2024 at 10:18 AM Michał Olszewski via Cuis-dev 
> <cuis-dev at lists.cuis.st> wrote:
>
>     Hi all,
>
>     While working on a parser (uses text emphasis as part of the grammar
>     btw.) for my bachelor's streaming language, I've strayed a bit and
>     made
>     a really small and fun experiment with OMeta2 serving as
>     interpreter for
>     simple message format being received from a SocketStream, showing
>     versatility of OMeta in not just "local", finite pattern matching but
>     also from push-pull streams, like network sockets.
>
>     To enable it, I had to add small change to defer fetching next
>     element
>     from the stream.
>
>     I attached necessary package and workspace contents. You can git
>     clone
>     OMeta with above fix from my repo:
>     https://github.com/michalo1334/OMeta-Cuis
>
>     Tested in Cuis7.0.
>
>     Have fun!
>
>     Cheers,
>     Michał
>
>     Possible TODO: implement parser/msg constructor for simple binary
>     format
>     like MessagePack and do message passing between objects across
>     network.
>     Implement everything in OMeta :).
>     -- 
>     Cuis-dev mailing list
>     Cuis-dev at lists.cuis.st
>     https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240718/a64329a5/attachment.htm>


More information about the Cuis-dev mailing list