 
   _currentDefinition: ->
     @_scope().definition
+
+  _currentDeferrableDefinition: ->
+    (def = @_scope().definition) and def.deferrable and def
 
   _definition: ->
     @_definitionAtScope @scopes.length - 1

    scope.typeNames = newMap()
    scope.typeAliases = newMap()
    scope.deferredConstraints = []
    scope

  newLateScope: ->

    throw new Error "Missing definition at top level"

definitionList = (ctx, pairs) ->
  # log "yay"
  concat (definitionListCompile ctx, pairs)

definitionListCompile = (ctx, pairs) ->
  compiledPairs = (for [lhs, rhs] in pairs
    if not rhs
      malformed ctx, lhs, 'missing value in definition'
      # TODO: take into account fakes (using better pairs function) and new lines
      rhs = fake_()
    definitionPairCompile ctx, lhs, rhs)

  compiledPairs = join compiledPairs, compileDeferred ctx
  resolveDeferredTypes ctx
  compiledPairs = join compiledPairs, compileDeferred ctx
  deferDeferred ctx

  filter _is, compiledPairs


# This function resolves the types of mutually recursive functions
resolveDeferredTypes = (ctx) ->
