On Thu, 17 Apr 2008, Lorenzo Fiorini wrote:
Hi Lorenzo,
> We told about this time ago.
> This is what we get inspecting a tbrowse object:
> Error BASE/41 Scope violation (hidden): TBROWSE:ACELLCOLORS
> Called from TBROWSE:ACELLCOLORS(0)
> Called from __OBJSENDMSG(0)
> Called from __OBJGETVALUELIST(170)
> Called from HBDBOBJECT:NEW(84)
> ...
> Any workaround?
Try after:
2008-04-22 04:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
It will work. Please remember that if you have classes with multiple
private messages with the same name then object inspector will show
the result valid for current executions context. When non of messages
with given name is accessible in current execution context due to scope
restriction then the last defined message in child class will be used.
Though maybe for debugging it will be better to not remove original
restrictions because you do not see current scope values. Probably
adding to object inspector information about current scope can help
users.
Below I'm attaching code which shows class with multiple hidden
messages. Execute it step by step and see in object inspector what
happens with o:v instance variable depending on the current execution
context.
Please also remember that I haven't disabled scopes in debugger.
Such tricks are IMO wrong because they causes that you cannot debug
some code or some code can work in different way in debugger then
without debugger. F.e. you have function INC_O() which increments
passed object variables V1 and if it's READONLY then increments V2.
This function can be used for different objects.
FUNCTION INC_O( o )
BEGIN SEQUENCE WITH {|| break() }
o:v1++
RECOVER
o:v2++
END SEQUENCE
RETURN NIL
Inside xHarbour debugger only and always V1 will be incremented
and the exception will never appear because debugger disables
scoping so such code will give different results inside debugger
then executed without it.
In Harbour scopes are still active and you do not have to worry
about some unexpected behavior which will be different then in
normal execution process.
best regards,
Przemek
#include "hbclass.ch"
memvar o
proc main()
public o:=cls3():new()
altd()
o:m1()
o:m2()
o:m3()
inkey(0)
return
create class cls1
var v init "v1" hidden
method m1
endclass
method m1 class cls1
f(::v)
return self
create class cls2 from cls1
var v init "v2" hidden
method m2
endclass
method m2 class cls2
f(::v)
return self
create class cls3 from cls2
var v init "v3" hidden
method m3
endclass
method m3 class cls3
f(::v)
return self
function f(v)
? v
return nil
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour