User Tools

Site Tools


notes:sycl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
notes:sycl [2026/09/14 08:05] – created emerynotes:sycl [2026/09/15 12:55] (current) – [Syndicate] typo emery
Line 1: Line 1:
 ====== Sycl ====== ====== Sycl ======
  
-Sycl is the Tcl implementation of the [[.:syndicate|Syndicated Actor Model]].+[[https://git.syndicate-lang.org/ehmry/sycl|Sycl]] is the Tcl implementation of the [[.:syndicate|Syndicated Actor Model]].
  
-https://git.syndicate-lang.org/ehmry/sycl+Sycl is comprised of the ''preserves'' and ''syndicate'' libraries.
  
-Example programs:+==== Preserves ==== 
 + 
 +A Tcl interpreter extension((https://git.syndicate-lang.org/ehmry/sycl/src/branch/trunk/preserves.md)) implemented in [[Nim]]. 
 +Preserves((https://preserves.dev/)) is the data language used by Syndicate. 
 +Preserves can be written in text syntax, which the interpreter extension 
 +can parse automatically from Tcl strings. 
 +Preserves also has a binary syntax, which the Syndicate library uses for communicating over a network. 
 + 
 +Preserves text syntax is a superset of JSON, so the library also acts as a JSON parser. The library can render to JSON as well, but some type conversions are made.  
 + 
 +<code tcl> 
 +package require preserves 
 + 
 +set pr [preserves parse {{foo: 0 bar: 1}}] 
 +# {bar: 1 foo: 0} 
 + 
 +preserves render $pr 
 +# {bar: 1 foo: 0} 
 + 
 +preserves render -json $pr 
 +# {"bar":1,"foo":0} 
 +</code> 
 + 
 +==== Syndicate ==== 
 + 
 +The Syndicate library((https://git.syndicate-lang.org/ehmry/sycl/src/branch/trunk/syndicate.md)) is almost pure Tcl and makes heavy use of namespaces. 
 + 
 +The library supports a SAM facet((https://synit.org/book/glossary.html#facet)) tree using nested namespaces. The ''during'' proc (equivalent to ''When'') executes its handle script in a new namespace on every match, and when the ''during'' statement expires the namespaces are destroyed automatically. 
 + 
 +=== Relaying === 
 + 
 +The library does not implement [[.:syndicate#dataspaces|dataspaces]]. 
 +It can however communicate with external dataspaces provided by ''syndicate-server'' from the Rust implementation((https://git.syndicate-lang.org/syndicate-lang/syndicate-rs)). 
 + 
 +<code tcl> 
 +package require syndicate 
 + 
 +set route {<route [<tcp "localhost" 4567>]>
 + 
 +syndicate::spawn exampleActor { 
 + 
 +    connect $route remoteDataspace { 
 +        setDefaultTarget $remoteDataspace 
 +         
 +        assert [list hello world] 
 +         
 +        during "[weather is @weather #?]" { 
 +            puts "Weather at $::route is $weather." 
 +        }  
 +    } 
 +
 + 
 +vwait ${exampleActor}::stopped 
 +</code> 
 + 
 +=== Patterns === 
 + 
 +Patterns for matching SAM assertions are written as strings. 
 +The pattern ''@z #([@x #? #_ @y #?])'' would match against ''[foo baz bar]'' and could trigger a handler bindings equivalent to: 
 +<code tcl> 
 +set x foo 
 +set y bar 
 +set z [list foo bar baz] 
 +</code> 
 + 
 +===== Availability ===== 
 + 
 +Sycl is only known to have been built with the [[Nix]] package manager, but Nix can work on practically any Linux distro. 
 +Sycl is compatible with Tcl 8 & 9. 
 + 
 +===== Example programs =====
  
   * [[.:synit|Synit]] service utility: https://git.syndicate-lang.org/synit/synit-service   * [[.:synit|Synit]] service utility: https://git.syndicate-lang.org/synit/synit-service
 +  * [[.:synit|Synit]] network-configurator: https://git.syndicate-lang.org/synit/synit-network-utils/src/branch/trunk/network-configurator.tcl
  
notes/sycl.1789373135.txt.gz · Last modified: by emery

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki