FAQ

Answers to questions that are asked frequently or might be asked frequently in the future.

Table of contents

  1. General questions
    1. What is Moss?
    2. What is Moss suitable for?
    3. What is the project goal?
    4. How fast is moss?
  2. Programming
    1. Is async available?

General questions

What is Moss?

Moss is a dynamically typed programming language, which allows functional and object oriented programming.

The program moss, written in lower case, consists of a small compiler and a larger byte code interpreter. It is also available as a library, which could be integrated into another program.

What is Moss suitable for?

Moss is meant to be a general purpose programming language, but it is certainly not suitable for everything. Most well suited would it be for scripting or as an interface language to performant programs.

For example, Moss is developed together with a scientific library, a matrix caculator and a plotting library, serving purposes similar to SciPy, Matlab/Octave, Gnuplot and Matplotlib.

Moss is not suitable for programs that should run performant on the bare metal cold or for large complex systems, due to its lack of a static type system and optimizations.

Be aware that callback functions written in a dynamically typed language might slow down systems written in a performant language. If callback functions occur at critical locations, it might be necessary to reformulate the whole procedure in the performant language.

What is the project goal?

The project goals are so far:

How fast is moss?

Have a look on these micro benchmarks:

→ Benchmarks.

Programming

Is async available?

Asynchronous functions are currently not implemented, but planned for the future. It is easy to implement async-await as a syntactic sugar, once the coroutine/continuation system is completed.

Alternatively, to be more minimalistic, async might be provided as a library module, dispensing with syntacic sugar, as coroutine syntax is versatile enough. Currently possible is the following toy implementation of async:

async_list = []

function async(f)
  return fn|*a|
    async_list.push(f(*a))
  end
end

function scheduler
  for fp in cycle(async_list)
    fp()
  end
end

f = async(|text| fn*||
  while true
    print(text)
    yield
  end
end)

g = async(|text| fn*||
  while true
    print(text)
    print(text)
    yield
  end
end)

f("la")
g("dup")

scheduler()