new feature: package level objects
This commit is contained in:
parent
7889692523
commit
c17f6c7837
9 changed files with 93 additions and 11 deletions
16
tests/package_level_objects/tusefoo.nim
Normal file
16
tests/package_level_objects/tusefoo.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
discard """
|
||||
output: '''@[(x: 3, y: 4)]'''
|
||||
"""
|
||||
|
||||
type
|
||||
mypackage.Foo = object
|
||||
Other = proc (inp: Foo)
|
||||
|
||||
import definefoo
|
||||
|
||||
# after this import, Foo is a completely resolved type, so
|
||||
# we can create a sequence of it:
|
||||
var s: seq[Foo] = @[]
|
||||
|
||||
s.add Foo(x: 3, y: 4)
|
||||
echo s
|
||||
Loading…
Add table
Add a link
Reference in a new issue