Closed
Description
Differences between compiling if using 'classic call syntax' vs 'method call syntax' .
Here's the appoach to provoke error:
1.) Create files as descibed beneath in section "Sample code".
2.) Try to compile "Test1.nim" (using classic call syntax)
=> Compile ends propperly
3.) Try to compile "Test2.nim" (same as Test1.nim, but using 'method call syntax')
=> Compile ends in error message:
d:\Users\thomas\Desktop\Test\test.nim(4, 5) Error: undeclared field: 'Window' for type system.int [declared in D:\Nim\nim-1.0.0\lib\system.nim(26, 3)]
found 'Window' of kind 'module'
Sample code:
Create File: "win32.nim"
from window as Window import nil
Create File: "window.nim"
proc New*(title:string):int =
echo "> Create New Window With Title = " & $title
return 1234567890
proc Title*(self:int, name:string) =
echo "> Title Of window " & $self & " Changed To " & $name
template Title*(self:int):string =
"< Title Of Window " & $self
Create File: "Test1.nim"
include win32
let main = Window.New(r"Hello World")
Window.Title(main,r"New Title")
echo Window.Title(main)
Create File: "Test1.nim"
include win32
let main = Window.New(r"Hello World")
main.Window.Title(r"New Title")
echo main.Window.Title
Metadata
Metadata
Assignees
Labels
No labels