Pebaz / nimporter

Compile Nim Extensions for Python On Import!
MIT License
821 stars 33 forks source link

Does not work with methods #45

Closed lhupfeldt closed 3 years ago

lhupfeldt commented 3 years ago
import nimpy

type
  My* = ref object of RootObj
    xx: string

proc myHelp*(my: My): string {.exportpy.} =
  return "mine"

method mmyHelp*(my: My): string {.base,exportpy.} =
  return "mine"

ttt.nim(13, 1) Error: Expected one of {nnkProcDef, nnkIteratorDef, nnkFuncDef}, got nnkMethodDef

Pebaz commented 3 years ago

This has to do with Nimpy rather than Nimporter directly. Please consult with Nimpy's documentation. Let me know if you can get this working because I'm curious myself if methods will work. My guess is that Nimpy does not support them but I could be wrong.

lhupfeldt commented 3 years ago

Correct, seems Nimpy does not handle types and methods. So I probably can't use it. Too bad.

Pebaz commented 3 years ago

Closing this for now as it seems a determination has been made.

xyb commented 2 years ago

@Pebaz nimpy already supports types and methods, so we can follow up now. See https://github.com/yglukhov/nimpy/pull/210