implementing datatype() in NetRexx (class Rexx *or* RexxUtil)

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

implementing datatype() in NetRexx (class Rexx *or* RexxUtil)

ThSITC
I do find it totally *irrational* that I cannot use a *standard NetRexx
Method* to return the
*well defined*, unique, DataType, by using this method in NetRexx!

In Rexx (any dialect except NetRexx), DataType (without parameters) does
*return* the DataType given.

In NetRexx, this (very special case, I admit) *is NOT supported* !

MFC, Kermit,

any reason WHY???

Shall and should be quite easily to implement, I (personally) think, and
would increase the
*compatibility* of the various Rexx Dialects of the Rexx Family of
Languages (I think, at least!)

Greetings from Vienna,

Thomas.
==================================================================================
--
Thomas Schneider, IT Consulting; http://www.thsitc.com; Vienna, Austria,
Europe

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: implementing datatype() in NetRexx (class Rexx *or* RexxUtil)

Kermit Kiser
Thomas --

That is actually a valid question and I have also wondered about it. But
as I learned from working on the Rexx class code, a Rexx object may be
internally stored in different data fields and formats because of the
different types of data it can hold and the different ways it can be
initialized. If needed at runtime it will be converted automatically to
other formats where possible. This avoids a complex and costly analysis
of each Rexx object at creation to attempt to convert it into all
possible datatypes. The consequence is that there is no internal field
that identifies the type of data currently stored and hence NetRexx does
not know the actual datatype of a Rexx variable's current content. Each
call to "DataType" thus runs only the needed tests to see if the current
data matches the requested type.

It might be possible to create a SELECT statement that tests all of the
possible data types and returns the first valid type but in reality you
would then have to test the returned value again to determine the
required processing, so you don't really gain anything.

If that is not clear, look at it this way - if I have a Rexx object that
I want to perform a certain operation with when the value is numeric,
here is what I would do using a no parameter DataType call:

type=rexxobject.DataType()
if type="N" then do_a_certain_operation

But that has simply converted the following instruction into two
instructions:

if rexxobject.DataType("N") then do_a_certain_operation

-- Kermit

BTW: In contrast to Object Rexx, NetRexx was not designed or intended to
be "compatible" with other Rexx dialects, but rather to be a more
efficient way to write Java programs.


On 3/28/2013 12:08 PM, Thomas Schneider wrote:

> I do find it totally *irrational* that I cannot use a *standard
> NetRexx Method* to return the
> *well defined*, unique, DataType, by using this method in NetRexx!
>
> In Rexx (any dialect except NetRexx), DataType (without parameters)
> does *return* the DataType given.
>
> In NetRexx, this (very special case, I admit) *is NOT supported* !
>
> MFC, Kermit,
>
> any reason WHY???
>
> Shall and should be quite easily to implement, I (personally) think,
> and would increase the
> *compatibility* of the various Rexx Dialects of the Rexx Family of
> Languages (I think, at least!)
>
> Greetings from Vienna,
>
> Thomas.
> ==================================================================================
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: implementing datatype() in NetRexx (class Rexx *or* RexxUtil)

ThSITC
Hi Kermit,
    When permitted, *I* shall look into that in detail after my current
release(s).

As I do know *classic Rexx* probably in some more detail than You (due
to age, only, of course), and did
fix all those issues of non-upwards compatibility, as far as possible,
with Rexx2Nrx, back in 2000, or so,
I simply am offering to assist you in those details (when Rene and You
want, only, of course).

At the minute, I'm only *publishing* those subtle *incompatibilities*
here for common recognition and discussion!

Thanks for your detailed follow up, as always, of course!

Take the free time coming along, at Easter 2013, Kermit.

And all my congrats to the great work You did, up so far!

Bye 4 now,
Thomas.
=======================================================================================
Am 29.03.2013 13:24, schrieb Kermit Kiser:

> Thomas --
>
> That is actually a valid question and I have also wondered about it.
> But as I learned from working on the Rexx class code, a Rexx object
> may be internally stored in different data fields and formats because
> of the different types of data it can hold and the different ways it
> can be initialized. If needed at runtime it will be converted
> automatically to other formats where possible. This avoids a complex
> and costly analysis of each Rexx object at creation to attempt to
> convert it into all possible datatypes. The consequence is that there
> is no internal field that identifies the type of data currently stored
> and hence NetRexx does not know the actual datatype of a Rexx
> variable's current content. Each call to "DataType" thus runs only the
> needed tests to see if the current data matches the requested type.
>
> It might be possible to create a SELECT statement that tests all of
> the possible data types and returns the first valid type but in
> reality you would then have to test the returned value again to
> determine the required processing, so you don't really gain anything.
>
> If that is not clear, look at it this way - if I have a Rexx object
> that I want to perform a certain operation with when the value is
> numeric, here is what I would do using a no parameter DataType call:
>
> type=rexxobject.DataType()
> if type="N" then do_a_certain_operation
>
> But that has simply converted the following instruction into two
> instructions:
>
> if rexxobject.DataType("N") then do_a_certain_operation
>
> -- Kermit
>
> BTW: In contrast to Object Rexx, NetRexx was not designed or intended
> to be "compatible" with other Rexx dialects, but rather to be a more
> efficient way to write Java programs.
>
>
> On 3/28/2013 12:08 PM, Thomas Schneider wrote:
>> I do find it totally *irrational* that I cannot use a *standard
>> NetRexx Method* to return the
>> *well defined*, unique, DataType, by using this method in NetRexx!
>>
>> In Rexx (any dialect except NetRexx), DataType (without parameters)
>> does *return* the DataType given.
>>
>> In NetRexx, this (very special case, I admit) *is NOT supported* !
>>
>> MFC, Kermit,
>>
>> any reason WHY???
>>
>> Shall and should be quite easily to implement, I (personally) think,
>> and would increase the
>> *compatibility* of the various Rexx Dialects of the Rexx Family of
>> Languages (I think, at least!)
>>
>> Greetings from Vienna,
>>
>> Thomas.
>> ==================================================================================
>>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>


--
Thomas Schneider, IT Consulting; http://www.thsitc.com; Vienna, Austria,
Europe

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com