aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--notes/cached_vs_shared_files.txt64
-rw-r--r--notes/gc.txt12
-rw-r--r--notes/givemes_normal_classes.txt82
-rw-r--r--notes/package_build.txt10
4 files changed, 167 insertions, 1 deletions
diff --git a/notes/cached_vs_shared_files.txt b/notes/cached_vs_shared_files.txt
new file mode 100644
index 0000000..eb631f8
--- /dev/null
+++ b/notes/cached_vs_shared_files.txt
@@ -0,0 +1,64 @@
+Runtime library: Cached vs shared files
+=======================================
+
+Cached files:
+
+* Are about static content.
+* Useful for e.g. things in /usr on *nix.
+ - But also for configuration or web pages, documents, etc.
+ if the expiration time is low enough.
+* Files are considered (and expected to be) immutable.
+* May be cached on subsequent opens.
+* May be cached by the runtime, if the process is invoked multiple times.
+* May or may not have an underlying file descriptor.
+* Might not reload from disk within the expiration time.
+* Reads can be "merged" across threads. For example, if there are 200 reqs/s,
+ and the expiration time is 1 second, then there can be a 200x reduction of
+ reads at the OS level.
+* Not guaranteed to be read in any particular order
+ (e.g. a read "after" a write might actually happen before the write).
+* May be pre-fetched arbitrarily by the runtime.
+
+Buffered files:
+
+* Are about dynamic content.
+* Useful for files that are generated in "one shot" by other processes.
+* For ordering, the time the file is opened matters. But after that point
+ in time, the reads may be buffered (and hence be executed at different
+ points in time than in the source code).
+
+Shared files:
+
+* Are about state.
+* Useful for e.g. databases.
+* Guaranteed to be read in order.
+* No caching.
+* No buffering.
+* All I/O operations immediately result in a syscall invocation.
+
+Class names to use
+------------------
+
+Theme 1: What they are:
+
+ CachedFile
+ BufferedFile
+ SharedFile
+
+Theme 2: What they do:
+
+ CachingReader
+ BufferingReader
+ DirectSyscallReader
+
+Theme 3: When they should be used:
+
+ StaticReader
+ DynamicReader
+ DirectReader
+
+Theme 4: What the are used for:
+
+ ContentFile
+ GeneratedFile
+ MutableFile
diff --git a/notes/gc.txt b/notes/gc.txt
index 059fd33..1ce8bcb 100644
--- a/notes/gc.txt
+++ b/notes/gc.txt
@@ -145,3 +145,15 @@ With nested objects:
But this cannot encode union types where the kind isn't known at time of
allocation.
+
+
+When to perform garbage collection
+---------------------------------
+
+Is it enough with the following? If so, then no separate "GC thread" or
+similar would be required.
+
+* Allocation
+* Resource aquisition (e.g. opening files)
+* Some form of "minor collection" on sleep/wait/etc? Or perhaps all
+ calls that block?
diff --git a/notes/givemes_normal_classes.txt b/notes/givemes_normal_classes.txt
index ab62c5e..3ad42bd 100644
--- a/notes/givemes_normal_classes.txt
+++ b/notes/givemes_normal_classes.txt
@@ -1,4 +1,4 @@
-Can service stuff (like giveme`s) be merged into normal classes?
+Can service stuff (like giveme's) be merged into normal classes?
================================================================
Super-simple solution with default values
@@ -40,3 +40,83 @@ More powerful syntaxes
# Better than the above? Somewhat intuitive also.
int x from param "-x,--x-value" 0
HttpRequest req from default
+
+Replace constructors with giveme's?
+-----------------------------------
+
+For example:
+
+ # Definition of `SomeType`
+ giveme
+ File f
+ end
+
+ data
+ long filepos
+ end
+
+ entry initialize
+ code
+ filepos = 0
+ end
+
+
+ # Usage
+ entry main
+ code
+ File f = new
+ f.open "test.txt"
+ SomeType st = new
+ st.f = f
+ st.init
+ end
+
+ # Usage, with implicit(!) creation on first use:
+ entry main
+ code
+ File f
+ f.open "test.txt"
+ SomeType st
+ st.f = f
+ st.init
+ end
+
+
+Or even replace both with typestates:
+
+ # Definition of `SomeType`
+ data
+ File f
+ when initialized
+ long filepos
+ end
+
+ entry initialize
+ transition
+ initialized
+ code
+ filepos = 0
+ end
+
+
+ # Usage
+ entry main
+ code
+ SomeType st
+ end
+
+Or, even more general:
+
+ data
+ after created
+ File f
+ after initialized
+ long filepos
+ end
+
+ func initialize
+ transition
+ created to initialized
+ code
+ filepos = 0
+ end
diff --git a/notes/package_build.txt b/notes/package_build.txt
new file mode 100644
index 0000000..6d3e44d
--- /dev/null
+++ b/notes/package_build.txt
@@ -0,0 +1,10 @@
+Package builds
+==============
+
+Packages usually contain more than just source code, e.g. README.md, etc.
+
+Also, binary packages could contain non-executable files that need to be
+built, e.g. documentation, etc.
+
+It would be nice to support this in SLUL. Perhaps via some external
+tool, or perhaps via some subcommand/extension/plugin of the slul command.