Skip to content

Fantom-Factory/afPlastic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plastic v1.1.8


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

Overview

Plastic is a support library that aids Fantom-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!