Fish Oil Brainstorming - oilshell/oil GitHub Wiki

Notes from https://gitter.im/fish-shell/fish-oil so I don't forget

Problems with Global State

File Descriptors

  • Solutions:
    • fish can do the dup() dance on all its open files, to move it above FD 100
    • Oil could disallow echo 1>&3

Signal Handlers

  • Oil still needs this ported to C++

Threads

fish shell uses threads to support interactive features, like syntax highlighting, and also when writing output. For example in a command like echo $var | cat fish will spawn a thread to write the output of echo to cat.

  • The fish "front end" uses threads for multiple things. Its backend could use fork() instead of threads (the original strategy)
  • The Oil backend doesn't use any threads.

C++ API

We need to interface Oil's garbage collected code with non-GC code. Working on it with Local<T> etc.

We could also do some kind of binary in-process API to avoid exposing that detail. (And for C programs that want to embed Oil)

Completion API

These posts explain how Oil's completion (prototyped in Python) works, and how it's integrated with the parser:

http://www.oilshell.org/blog/tags.html?tag=interactive-shell#interactive-shell

Notes on Subinterpreters

https://github.com/oilshell/oil/issues/704

In addition to the config file and ble.sh use cases, Oil could "virtually fork" its heap with memcpy() and pipe() between threads.