====== Inspirations and historical connections for the folk programming language ====== ===== Note ===== //**Note**:// there are more recent, direct ''folk'' inspiration papers we reference in the //[[https://folk.computer/links#programming-language-db-implementation|Programming language & DB implementation ]]// section of our **[[https://folk.computer/links|links page]]**. What follows below is **Andrés' attempt** to ground our recent (from ~2005 - 2025) citations to the deeper history of programming language design. ===== The historical roots of Wish, When, and Claim ===== ==== When ==== * The journey to a ''When'' statement begins with the foundational work on event-driven programming in [[https://wiki.squeak.org/squeak/uploads/400/Smalltalk-76.pdf|Smalltalk-76 (Ingalls, 1978)]], which established a model where objects communicated by sending messages, a precursor to modern event handling. * This was refined in [[https://archive.org/details/smalltalk80langu00gold|Smalltalk-80 (Goldberg & Robson, 1983)]] with its Model-View-Controller (MVC) architecture, where user actions (events) in the View would trigger changes in the Model. * Concurrently, the AI community was developing [[https://en.wikipedia.org/wiki/OPS5|production systems like OPS5 (Forgy, 1981)]], which used explicit ''IF-THEN'' rules that reacted to changes in a central "working memory." * This reactive, rule-based approach was formalized in databases through [[https://www.sciencedirect.com/topics/computer-science/event-condition-action-rule|Event-Condition-Action (ECA) rules (Dayal et al., 1988)]] and given a temporal dimension in [[https://www.sciencedirect.com/science/article/pii/S0747717189800707|temporal logic programming (Abadi & Manna, 1989)]]. * A parallel technique emerged from [[https://dl.acm.org/doi/10.1145/2144.2145|Linda (Gelernter, 1985)]], where processes could wait for data patterns (using ''in''/''rd'') in a shared "tuple space," directly demonstrating a "when this pattern exists, then proceed" model. * These distinct threads—object-oriented event handling + AI rule-based reactions, database triggers, and pattern-matching coordination — all converged on the core idea of a system that declaratively waits for a condition to become true before executing a behavior. This lineage culminates in modern constructs like the ''When'' statement in ''folk'' — realtime execution in reaction to database updates rather than the traditional imperative ''if'' statement. ==== Wish ==== * [[https://www.researchgate.net/publication/234779982_The_Semantics_of_Predicate_Logic_as_a_Programming_Language|The Semantics of Predicate Logic as a Programming Language (Kowalski, 1983)]] * Without this 10 page (!) paper we wouldn't have modern logic programming, the foundation of the ability to ''Wish'' into a shared reactive database in Folk * [[https://dl.acm.org/doi/10.1145/383779.383823#:~:text=his%20influential%20dictum,of%20logic%20programs.|As ACM noted in 2001]] when awarding Kowalski the Lovelace Medal: "his influential dictum ''Algorithm+Logic=Control'' has shaped our views on the essence of declarative programming within the logic programming framework and has had a large impact on the design of new control mechanisms for this approach to programming. His subsequent research revealed the rich potential of the logic programming paradigm. He showed how legal, metalevel, and commonsense reasoning can naturally be formalized by means of logic programs." * This paradigm was first realized in [[https://en.wikipedia.org/wiki/Prolog|Prolog (Colmerauer, 1972)]] and later specialized for database queries in [[https://en.wikipedia.org/wiki/Datalog|Datalog]], which provided the "shared database" component of our modern model. It was further generalized by [[https://dl.acm.org/doi/abs/10.1145/41625.41635|Constraint Logic Programming (Jaffar & Lassez, 1987)]], which expanded the expressive power of these declarative goals. * Together, these systems form the heritage of ''Wish'': a declarative, goal-seeking mechanism for interacting with a logical model of the world. ==== Claim ==== * ''Claim'' can be traced back to Bertrand Meyer's "Design by Contract" (DbC), a core feature in the design of the [[https://en.wikipedia.org/wiki/Eiffel_(programming_language)|Eiffel programming language]] first outlined in [[https://se.inf.ethz.ch/~meyer/publications/computer/contract.pdf|a 1986 article]]. * Design by Contract formalizes software modules using three types of assertions: preconditions (''require''), postconditions (''ensure''), and invariants. These ''Claims'' form a rigorous, checkable contract between a component and its clients. * The theoretical groundwork for DbC was laid even earlier by work on formal verification. C.A.R. Hoare's axiomatic semantics, or [[https://en.wikipedia.org/wiki/Hoare_logic|Hoare Logic (1969)]], used pre- and post-condition triples, `{P} C {Q}`, to logically prove program correctness. * While formal verification was often heavyweight, Meyer's DbC provided a pragmatic way to apply these ideas to everyday programming. This approach has since influenced assertion and contract features in many languages, including Ada, D, Clojure, and Python's type hinting system. * ''Claim'' is the direct descendant of this tradition, providing a lightweight but powerful way to assert formal guarantees about a program's behavior at runtime. ===== Dynamicland | Realtalk ===== * [[https://cwervo.com/|Andrés]] and [[https://omar.website/|Omar]] met at Dynamicland in 2017, their experiences with Dynamicland's [[https://omar.website/posts/notes-from-dynamicland-geokit/#background-on-realtalk|Realtalk]] (a superset of [[https://www.lua.org/|Lua]]) being an inspiration for the [[https://github.com/FolkComputer/folk/commit/16e07238b593c0a2253bc29deb117061b3427f8d|creation of folk in 2022]]. ==== Realtalk 2017 ==== * [[https://dynamicland.org/archive/2017/Realtalk|Realtalk 2017]] * Omar spent a few years as a volunteer and then a researcher at Dynamicland and built many things at Dynamicland including, but not limited to: * [[https://dynamicland.org/archive/2020/Web_browser|A web browser]] * [[https://dynamicland.org/archive/2018/Geokit|Geokit]] (more context [https://omar.website/posts/notes-from-dynamicland-geokit/|in the form a fantastic blog post from Omar]) * [[https://dynamicland.org/archive/2018/Pi_bots|Pi bots]] — Raspberry Pis on wheels that got their instructions to drive from programs placed on the table * [[https://dynamicland.org/archive/2019/Clause_cards|Clause cards]] (see also: [[https://dynamicland.org/archive/2019/Clause_card_music_sequencer|a musical sequencer built with clause cards]] * [[https://dynamicland.org/archive/2019/Zone_timelines|Zone timelines]] * [[https://dynamicland.org/archive/2019/Dynalamps|Dynalamps]] * Andrés was a volunteer at Dynamicland from 2017 to 2019, teaching workshops on Realtalk, giving tours, and writing in Realtalk to make [[https://dynamicland.org/archive/2017/ILLUMINATION_booklet|this "book for learning to draw pictures in Realtalk. Each page is a sample program intended to be edited in place."]], [[https://dynamicland.org/archive/2018/IAMBICland|IAMBICland]] (a program to display [[https://www.opensourceshakespeare.org/views/sonnets/sonnets.php|all 154 of Shakespeare's sonnets]] by placing cubes in the ones, tens, and hundreds position of a number-selector-page), and [[https://cwervo.com/projects/dynamicland-experiments|a few other things.]] * While we initially were inspired by the Realtalk paradigm, there are hundreds of influences in [[https://steshaw.org/plt/|programming language theory]] and, in particular, the [[https://prologhub.com/50-years-prolog-and-beyond/|history of ProLog]], with particular attention to the influences in the //[[https://folk.computer/links#programming-language-db-implementation|Programming language & DB implementation ]]// of our [[https://folk.computer/links|links page]] * Both ''folk'' and ''Realtalk'' are reactive DB systems implemented as [[https://en.wikipedia.org/wiki/Metaprogramming|metalangauges]] (in Lua and Tcl, respectively)*, though they have diverged in their implementation of [[https://github.com/FolkComputer/folk/tree/main/virtual-programs|OS primitives]] and the [[https://folk.computer/guides/what-folk-can-do|functionality]] as a result of Folk being in New York City, with a different group of people and concerns about what programs are possible in this tangible paradigm. * ''*'' * ''folk'''s architecture: * [[https://www.tcl-lang.org/about/|Tcl]] & C language internals * Fiducial: [[https://compileralchemy.substack.com/p/apriltags-why-robotics-invented-its|AprilTags]] * Realtalk (2017)'s architecture: * Lua core, Lua JIT with C * Fiducial: [[https://dynamicland.org/archive/2017/Dotframes|custom dot recognizer known as "dotframes"]]