Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Last active August 29, 2015 14:17
Show Gist options
  • Save ELLIOTTCABLE/c85049e8ff7cee2f4111 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/c85049e8ff7cee2f4111 to your computer and use it in GitHub Desktop.
Non-Linear Paws
===============
In the original Paws design, control-flow was basically a *library function*. You'd call into
routines that would provide control-flw primitives. I want to try a Paws that makes control-flow
explicit within your code; that makes it a first-class citizen.
I'm concerned on what this does for code-coherence and programmer intuition; I'm not sure complex
control-flow graphs encoded *directly* are going to result in comprehendable code. >,>
Simultaneously, I want to try a major overhaul of the data system. Frankly, I consider that a less
sweeping change; Paws' crucial concepts have always been rather disconnected from the type-system /
object-orientation portions. (Specifically, I'm considering an ‘everything's callable’ /
‘everything's code’ approach; something with pattern-matching(?) to provide a speedy equivalent of a
hash-table.) At the most basic level, everything would now devolve to a ‘message’ (in Smalltalk
nomenclature.)
Syntax
------
Not all possible graphs are encodable in the “linear form” (I suspect a linear encoding of a graph
without names is provably impossible, anyway.) Instead of striving to make most graphs serializable,
I've striven to make the most common *dependency graphs* (what this is built for anyway), easy to
write.
... foo :: as with Paws, basically any bare token in a stream of text is a ‘word.’
Words have a (right-hand) ‘value’ of themselves as a `Label`.
... blahblah foo :: also as in Paws, the ‘result’ (value as left-hand-side) of a word, is the
‘response’ received to a message: the value of this word, sent to the
result of the *previous* token. This introduces a ‘result-dependancy’ on
that previous message.
foo :: the value-as-left-hand (‘result’) of the *first* ‘word’ in an expression
(thus, one without a series of ‘previous’ results, for the above),
instead dispatches a message to the current `environment` object. This
introduces a new dependancy ‘root’ for this `execution`.
... { foo } :: routines are serialized as an `execution` literal. The expression(s)
<within></within>
literal itself has a value of an execution *at the start of the body*.
... blahblah [foo] :: an expression (or expressions) within brackets are made ‘effect-
dependant’ on the preceeding element,
... bar [foo] baz :: ... but has no value, and thus is invisible to following elements with
result-dependancy on their predecessors. (Instead, they will be dependant
on the closest prior element *with* a value.)
... blahblah (foo) :: parenthesis indicate ‘composition’ (using a left-hand ‘result’ as a
right-hand ‘value.’) The *result* of the composed expression(s) is used
as the right-hand-side *value*, sent as a message to the result of the
previous element (the left-hand-side.) This indicates a “merging point”,
... bar (foo) baz :: ... since this is the only way an element (the one following the
composition) can effectively have result-dependency on *two* nodes.
foo ..., bar ... :: a new expression can be introduced with a comma; this introduces a
‘effect-dependancy’ on the previous expression at the same level.
foo ...; bar ... :: likewise, introducing an expression with a semicolon implies no
dependency-connection with the former expression. (If no dependency is
imposed by a higher-level expression, then that implies the new
expression is also a dependency root.)
Examples
--------
Uses result of:
foo bar foo bar baz ━━━━━━━━━━━━━━━━━━━▶
╱*foo ━┓ ╲ ╱*foo ━▶ bar ━▶ baz ╲ Waits on completion:
╲ ┗━▶ bar ╱ ╲ ╱ ═══════════════════▷
foo [bar] baz foo [bar widget] baz foo [bar] [widget] baz
╱*foo ━━▶ baz ╲ ╱*foo ━━━━━━━━▶ baz ╲ ╱*foo ━━━━━━━━▶ baz ╲
▏ ║ ▕ ▏ ║ ▕ ▏ ║ ▕
╲ ╚▷ bar ╱ ╲ ╚▷ bar ━▶ widget ╱ ╲ ╚▷ bar ═▷ widget ╱
foo [bar, widget] baz foo [bar; widget] baz foo goo; bar [baz], widget
╱*foo ━━━━━━━━▶ baz ╲ ╱*foo ━━━━▶ baz ╲ ╱ *foo ━━━━━━▶ goo ╲
▏ ║ ▕ ▏ ╠═══▷ widget ▕ ▏ *bar ══════▷ baz ▕
╲ ╚▷ bar ═▷ widget ╱ ▏ ▽ ▕ ╲ widget ◁═╝ ╱
╲ bar ╱
foo (bar) baz foo (bar widget) baz foo (bar) (widget) baz
╱*foo ━◆━▶ baz ╲ ╱*foo ━━━━━━━━━━━◆▶ baz ╲ ╱*foo ━━━◆━◆━▶ baz ╲
╲*bar ━┛ ╱ ▏ ┃ ▕ ▏*bar ━━━┛ ┃ ▕
╲*bar ━▶ widget ━┛ ╱ ╲*widget ━━┛ ╱
inf execution stage~ (inf affix~ (locals)) (inf empty~),
inf execution stage~ (inf own~ (locals)) (inf length~ (locals))
╱*inf ━▶ execution ━▶ stage ━▶ @self ━━━━━━━◆━━◆━◆═╗╲
▏ *inf ━▶ affix ━▶ @self ━━━◆━┛ ┃ ║▕
▏ *locals ━┛ ┃ ║▕
▏ *inf ━▶ empty ━▶ @self ━━━━━━━━┛ ║▕
╔═══════════════════════════════════════════════════╝▕
╚▶ inf ━▶ execution ━▶ stage ━▶ @self ━━━━━━━◆━━◆━◆ ▕
▏ *inf ━▶ own ━▶ @self ━━━◆━┛ ┃ ▕
▏ *locals ━┛ ┃ ▕
▏ *inf ━▶ length ━▶ @self ━━━◆━━━━┛ ▕
╲ *locals ━┛ ╱
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment