   @
 
 
-Modul8::compile = (target) ->
+Base::compile = (target) ->
   @removeSubClassMethods()
   return @ if !@environmentMatches
   obj.target = target

    obj.ignoreDoms.push d for d in domains
  @

Modul8::arbiters = (arbObj) ->
  return @ if !@environmentMatches
  arb = new Arbiters()
  if arbObj


obj = {} # changed by all objects below

Base = (@sub = 'None')->

Base::__defineGetter__ 'environmentMatches', ->
  environment is envCurrent or envCurrent is 'all'

# since the way we move between class instances might leave more methods exposed than we need, catch bad usage here and warn
Base::subclassMatches = (subclass, method) ->
  hasMatch = @sub is subclass
  console.warn("Ignoring an invalid call to "+subclass+"::"+method+" after having broken out from the "+subclass+" subclass") if !hasMatch
  hasMatch

#subclass methods must call @subclassMatches
Base::removeSubClassMethods = ->
  @sub = 'None'

Base::in = (env) ->
  # allow this to retain current sub-class
  envCurrent = env
  @

# before and after calls will allow anything in, but we throw if any not fn at compile
Base::before = (fn) ->
  @removeSubClassMethods()
  obj.pre.push fn if @environmentMatches
  @

Base::after = (fn) ->
  @removeSubClassMethods()
  obj.post.push fn if @environmentMatches
  @

Base::logger = (sub) ->
  @removeSubClassMethods()
  obj.logger = sub if @environmentMatches
  @

Base::use = (inst) ->
  @removeSubClassMethods()
  return @ if !@environmentMatches

