However, my website is now a quine; it renders its own source code to $source.html files and lists those directories. Thatβs been a great exploration of what is possible once the source codeβs been rewritten to use a more solid framework. Iβm excited to see what else I can do there.
First, though, weβll build a dynamic file server that can render information on the fly. Iβll need this to quickly design pages like my page for showing photos, which I would like to be statically generated and server-side rendered. The components and dependency architecture weβve set up will finally come in handy - now that the source code is much more clear and disciplined.
The best tool behind this source code organization was cacheing as much information as we could up-front through the βinfoβ function. This gives some files the max amount of information that they can get form other files at any time, at the cost of a bit of querying up front (though this might actually be faster - it certainly feels faster - because more information is cached rather than being repeatedly queried or calculated).
Iβm thinking about language paradigms that would let me declare data as lazy without using tools like βasyncβ - for example, getting the contents of a file dynamically when itβs queried from an object rather than having to fetch that up-front. Maybe this is what traits and OOP are for - that cache can just be implemented as an object access on a per-struct basis - but I feel like there is some other core language feature that this one could βfall out ofβ with no boilerplate. Declare that an attribute exists and how to retrieve it, then retrieve and cache it on that object when that attribute is retrieved.
The problem here is invalidating files and information; we have to assume that the root source hasnβt changed, which isnβt necessarily the case, so we canβt do this every time. We almost want some way of indicating whether the source of data we pull from is static - whether it can change during code execution, so we might want to refetch - or dynamic - in which case weβll keep our stuff in memory and never re-fetch a potentially expensive operation. (I think itβs safe to assume in most cases that we will have enough memory available, so we can cache whenever).
This reminds me of the 3CPS work - if we know statically how much information something will take up in memory, we can build that information in at compile time and avoid requiring heap allocations for that data by making a separate heap space available to us that we statically allocate during our compile step.
Weβll explore these ideas after we have fully dynamic hot reloading - thatβs when a real programming language could surface from this whole static/dynamic mess : )
Iβm missing some real features from javascript. Lisp programmers often say that βfear of syntaxβ is the biggest reason for not using a lispy language, and that too many parentheses scare people - but frankly the lack of expressive syntax makes coding more difficult. I can recognize javascript structures based not only on their names but also the shape of the code - and because JSX code has so many different shaped (especially the inline html!) itβs far easier for me to quickly scan and grok a JS(X) file than it is for me to take a peek at a clojure one, where I have to drill down into the names of every line and evaluate the open and closing parens. Lisp is great for language developers and macros - but for most programmers, being able to identify, literally, βthe shape of a problemβ can be a big deal. Iβll probably use a JS or ML-based syntax for whatever language this becomes.
Iβm also missing the lack of expressive type annotations and stakc traces. Tracking down my file rendering bug was a complete mess. ** 12:53 You should design things so that an algorithm has to relearn. ** 13:35 I love resurrecting old projects and using them to re-explore ideas. Most of my ideas from the past couple of years have gone unfinished - I just didnβt have the technical knowledge, the stamina, or the determination to follow a project through. Now that my site is breaking through - as is the index page - Iβm really getting there. Fear is the mind killer. I canβt wait to close out many of this siteβs issues, build a splash page, and get to smess and joss and making a game and rendering for desktop - all things Iβve wanted to do for a long, long time.
Rendering context...