Page 1 of 1

bug: closure doesn't recognize "base" keyword

Posted: 12 Jan 2019, 10:57
by vvhitevvizard

Code: Select all

class class1 extends class1.class2{
	method1(){
		msgbox("1|" base.__Class) ;ok
		closure1()

		closure1(){
			msgbox("2|" this.base.__Class) ;ok
			msgbox("3|" base.__Class) ;error
		}
	}
class class2{
}}
class1.method1()
keyword base works within methods and fails within closures. this, this.base, this.base.base, etc works as expected everywhere.

Re: bug: closure doesn't recognize "base" keyword

Posted: 12 Jan 2019, 11:40
by Helgef
It is only stated to work within methods, in the documentation.

Re: bug: closure doesn't recognize "base" keyword

Posted: 12 Jan 2019, 13:33
by vvhitevvizard
I see. At least its documented. :D
Btw, for class mreq extends req, calls base.Init() and this.base.Init() work different. Within req.Init(), this.__Class=mreq with 1st variant and this.__Class=req with 2nd one. Is it intended to be so?

Re: bug: closure doesn't recognize "base" keyword  Topic is solved

Posted: 12 Jan 2019, 13:38
by Helgef
Intended and documented

Re: bug: closure doesn't recognize "base" keyword

Posted: 12 Jan 2019, 13:39
by vvhitevvizard
Helgef, roger that! thank u for ur quick response =)

Re: bug: closure doesn't recognize "base" keyword

Posted: 25 Feb 2019, 06:21
by _3D_
As closure cant be member of a given class then base is not accessed inside closure without this.
In other words closure not "see" class members and to do this it need this.