PlasticUser Guide
Overview
Plastic is a support library and exists to aid the development of other Alien-Factory libraries and frameworks. Though you are welcome to use it, you may find features are missing and the documentation incomplete.
Plastic
is a library for dynamically generating and compiling Fantom code.
Plastic
is the cornerstone of Ioc proxied services and Embedded Fantom (efan) templates.
Quick Start
model := PlasticClassModel("MyClass", true) model.addMethod(Str#, "greet", "Str name", """ "Hello \${name}!" """) model.toFantomCode // --> // const class MyClass { // new make(|This|? f := null) { // f?.call(this) // } // // sys::Str greet(Str name) { // "Hello ${name}!" // } // } myType := PlasticCompiler().compileModel(model) myType.make->greet("Mum") // --> Hello Mum!
Release Notes
v1.0.10
- New: Added
PlasticUsingModel
.
v1.0.8
- Chg:
PlasticClassModel.mixins
only returns the lowest subclass mixins - see Mixin Inheritance Order Bug.
v1.0.6
- New: Added
PlasticFacetModel
to classes, ctors, methods and fields. - New: Added
PlasticClassModel.hasField(Str name)
v1.0.4
- New: Fields can have init values.
- Chg: the
PlasticClassModel
add methods now return sub-model classes. - Chg: Fantom compilation is silent to reduce noise on std out. We raise afPlastic Errs in event of a compilation failure.
- Bug: Fields can not be const if they have a getter.
v1.0.2
- New: Added ctor models.
- New: Updates to ensure backwards compatibility with Ioc.
- Chg: Made
PlasticCompiler.srcCodePadding
mutable so it may be (re)set byafBedSheet
. - Chg: Added
msg()
to SrcCodeErr so Err msgs can be reported. - Bug: The wrong compilation line could be reported in
PlasticErr.toStr()