Skip to content
/ puzzle Public

A tiny macro-based framework to compose class from puzzles.

Notifications You must be signed in to change notification settings

andyli/puzzle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Puzzle Build Status

A tiny macro-based framework to compose class from puzzles.

Learn by example

Puzzles are interfaces that directly extend puzzle.Puzzle:

interface A extends puzzle.Puzzle {
	public var a(get_a, null):Int;
	public function new():Void {}
}

interface A_impl extends puzzle.Puzzle {
	private function get_a():Int {
		return 123;
	}
}

The puzzle macros will store all the member definitions (haxe.macro.Field), remove all the unnecessary things (function bodies, contructor etc), infer the types if needed, making them normal valid Haxe interfaces.

Notice that A contains a contructor, which is forbidden in interface in Haxe, will actually be removed.

Here we come to put the two pieces together:

class RealA implements A implements A_impl {}

RealA now contains all the members of A and A_impl, including the constructor from A.

About

A tiny macro-based framework to compose class from puzzles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages