Hi Przemek,

Il 09/10/2008 23.00, Przemyslaw Czerpak ha scritto:
F.e. it looks that xbase++ can have methods and object variables
with the same name. It means that:
   ? o:var
gives different code then:
   ? o:var()
or at least documentation it wrong describing :atStart and :atEnd
methods and variables.
It's interesting functionality I even wanted to add but it's not
Clipper compatible though probably we can hide the difference
by introducing "suggested" action to PCODE so o:var() will work
as o:var when there is no method with the name "var".
If other developers think it's important then I can add such
extension.

I have just now finished to discuss about this with Pritpal, at whom I was describing that I have partially lost 2 days because I'm porting a lib of mine to harbour from xharbour and today I have found that one of problems was exactly the contrary of above functionality: send a value to a method using assignment and not parenthesis. What you wrote above it seems to me that it's already implemented.

Values on right are Clipper - Harbour results

PROCEDURE Main()

  LOCAL o := GetNew()

  // var in harbour
  ? o:cargo()        // <-- NIL - NIL
  ? o:cargo := 10    // <-- 10  - 10
  ? o:cargo( 30 )    // <-- 30  - 10
  ? o:cargo()        // <-- 30  - 10

  // setget in harbour
  ? o:col := 5       // <--  5  -  5
  ? o:col( 10 )      // <--  5  - 10
  ? o:col()          // <--  5  - 10

  o := ErrorNew()

  ? o:cargo := 10    // <-- 10  - 10
  ? o:cargo( 30 )    // <-- 10  - 10
  ? o:cargo()        // <-- 10  - 10

  o := TBrowseNew()

  ? o:cargo := 10    // <-- 10  - 10
  ? o:cargo( 30 )    // <-- 10  - 10
  ? o:cargo()        // <-- 10  - 10

  // setget in harbour
  ? o:nTop           // <--  0  -  0
  ? o:nTop := 7      // <--  7  -  7
  ? o:nTop( 9 )      // <--  9  -  9
  ? o:nTop()         // <--  9  -  9

RETURN

but also in clipper if you wrote:

oTBrowse:addColumn := oTBColumns

it gives error.

So there are some point where Clipper permits to assign values using parenthesis and in other not, but surely because classes are implemented differently. In any case it permits to read a value using parenthesis.

Harbour already permits to read all using parenthesis.

The need is to permit assignment to a function assigning rvalue so:
o:AssignMethod := 1
it should be the same of
o:AssignMethod( 1 )

or

oTBrowse:addColumn := oTBColumns

In case of a var not exists with same name of a method (but today can it exists ?).

Best Regards

Francesco

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to