Is anyone aware of prior work on languages where: ...
# thinking-together
p
Is anyone aware of prior work on languages where: • the program can be modified in-place • variables can be re-bound (i.e. the program has a linear top-to-bottom flow) • updates are patched in so that changes do not cause unnecessary recomputation I have a demo of what I'm referring to here: https://twitter.com/paulgb/status/1226691281184808961
Under the hood, it's a dataflow-like DAG, but with a layer on top that tracks where variables are bound and splices edits into the DAG as they are made.
w
Would be nifty.
i
Sounds like semi-naive datalog
k
One nearby place I'd like to get to is to pick the start and end of a trace for a manual run and interactively turn it into a reproducible test. The tool would say things like, "Program did a read from disk at this point. Record/edit fake?" Or to extract unit tests for a function based on executions seen during a manual run. Or runs.
s
@Kartik Agaram Are you familiar with snapshot testing?
e
well, the notebooks in Mathematica operate exactly like your demo; the program chunks are re-executed from the top on each change. If you are talking about stopping the program part way and continuing, this goes back to mainframe checkpoint/restart features which were used to allow the user continue a batch program that might have taken days to run from some previously designated checkpoint. The minute you have a change point inside a loop, it then becomes rather ambiguous, if not downright dangerous, to consider restarting partially. The specific example that is the pain point, is if you add an IF statement inside a loop, do you continue at iteration #130 and then add in the IF statement; that really isn't accurate, so you really have to re-run the whole loop. This is the reason why these incremental change systems are fraught with complexity and do not offer the certitude that is the requirement for debugging complex systems. Sure if you are just tweaking a line thickness parameter on which nothing else depends, one can tweak without any harm, but if the branching changes anywhere in a program it could behave dramatically different, and thus requires a complete restart from the beginning.
👍 1
k
@Stefan There's a similarity but it's superficial. Snapshots are fundamentally opaque to many tools, and once you get on them it takes momentum to switch to something else. The tests I'm proposing are more like a 'wizard' to bootstrap a new function. Particularly for teaching, where preexisting tests can help people see the benefits without having to put in a bunch of work up front. But they'll still get curated before they get checked in to version control. Merging manually and automatically generated tests is out of scope.
👍 2
p
@Edward de Jong / Beads Project right, I think a lot of these ideas break down when you are dealing with a complex/stateful codebase. The intended use here is for notebook-style analysis; in particular the dataflow graph is shallow in the sense that it only tracks dependencies between global variables (function calls and control structures are opaque). The semantics are guided by the principal that it should be as if you ran top-to-bottom; the live patching is just a sort of optimization.
e
Frankly, i don't know any programmers who have that much difficulty debugging a program that runs top to bottom with no branching or state. That goes back to mainframe day style of code, and it was very straightforward to just keep bisecting the program, and via a binary search find the source of a problem. To this day the bisection process is still used a great deal. Most notebook program fragments are short, and can just be rerun from scratch on each keystroke change. The real challenge is building interactive graphical software, especially something that connects to a server which has remote state. Then re-running things becomes a very interesting proposition. For that type of work, it is common to run a virtual server locally, so that you can freeze the state of both systems at once. It is a very interesting aspect to debugging nowadays, and by shaking out most of the bugs with a local server, you can then deploy and hopefully just a few bugs remain. Mathematica is a huge success; the company has 700 employees, and an insurmountable lead in their market.
p
The use case I have in mind is not debugging, but interactive exploration. As an example, in an experimental notebook, I sometimes have code that procedurally makes a calculation like this:
Copy code
data = load_data()
data = data.filter(cond)
data.age.mean()
The goal of this is that if I remove the
filter
line, it immediately recalculates the (now unfiltered) mean, without reloading the data itself.
👍 1
I've been looking into Mathematica, thanks for the tip. I don't have access to a license any more so I'm trying to understand the execution semantics from YouTube videos, if you know any good ones 🙂
g
Do Common Lisp's "multiple restarts" give you some ideas?
l
Instead of trying to fit imperative code (loses intention details) into a DAG, why not just go full on declarative? I recently finished a declarative-to-imperative code generator which supports your checkpoints, planning on making it a full on visual editor 🙂 https://twitter.com/LeonardPauli/status/1227010930657169408
m
@Paul Butler I believe runkit.com also works similar to mathematica, see http://blog.runkit.com/2015/09/10/time-traveling-in-node-js-notebooks/
e
@Paul Butler in an interview a while back Stephen Wolfram pointed out that Mathematica is free actually, if you use the kids' learning portal; it has a kiddie looking interface but it is full engine. Not only is Mathematica the only big symbolic computation system around (it can produce arbitrary precision if you wish), he has spent the last 10 years building up a database of knowledge about the world, with historical records for a vast number of real things. He has spent hundreds of millions building up databases that can be accessed.
c
Last time I toyed around with that database even simple queries that gave results in wikidata went empty there
And for something with financial backup I would expect even better quality
e
I don't know what you mean by Wikidata. The Wolfram|Alpha knowledge engine is what it is called. I am not a user, so i can't comment on the quantity, accuracy and breadth of their data, but i am very familiar with Wolfram's long career and you don't get to be one of the largest language vendor companies on the planet (700 employees) without doing something right. I just tested it, and asked it "temperature records for NYC" and it gave me a fantastic readout. Google doesn't do anything near to this. Google's search engine is based on page ranks, and its purpose is to sell advertising; Alpha is trying to understand human speech, and uses thousands of heuristics. It has evolved considerably over the 10 years, and it is to my knowledge the best knowledge engine for general use; only Watson has a deeper model of the world, and Watson is not available for consumer use.
c
Wikidata is a semantic/structured database that is editable like Wikipedia. It's a wiki Foundation project. It's built around "triples" of the form (entity relationship entity). For example E123 might be "London", R34 might be "is the capital of" and E25 might be "UK", then one entry would be (E123 R34 E25)
k
@curious_reader What's an example query you tried?
c
@Kartik Agaram I think it was related to cities, I see if I can find the original query
I think i'm just not enough used to wolframs query language, like in wikidata I can say ( when I have the Identifier) find all brdiges in europe
how do I do this in wolfram? Or : show me europes 5 biggest cities ,wolfram give me hints like: use metropolean area population ...but finally I can't get the query to work
k
Yeah, this seems lame. It's smart enough to tell me some pretty cool assumptions it's making. But then.. no results.
'largest city' works, but 'largest city in europe' doesn't. It clearly understands the command, but "data not available".
c
Thank you for trying! It’s some how relieving to see that someone struggles with simple queries too
❤️ 1
Wikidata on the other hand gives you a good hand to work with RDF triples and SPARQL
At some point I wanted to build a trivial pursuit game based on it
What I did actually do was this:
The basic idea was to to create something similar to that nice O’Reilly PDF from the mid 2000’s : https://web.archive.org/web/20130203044822/http://oreilly.com/news/graphics/prog_lang_poster.pdf
So basically a rough ‘influence’ graph for programming languages, ideally order by history/time. As you can see I used graphviz but the graph layout isn’t as nice as in the original ;)