plumbum


https://github.com/back2dos/plumbum/

To install, run:

haxelib install plumbum 0.0.2 

See using Haxelib in Haxelib documentation for more information.

README.md

Plumbum Build Status

This library offers a mechanism for organizing the internal plumbing of an application into distinct scopes, which are:

  • geared towards declarative syntax
  • immutable (may hold mutable values, but will not change themselves)
  • lazy (at least by default)
  • reasonably well guarded against cyclic references

Anatomy of a scope

Dependencies

Every scope can define it's external dependencies with a special variable:

class Example {
  var dependencies:{
    var enabled:Bool;
    function onclick():Void;
  }
}

These dependencies will be used as the single constructor argument and will be stored into separate fields. You may refer to the enabled field as both enabled or dependencies.enabled.

Declarations

A scope may have three kinds of declarations:

Methods

Methods work as they do in ordinary classes.

Properties

Scopes may have computed properties with (get, set) or (get, never) as access (without @:isVar). Everything else is rejected.

Variables

Variables must have a type and an initialization expression. Plumbum forces you to order variables in such a manner that you cannot refer to variables further below. The main goal is to avoid cyclic definitions. You can tag the scope as @:lenient to lift this constraints.

All variables are actually lazy, meaning if they are not accessed, the initialization expression is never evaluated. This allows deferring work and also helps facilitate the lenient mode to some degree. If you wind up building a cycle this way, you will get a runtime exception saying 'circular lazyness' in debug mode and a stack overflow for release builds.

The restrictions may be tightened in the future.

Going Imperative

You may declare a constructor with an empty argument list. The code in the constructor body is run after the scope is properly set up. You can do anything you want. So try to be civil ;)

Static members

Anything static is passed on to the compiler unmodified. Declarations cannot refer to static members directly (this is a temporary implementation limitation rather than a design decision).

Contributors
back2dos
Version
0.0.2
Published
7 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub