Hi,

> We have two choices:
>   1) detach WITH OBJECT variable lust like local variables
>      and add code which will resolve references in each :<msg> code.
>      It will cause some small speed overhead but it will work
>   2) forbid using :<msg> in nested code blocks at compile time.
> If we want to add support for macrocompiler then we can chose only
> method one.
> needs additional code to update lWithObject register at the beginning and
> end of WITH OBJECT statement (additional speed overhead which can be
> eliminated and reduces this feature to only single WITH OBJECT variable
> and this is sth what I would like to eliminate in the future.

This would be nice.

> In xHarbour implementation WITH OBJECT is visible for macrocompiler so
> semantically it works like with _tmp declared as PRIVATE instead of LOCAL
> variable.
> 
> As long as we operate only on local variables then we can easy extend
> such functionality adding support for new variables and we can make
> very extensive optimization at compile time calculating all HVM stack
> offsets and eliminating lWithObject HVM stack register. If we add support
> for accessing this value from macrocompiler then we lost such possibilities
> so if you need such extenssion then you have to give me good reason to
> implement it.
> 
> BTW Personally I'd even prefer to replace current WITH OBJECT by new
> syntax, i.e.
> 
>   WITH VAR <varname> [ := <value> ]
>      [...]
>   ENDWITH
> 
> because support for current
>   :<msg>
> syntax breaks Clipper compatibility and it's necessary to introduce
> hacks to PP code so some Clipper compatible code cannot be compiled by
> Harbour and xHarbour. I.e. this code:
> ...
> will not work too. Just simply like IN, HAS and LIKE xHarbour extensions
> also WITH OBJECT breaks valid Clipper syntax in PP but in this case we
> adopted xHarbour syntax for code compatibility and I'm still not sure it
> was good idea.

I'd vote for the clean way. Namely option 2) and WITH VAR and leaving 
WITH OBJECT optional for compatibility. BTW 'WITH OBJECT' is very seldom
used in current Harbour code, and one part of the reason is above 
ambiguity with it.

It would be nice to see a small code example with 'WITH VAR', I'm not 
I fully oversee how it would replace current method in practice.

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to