Description

streams, property descriptor, serializer, binder, etc.

Package Information

Version0.6.0-beta.2 (2017-Apr-03)
Repository https://github.com/BBasile/iz
LicenseBSL-1.0
AuthorsBasile B.
Registered byBBaz
Dependencies none

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

iz

Introduction

iz is a general purpose library for the D programming language. It includes streams, containers, a serializer, property binder, Pascal-like sets, Pascal-like properties and more.

Runtime incompatibilities

(dont) Destroy

This library experiments manually managed classes lifetime. Most of the classes declared in iz are not compatible with new and destroy, instead construct and destruct must be used.

  • destroy calls the destructors from the most derived to the base using the dynamic type information of each generation and without considering the static type of the argument (which may be correct).
  • destruct calls the destructor defined for the static type of the argument unless it is passed after a cast to Object. Even in this case, only the most derived destructor gets looked-up using the type information. Once found, the other destructors are called by inheritance (i.e like what does super() to constructors). This system, since not built into the language, is provided with a mixin template.

As a consequence, destroy or the GC will segfault, due to a double call to the destructors, if iz classes that do not directly inherit from Object (i.e non-empty inheritance list) are not accurately handled with construct and destruct.

D arrays

Still because of manual memory management, D arrays (e.g int[] a;) are not really usable in iz classes.

A D arrays consists of two members. One of them is a pointer that's managed by the garbage collector. Since the arrays parents, classes or structs, are not known by the GC, during any collection the GC thinks that a D array is orphan and it frees the chunk pointed by the pointer. By default this library uses GC-free arrays in its classes and other aggregates. Any container based on custom allocators will also be compatible with iz class system.

In order to use default D arrays two workarounds exist:

  • call GC.disable at the beginning of the program.
  • use std.experimental.allocator functions makeArray(), shrinkArray() and expandArray() with Mallocator.instance and never .length and Appender. Uses local copies in order to work safely with Phobos algorithms.

Note that D arrays are not affected when used as local variables. This is even a case where the GC is useful. The lifetime of the aggregates is often known and deterministic so the associated memory can then be considered as polluting the GC heap.

Build and setup

  • using Coedit: open the file iz.coedit in the project menu, item open, compile, install in the libman.
  • using DUB, dub build --build=release.
  • using shell scripts, see the scripts folder.

Other

  • CI Status
  • warning, unstable API, subject to heavy design changes.
  • Boost Software License 1.0

Available versions

0.6.0-beta.2 0.6.0-beta.1 0.6.0-alpha7 0.6.0-alpha6 0.6.0-alpha5 0.6.0-alpha4 0.6.0-alpha3 0.6.0-alpha2 0.6.0-alpha.7 0.6.0-alpha.6 0.6.0-alpha.4 0.6.0-alpha.2 0.6.0-alpha.1 0.5.8 0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 ~master