<cloudhead>
hopefully the architecture will actually not suck though :D
<alexgordon>
I'm transfixed by the rivers of colons
<cloudhead>
hahaha
<cloudhead>
that's THE INTERNET
<alexgordon>
actually, rivers of colons sounds like a sign of the apocalypse
<cloudhead>
:<
<alexgordon>
AND THE RIVERS SHALL BECOME COLONS
<cloudhead>
D:
<alexgordon>
internet is definitely full of shit
<alexgordon>
so in that sense it's accurate
<pikajude>
the internet is 100% shit
<cloudhead>
wish it was animated
<cloudhead>
like, the colons could move
<cloudhead>
hmm I don't know if I should watch a movie now
<cloudhead>
or play another game of dota
<cloudhead>
or do something entirely different
<pikajude>
i'm playing a game of go to the gym
<cloudhead>
:<
<cloudhead>
I hate the gym
<cloudhead>
well I've only been once
<cloudhead>
but I hate it
* alexgordon
tries to figure out what loops are
<cloudhead>
at first I thought you meant, you were playing a game of go /on your way/ to the gym
<pikajude>
no
<pikajude>
i'm playing a game of
<pikajude>
The Gym
<cloudhead>
yrsh
<pikajude>
i love the gym
<cloudhead>
yeah
<cloudhead>
oh, well that's merry then
<alexgordon>
loops are definitely not functions
<cloudhead>
loops
<alexgordon>
I guess they are macros?
<cloudhead>
loops are a mental construct
<cloudhead>
they do not appear anywhere in the world at large
<alexgordon>
xD
<cloudhead>
everyone knows the only true loop is the tail-call recursive loop
<alexgordon>
madman!
<cloudhead>
other than that, they are just gotos
<cloudhead>
JMP!
<alexgordon>
what if you had like a... goto container
<cloudhead>
:O
<alexgordon>
then your macros could compile loops down to that
<cloudhead>
you should implement loops as syntax sugar to gotos
<pikajude>
yeah, create a docker image for loops
<cloudhead>
haha
<pikajude>
oh wait
<pikajude>
that's not what you meant
<cloudhead>
OH WAIT
<cloudhead>
it exists already
<alexgordon>
it does?
<cloudhead>
I mean
<cloudhead>
people have used docker containers for less than that
<cloudhead>
alexgordon: I think it makes more sense to just implement loops as a primitive
<cloudhead>
unless you are building a vm
<alexgordon>
well
<alexgordon>
I'm lazy
<cloudhead>
in which case you can build jump as a primitive
<alexgordon>
and so I want to write as little code as possible
<cloudhead>
then implement conditional jump
<cloudhead>
and you're done
<alexgordon>
also I've set myself a challenge to make everything with macros
<cloudhead>
oh
<cloudhead>
:/
<alexgordon>
no, it's cool!
<cloudhead>
can you make macros with macros
<alexgordon>
yes of course
<cloudhead>
cool
<alexgordon>
I was explaining it to micah but I think he was bored
<alexgordon>
cloudhead: basically a macro is just a generator
<alexgordon>
of code bits
<alexgordon>
CODE BITS
<cloudhead>
code bits, I like that
<cloudhead>
add some milk
<cloudhead>
put them in a bowl
<alexgordon>
this is actually much more difficult to explain than it is to write
<cloudhead>
is it similar to any system I might know
<alexgordon>
don't think so
<alexgordon>
but basically the idea is that you just merge all the tree structures in a compiler into one "code tree"
<cloudhead>
also, where's the code for this!?
<alexgordon>
lisp?
<alexgordon>
it's similar to lisp
<cloudhead>
ok
<cloudhead>
I know a little bit about the lisp macro system
<alexgordon>
it's not like that
<alexgordon>
:P
<cloudhead>
ok
<cloudhead>
no, the code for your language!
<alexgordon>
it's not on the internet
<cloudhead>
:O
<cloudhead>
are you like stallman
<cloudhead>
hiding the code in your beard
<alexgordon>
yeah I emailed all of github to myself
<cloudhead>
nice
<pikajude>
same
<cloudhead>
make sure you print it
<cloudhead>
to keep a copy
<alexgordon>
cloudhead: so basically the "code tree" exists in different states of compilation at once
<cloudhead>
ok yeah
<alexgordon>
some bits haven't been lexed, whereas other bits have been parsed
<cloudhead>
oh I see
<alexgordon>
which is different to lisp, which at least bothers to lex the whole program first
<cloudhead>
so parts of the tree are just c strings
<alexgordon>
yes
<cloudhead>
nice
<pikajude>
you can do that in coq
<pikajude>
with defining like
<pikajude>
new syntax bits
<pikajude>
in code
<pikajude>
which is crazy to me
<pikajude>
because it's not like everything is sexprs
<cloudhead>
actually this reminds me of TCL
<alexgordon>
oh god
<pikajude>
it just sounds damn complicated
<cloudhead>
TCL is great
<alexgordon>
damning with faint damning
<cloudhead>
"everything is a string"
<cloudhead>
that was autological
<cloudhead>
:D
<alexgordon>
cloudhead: it's like peeling an onion. it lexes the first layer first, then it parses it and applies macros. these macros then go and lex _their_ part of the source code, ad infinitum
<cloudhead>
ah yes
<cloudhead>
I saw this coming
<cloudhead>
that's great
<alexgordon>
so the macros can _do_ literally anything, because they are just working with raw source code
<alexgordon>
but what I need is a standard collection of expressions for them to output
<cloudhead>
yeah so they can use the default parse()
<cloudhead>
or implement their own
<alexgordon>
right
<cloudhead>
or even augment parse() for macros further down D:
<alexgordon>
yeah you can do injections
<cloudhead>
INJECTIONS
<pikajude>
injections are dangerous
<pikajude>
DARE told me that
<alexgordon>
so a macro injects new macros into the macro applier
<cloudhead>
this would work great with a homoiconic language
<cloudhead>
:p
<alexgordon>
I realised that it's basically how textmate works
<cloudhead>
lol!
<purr>
lolno
<alexgordon>
the grammars
<cloudhead>
oh right
<alexgordon>
I mean not quite. in textmate each rule has start/end regexes, and then points to a collection of rules that will be executed inside the start/end
<cloudhead>
yeah, similar to vim syntax files
<alexgordon>
but you can inject stuff in textmate by having an include to $self and also an include to a rule collection
<alexgordon>
anyway so this is my problem. how to represent control flow
<alexgordon>
I could represent everything as while loops, lol
<purr>
undefined
<cloudhead>
yeah pretty much
<alexgordon>
it's tricky because... originally I was just going to use functions and closures
<alexgordon>
so like while(func() { return cond }, func() { /* body */ })
<alexgordon>
but that doesn't really work at all
<alexgordon>
especially if I want coroutines
<alexgordon>
but I don't want to add a different kind of expression for every kind of loop, conditional statement, etc
<cloudhead>
hmm
<alexgordon>
because if I want people to be able to make their own control flow, then I should really dogfood it
<cloudhead>
but isn't it just when (expr) { <statement...> }
<alexgordon>
and implement the built-in control flows using some kind of "control flow" universal expression
<cloudhead>
right
<cloudhead>
well you can do that if you have syntax sugar
<cloudhead>
like blocks in ruby or do notation in haskell
<alexgordon>
yeah
<cloudhead>
then it can be implemented with functions
<alexgordon>
I always found that very unsatisfactory
<alexgordon>
in ruby
<alexgordon>
feels like a hack
<cloudhead>
yeah
<alexgordon>
I've come to terms with the idea that loops are fundamentally different from closures
<cloudhead>
so you need some primitives right
<alexgordon>
I mean, it IS all jumps under the hood
<cloudhead>
if you have (cond _ _ _)
<cloudhead>
you can implement everything from that
<cloudhead>
yes
<alexgordon>
yeah so conditional jumps...
<cloudhead>
well, higher level than jumps, ie execution
<alexgordon>
seems that this way will make it easiest to implement continuations
<alexgordon>
oh I misunderstood what you meant about forcing users to use it to write macros. the macro system doesn't work like that though. user macros are executed in a separate context, so the macros themselves can use normal code
<alexgordon>
this is about what the user macros _output_, i.e. the AST