All Projects → xandkar → hope

xandkar / hope

Licence: other
A quest for a "standard" Erlang library with uniform, composable abstractions.

Programming Languages

erlang
1774 projects
Makefile
30231 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to hope

Boltons
🔩 Like builtins, but boltons. 250+ constructs, recipes, and snippets which extend (and rely on nothing but) the Python standard library. Nothing like Michael Bolton.
Stars: ✭ 5,671 (+31405.56%)
Mutual labels:  standard-library
Bash Oo Framework
Bash Infinity is a modern standard library / framework / boilerplate for Bash
Stars: ✭ 5,247 (+29050%)
Mutual labels:  standard-library
CSpydr
A static typed low-level compiled programming language inspired by Rust and C
Stars: ✭ 17 (-5.56%)
Mutual labels:  standard-library
sgi-stl-docs
Standard template library (STL) documentation from SGI. (Mirror)
Stars: ✭ 36 (+100%)
Mutual labels:  standard-library
std
A standard library wrapper for use in the `arkworks` ecosystem
Stars: ✭ 23 (+27.78%)
Mutual labels:  standard-library
flip-jump
The simplest programming language - Flip a bit, then Jump
Stars: ✭ 18 (+0%)
Mutual labels:  standard-library
spaceship-go
Spaceship Go - A journey into the Standard Library
Stars: ✭ 64 (+255.56%)
Mutual labels:  standard-library
venus
OO Standard Library for Perl 5
Stars: ✭ 14 (-22.22%)
Mutual labels:  standard-library
fork
A simple, self hosted, low level programming language.
Stars: ✭ 69 (+283.33%)
Mutual labels:  standard-library
pawn-stdlib
The Pawn Standard Library Package, not including any files related to SA:MP - designed for the sampctl package management system.
Stars: ✭ 13 (-27.78%)
Mutual labels:  standard-library
core.horse64.org
THIS IS A MIRROR, CHECK https://codeberg.org/Horse64/core.horse64.org
Stars: ✭ 3 (-83.33%)
Mutual labels:  standard-library
solidity-standard-library
Solidity standard library (Array, random, math, string)
Stars: ✭ 61 (+238.89%)
Mutual labels:  standard-library
stdgems
Ruby's default & bundled gems: The new standard library
Stars: ✭ 94 (+422.22%)
Mutual labels:  standard-library
BackportCpp
Library of backported modern C++ types to work with C++11
Stars: ✭ 53 (+194.44%)
Mutual labels:  standard-library

Build Status

Hope

A quest for a "standard" library with uniform, composable abstractions.

Originally motivated by a desire for an error monad and generic option type operations, and stood for Higher Order Programming in Erlang. Soon after, I wished all standard containers used consistent conventions and protocols (such as consistent accessor names, argument positioning rules and expression of semantics with option and result types).

Here lies an experiment to see what something like that could look like. As all proper experiments should, this one is used daily in production projects (hence the high-ish version number, 'cause semver).

Conventions

I entertain any forward-thinking library design ideas, but more than anything else, these are influenced by Jane Street's Core of the OCaml world.

  • A module per data type implementation
  • Name of the module is the name of the type
  • Inside the module, the type it implements is always named t(..), such as: hope_foo:t(), not hope_foo:foo()
  • t(..) is always the first argument
  • Names of private records may be short, such as: #foo{} or #t{} (Though I'm second-guessing this idea, since seeing {t, ..} in stack traces is less than helpful. I'm considering requiring fully-qualified names for all record definitions and maybe short-handing what would've been #t{..} as -define(T, ?MODULE). -record(?T, {..})., which may be a bit ugly. Still thinking...)
  • Names of public records must be fully qualified, such as: #hope_module_record{}
  • Names of all modules must be fully qualified, such as: hope_module (this should go without saying, but just to be sure...)
  • Keep the number of (anonymous) arguments "reasonably" low:
    • up to 3 is normal
    • 4 is suspicious but may be reasonable
    • 5 is very suspicious and probably unnecessary
    • more than 5 is unacceptable, so consider reducing by:
      1. revising abstractions, or, if not practical
      2. creating a public record specifically for the purpose of passing many arguents, which simulates labeled arguments. For an example see https://github.com/xandkar/oauth1_core where I used that technique extensively (especially in oauth1_server.erl)

Abstractions

Monads

A class of burritos, used for expressing sequences of operations on some data type. Defined in hope_gen_monad, implemented as:

  • hope_result: for composition of common functions returning {ok, Val} | {error, Reason}. An alternative to exceptions, which makes the error conditions apparent in the spec/signature. Analogous to Haskell's Data.Either a b, Jane Street Core's (OCaml) ('a, 'b) Result.t, Rust's Result<T, E>
  • hope_option: for expressing and composing the intention that the value may or may not be available. An alternative to the common undefined (which is equivalent to the dreaded null). Analogous to ML's (SML, OCaml, etc) 'a Option.t, Rust's Option<T> and Haskell's Data.Maybe a 1.

Containers

A class of abstract data types to which we have exclusive access and can put things in and take them out. See issue #9

  • Operations on all abstract types of containers should share a common lexicon
  • Concrete implementations of an abstract data type must be swapable

Dictionary

Defined in hope_gen_dictionary, implemented as:

  • hope_kv_list. Equivalent to orddict/proplist. Operations implemented with BIFs from lists module, where possible

TBD:

  • hope_hash_tbl. API around stdlib's dict
  • hope_gb_dict. API around stdlib's gb_trees

Set

TBD:

  • hope_hash_set. API around stdlib's sets
  • hope_gb_set. API around stdlib's gb_sets

Queue

TBD

Should include both FIFO (queue) and LIFO (stack), so that user can swap if a different order is desired.

Should we attempt to include priority queues or make them a separate abstract type?

Sequence

TBD

Not yet defined and only partially implemented as:

  • hope_list

Resources

A class of abstract systems to which we share access with an unknown number of users and can make requests to perform operations which may not get done for any number of reasons.

Storage

TBD

See issue #11

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].