Re: [] (array access)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [] (array access)

Mike Cowlishaw-2
There's no methods with those names, but nothing stops you writing your own
(with different names).  Or NetRexx will provide them if you declare your array
as an indirect property. For example (untested):

  class foo
     properties indirect
      bar=int[5]

See the NetRexx supplement for details.

Mike Cowlishaw, IBM Fellow, IBM UK Laboratories
mailto:[hidden email]   [http://www2.hursley.ibm.com]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: [] (array access)

Andreas Zieritz
>There's no methods with those names, but nothing stops you writing your own
>(with different names).  Or NetRexx will provide them if you declare your
array
>as an indirect property. For example (untested):
>
>  class foo
>     properties indirect
>      bar=int[5]
>
>See the NetRexx supplement for details.

I've read the supplement but that is not exactly what I thought of

        - it does only work with single indexed arrays
        - one has to use the getx... and set... methods


In Object Rexx I can use the '[]' and '[]=' methods in a way, that allows
me to use the objects very easy

(not tested)
a = .Matrix¨new
a[1,1]=2
say a[1,1]


class Matrix

::method '[]'
        expose theMatrix
        use arg a, b
        return theMatrix[a,b]

::method '[]='
        expose theMatrix
        use arg a, b, c
        theMatrix[a,b] = c

*****************

I could write a method in Netrexx, that takes 2 (3) variables, but I don't
think I could make the calls as easy as in Object Rexx.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: [] (array access)

dIon Gillard/Multitask Consulting/AU
In reply to this post by Mike Cowlishaw-2
On Wed, 18 Feb 1998 09:10:53 +0100, Andreas Zieritz wrote:

|   >There's no methods with those names, but nothing stops you writing your own
|   >(with different names).  Or NetRexx will provide them if you declare your
|   array
|   >as an indirect property. For example (untested):
|   >
|   >  class foo
|   >     properties indirect
|   >      bar=int[5]
|   >
|   >See the NetRexx supplement for details.
|  
|   I've read the supplement but that is not exactly what I thought of
|  
|   - it does only work with single indexed arrays
|   - one has to use the getx... and set... methods
|  
|  
|   In Object Rexx I can use the '[]' and '[]=' methods in a way, that allows
|   me to use the objects very easy
|  
|   (not tested)
|   a = .Matrix new
|   a[1,1]=2
|   say a[1,1]

Out of curiosity, why not inherit from netrexx.lang.Rexx. It already has these methods available for you....It may work (i've
not tested it....)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>