Git Product home page Git Product logo

wip's People

Contributors

drprofesq avatar

Stargazers

 avatar  avatar

Watchers

 avatar

wip's Issues

[RFC] Basic types

String, Array, Map, Set?

Special syntax to distinguish different variables?

[RFC] Namespace & Alias

Other than isolation of context, namespace is not that useful without a way to create short aliases.

[RFC] Builtin "env" function

Since the shell supports map/dictionary type, maybe it is nice to have this functionality applied to user-defined funtions too.

[RFC] Have its own LISP

Workflow of the shell: Shell Script -> AST (-> Bytecode?) -> LISP VM (-> JIT?) -> Evaluation

[RFC] Sparse Arrays & Associative Arrays

Sparse Arrays

bash has sparse arrays. That's to say you can assign to an array with an index out of bound:

x=(1 2 3)
x[7]=8
x[5]=6
echo ${x[@]}  #=> 1 2 3 6 8

Sparse arrays can be implemented as an ordered map.

Associative Arrays

bash also has associative arrays which are indexed with arbitary strings, but they are unordered maps.

declare -A y=([1]=1 [2]=2 [11]=11)
echo ${y[@]}  #=> 11 1 2

Ideas

We can unified sparse arrays and associative arrays into ordered maps, with all elements (or just values with numeric keys) numeric-sorted.


References:

[RFC] Environment Variables: Global & Local & Export & Import

By default, functions need local scopes. We can provide a way to create local scopes too.

Also, sometimes environment variables need to be exported to sub-process.

What shall we do when:

  • referring to a variable-in-outer-scope-with-export-bit?
  • defining a variable of the same name of a variable-in-outer-scope but with a different export-bit?
  • defining a global variable in the inner scope?

How to query the attributes of a variable?
And how to copy the attributes from one variable to another?

[RFC] Syntax: IO Redirection

Bash style: echo 2>&1 where 2 is a file descriptor for standard error output, not plain text "2".

How to avoid these with least special symbols?

[RFC] Theads

Thread->Fork (libuv), or Fork->Thread (boost.asio), this is a problem?

[CAUTION] Threads + Blocking I/O + Fork/Memory + File Descriptors + Signal Handlers

[RFC] Configuration

  • All scripts have the same behaviors. No way to change the semantics and logic of any command.
  • The interactive REPL and UI are configurable.

[RFC] Commands that do not modified the running status (error code)

Windows' cmd.exe is interesting. Some commands such as echo, pushd, popd, goto, when running successfully, do not modified the exit code (%ERRORLEVEL%) of the previous command.

This feature is not only useful to the goto command, but also let the user provide well-written information about the running status with echo without having to store and restore the previous exit status.

[RFC] nullglob & failglob

When should a wildcard (*) expanding to nothing emit an error (failglob), when not (nullglob)?

Cases:

  • rm a c* e
  • ls file{*.bak,.exe,.log}
  • x=*
  • for i in *

[RFC] A better "test" builtin function

bash is confusing because it provides test, [ ... ] and [[ ... ]] for the same purpose: check file types and compare values.

There should only be one proper way to do that.

[RFC] Package Managers

First principles:

  • Users should feel free and relaxed without any package manager.
  • No builtin package manager.

[RFC] Paths & Symbolic links

What should we do if the GNU/BSD/… coreutils (ls, mv, cp, …) do not cope well with the shell when dealing with symlinks?

  • Always resolve symlinks to absolute paths. (counter-intuition, does not solve the real problem)
  • Rewrite the coreutils. (counter-tradition)

[RFC] Integer Arithmetic

Integer calculation is important for manipulating arrays and batch output.

Big integer (unlimited precision) calculation is good and easy to implement. Must-have: addition, subtraction, multiplication, division, modulo op, power op.

[RFC] Abstraction from terminals/OSes/POSIX

How to cut more connections to the operating systems?

  • ASCII is the basic for text representation (and keywords for syntax).
  • UTF-8 determines valid bytes for plain text.
  • Sure, there are directories and files.
  • Use slashes / as path separators, . as "the current directory", .. as "the parent directory", / at the start as "the root path of the local file system".
  • There is only one user input at a time.
  • Use # as the comment starter?
  • Inherit PATH, HOME, PWD from the environment? Maybe TMPDIR too?
  • Export SHELL, SHLVL?
  • Do you know env 🇪🇺=Europe?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.