You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds a server that acts as a function
(exp, env) -> (result, env')
meaning the server has to hold no state. The client maintains and
transmits the state.
This has some bugs right now, such as not being able to serialize
recursive functions. Those will be fixed soon.
---
This commit was comprised of the following commits:
Add initial ScrapMonad
Add a notion of relocations
We'll need to link native functions, for example, if we take in a
serialized environment from the outside.
Add small server with JSON API and little HTML page
Provide a networked REPL, perhaps as a demo.
Add bdecode
This is a little more stateful than bencode so add a class and call into
the class from a `bdecode` function.
Begin deserialization
Use some Python nonsense to automatically add deserializer functions to
a dict if Object subclasses have them.
Add some more deserializers, including first recursive one
This is a little painful and I wonder if there is a better way to do it.
Some niceties
Add deserialization for EnvObject
Deserialize env and wrap it in EnvObject
We need to pass around entire scrap objects.
Persist env in client
Serialize/deserialize functions, closures
Next up: NativeFunctionRelocation.
Type ScrapMonad.__init__
Drop the _
It's cleaner.
Fix infinite recursion bug
All Objects have deserialize (defined or inheritecd), but all of them
*define* it. Check if they define it by looking in `__dict__`.
Add support for deserializing NativeFunctionRelocation
With this, the web REPL can ship an env back and forth to the idempotent
eval server!
Fix Python 3.8
Unwrap classmethod and store inner function. Kind of surprised mypy
didn't catch this, since I was never storing functions before--always
classmethod.
Persist env in LocalStorage
Persist history in LocalStorage
Focus input field on page load
Add TODO
Throw some errors that do not normally raise
Don't double fetch
Add title and note
Remove begin/end newlines
Bound output window height and scroll to bottom
Add doctype
Embed empty favicon in page
Save a request that will always 404.
Add a little favicon
Thanks, antifavicon.
Set 1 hour cache control on eval requests
As the server is stateless, we can have some intermediate server cache
eval(env, exp) requests. If everyone loads the page and types `123`, for
example, we only need receive that request once (per hour).
It's not clear if fly.io (for example) does this middle cache thing
automatically.
Try building image in CI (#19)
* Try building image in CI
* wip
* Add quick check post-build
* Don't be interactive
* Use tags from meta step to identify image
Oops, remove target branch
Remove excess env
Scroll to bottom after loading history
Add space in favicon
Add button to clear LocalStorage
Add TODO
Add multiprocessing server
Serialize/deserialize Apply
Check in fly.toml
Make web repl return result, not _
Report eval errors somewhat opaquely in console
Add updateHistory function
Use try/catch in client
Display server error message in output
Move all explicit exception handling into do_index
Link to repl page
Add charset and viewport
Allow reuse of address
This means we can C-c the server and re-start it on the same port
immediately.
Check in scrapscript.org style
Adjust color and use <main> for padding
Add fonts
Render REPL with code/result a little better
Bundle style.css with Docker image
Fix input background
Use prompt as label
Remove TODO
Don't highlight input box
Deserialize bool and record
Move html to separate file
Expand input into textarea with Shift-Enter
Add goatcounter
Remove console.log
Color textareas too
Make the webserver fork
Bring Chris's code up to date
Print host in debug output
0 commit comments