 
   req: (moduleName, names) ->
     addToMap @_requested, moduleName, names
-    if not inSet @importedModules, moduleName
+    if not @isModuleLoaded moduleName
       @_requesting = yes
+
+  isModuleLoaded: (moduleName) ->
+    inSet @importedModules, moduleName
 
   requested: ->
     if @_requested.size > 0

  nameIndex = ctx.nameIndex
  {definitions, typeNames, classes, macros, savedScopes, nameIndex}

injectedContext = (modulesToInject) ->
  ctx = new Context
  for moduleName, names of values modulesToInject when compiled = lookupCompiledModule moduleName
    injectContext ctx, compiled.declared, moduleName, names
  ctx

injectContext = (ctx, compiledModule, moduleName, names) ->
  {definitions, typeNames, classes, macros} = compiledModule
  topScope = ctx._scope()
  shouldImport = (name) -> not names.size or inSet names, name

  if (not isTuple reqTuple) or _empty reqs
    return malformed ctx, reqTuple, 'req requires a tuple of names to be required'
  map (syntaxNewName ctx, 'definition name to be imported required'), reqs
  [moduleNameAtom] = _validArguments call
  if not moduleNameAtom or not isName moduleNameAtom
    return malformed ctx, call, 'req requires a module name to require from'
  moduleNameAtom.label = 'param'
  moduleName = moduleNameAtom.symbol
  requiredNames = (arrayToSet (filter _is, (map _symbol, reqs)))
  ctx.req moduleName, requiredNames
  if ctx.isModuleLoaded moduleName
    for arg in reqs
      if (isName arg)
        name = arg.symbol
        if ctx.isFinallyCurrentlyDeclared name
          malformed ctx, arg, "#{name} already declared"
        else if not ctx.isCurrentlyDeclared arg.symbol
          malformed ctx, arg, "#{name} was not declared in #{moduleName}"
        else
          ctx.declareAsFinal name, ctx.currentScopeIndex()
      else
        malformed ctx, arg, 'Name required'
  imports moduleName, setToArray requiredNames

imports = (moduleName, names) ->
  validModuleName = validIdentifier moduleName
