Skip to content
A library for dynamically generating and compiling Fantom code
Fantom
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.f4
dev
doc
fan
svg
test
.buildpath
.classpath
.gitignore
.hgignore
.project
build.fan
readme.md
todo.txt

readme.md

Plastic v1.1.4


Written in: Fantom pod: v1.1.4 Licence: ISC

Overview

Plastic is a support library that aids Alien-Factory in the development of other libraries, frameworks and applications. 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.

Install

Install Plastic with the Fantom Pod Manager ( FPM ):

C:\> fpm install afPlastic

Or install Plastic with fanr:

C:\> fanr install -r http://eggbox.fantomfactory.org/fanr/ afPlastic

To use in a Fantom project, add a dependency to build.fan:

depends = ["sys 1.0", ..., "afPlastic 1.1"]

Documentation

Full API & fandocs are available on the Eggbox - the Fantom Pod Repository.

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!
You can’t perform that action at this time.