Hi,
The problem is Cl*pper compatibility.
Clipper compiles such code
? oVar:name
as
? oVar:name()
and
oVar:name := 123
as
oVar:_name( 123 )
and people knows about it so they have
a lot of code
which will stop to work if we implement
this functionality.
The problem is also with macrocompiler.
Unlike Harbour
Cl*pper does not support expressions
like: &("oVar:name:=123")
in macrocompiler so programmers had to
use workarounds
for it: &("oVar:_name(123)"). There
was no alternative so we
should expect that code using it is not
unusual.
If we divide data and code messages
then we broke such code.
It means that it would have to be
optional, i.e. using compiler
switch or different hbclass*.ch files
though the second solution
is not clear enough for me. Now
hbclass.ch is necessary only for
code which defines new classes but not
for code which uses them
but to inform compiler that it should
generate different PCODE
for data and code messages we need it
for the second case too
so in my opinion compiler switch is
better.
There are also two additional
extensions which have to be
addressed:
- macro messages (see MACRO MESSAGES in
xhb-diff.txt)
- access/assign methods which are in
fact code messages but
should be treated them as data ones so
we should generate RTE
when they are used as code (with ()). I
expect that this will exploit
a lot of user code which will stop to
work generating RTE it means
that probably we will have to add
global HVM switch to disable
this RTE, i.e. using new _SET_* action.
Anyhow such modification would resolve
yet another problem.
Using data and code messages with the
same name and in the past
I was thinking about it and I even
created quite simple solution in
my head. Anyhow it introduces
incompatibility for exiting code so
I wanted to join it with support for
real class objects and class
variables and methods. In fact neither
Harbour nor xHarbour
supports real class objects. We only
have some limited support
emulating class messages as object
messages. It creates name
conflicts and has fatal speed overhead
when class messages
are send to class object, i.e.
myClass():classMsg() in Class(y) or
xBase++ is very fast because myClass()
is extremely simple and
returns reference to class object
created when it was called first
time and to this object reference class
message is sent.
In Harbour and xHarbour each call call
to myClass() creates
new object instance of the given class
executing its constructors
(in Class(y) and xBase++ constructor is
activated by class method
:new()) then we send to this object
message which can work due
to our emulation and finally the
created object is destroyed
executing all its and its ancestors
destructors.
It's very inefficient way with many bad
side effects.
Unfortunately I've never found time to implement it :(
best regards,
Przemek
W dniu 11.02.2024 o 09:56, Antonio
Linares pisze: