Skip to content

Add additional argument support to commands #89

@cryptogun

Description

@cryptogun

Nim compiles and runs well. Yet NimLime complains a lot. Here's the code:

# Code from: https://github.com/nim-lang/Nim/issues/2257#issuecomment-87856997
import threadpool

const ch_max:int = 3

var channels: array[1..ch_max, Channel[string]] # TChannel deplicated.

proc consumer(ix : int) {.thread.} =
  echo "received: " & channels[ix].recv()

proc main =

  for ix in countup(1,ch_max):
    echo "opening: " & $ix & "/" & $ch_max
    channels[ix].open()

  for ix in countup(1,ch_max):
    echo "spawning: " & $ix & "/" & $ch_max
    spawn consumer(ix)

  for ix in countup(1,ch_max):
    echo "sending: " & $ix & "/" & $ch_max
    channels[ix].send("channel recv " & $ix)

  sync()
  echo "synced"

  for ix in countup(1,ch_max): channels[ix].close()

when isMainModule:
  echo "<<begin>>"
  main()
  echo "<<end>>"

And this Warning: Not GC-safe with code blow. No such warning using nim c -r. That scares.

type Man = ref object of RootObj
method run(this: Man) {.base.} =
    echo "running"
var bob = new Man
bob.run()

Nim Compiler Version 0.17.2 (2017-09-07) [Windows: amd64]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions