-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
I think the forward declaration for procs and methods should not be required in any case.
Working with Nim would be more convenient and less error-prone.
Example:
type T1 = ref object of RootObj
type T2 = ref object of T1
type T3 = ref object of T2
method m(self: T1) =
echo "T1"
# method m(obj: T2) # forward declaration
method m(obj: T3) =
procCall obj.T2.m()
echo "T3"
method m(obj: T2) =
procCall obj.T1.m()
echo "T2"
var obj = T3()
obj.m()
In this example, a missing forward declaration leads to different/wrong program logic.
It still compiles fine, but the program result is not, what the programmer expect.
Would be nice, if this does the same with and without the forward declaration.
szymski, timotheecour, Bulat-Ziganshin, Clyybber, Stromberg90 and 14 more