Version 6 by komaz
on Nov 22, 2010 17:06.

compared with
Version 7 by komaz
on Nov 22, 2010 17:26.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (4)

View Page History
{noformat}
fieldName := "${name}Dispatcher"
field := FieldDef.make(loc, parent, fieldName,
field := FieldDef.make(loc, parent, fieldName, FConst.Const + FConst.Private + FConst.Storage + FConst.Static)
field.fieldType = ns.resolveType("mdispatch::Dispatcher")
field.init = //Expression to create dispatcher object
{noformat}

And voila! Everything compiles and runs smoothly now. Here's the [code|^DispatcherDsl.fan]. However it already smells like black magic. Let's go further! ;)

h3. Static imports
Not so long ago there's a [Static imports|http://fantom.org/sidewalk/topic/1223] discussion on Fantom's forum. Without arguing whether static imports are good or bad, let's see what we can do using DSLs, so the code like this would be possible:
{noformat}
class Sample
{
}
{noformat}