I've found another example of the same include vs import issue in my project

could you please explain me the difference from include and import in this 
context? I'm still far from understanding this
    
    
    # malebolgia_generic_mod.nim
    #[
    import std/[enumerate]
    import malebolgia
    
    func threadFunc[T](a: openArray[T]): T =
      result = a[0] + a[1]
    
    proc run*[T](inputs: openArray[T]): seq[T] =
      result = newSeq[T](inputs.len)
      var m = createMaster()
      m.awaitAll:
        for i, item in enumerate(inputs):
          m.spawn threadFunc([item, item]) -> result[i]
    ]#
    
    when false:
      # nim-2.0.2/lib/std/tasks.nim(97, 39) Error: undeclared identifier: 
'isolate'
      import malebolgia_generic_mod
    else:
      # compiles successfully
      include malebolgia_generic_mod
    
    when isMainModule:
      echo run([1, 2, 3, 4, 5])
      echo run([1.0, 2.0, 3.0, 4.0, 5.0])
    
    
    
    Run

Reply via email to