Bit and Bits arithmetic in Rexx

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

Bit and Bits arithmetic in Rexx

ThSITC
Hello there,

    as Kermit did now enhance class Rexx in his after 3.1 version,
so that it may be properly subclassed, I would now like to intruduce
classes RexxBits and RexxStem as Subclasses of Rexx.

    proposed Syntax will be:

    a=RexxBits(15)  -- implemented as a Short with max 15 Bits
    b=RexxBits(16)  -- implemented as a Short with max.16 Bits

    c=RexxBits(20)  -- implemented as an Integer with max 20 bits
    d=RexxBits(32)  -- detto.

    e=RexxBits(37) -- implemented as a Long with max 37 bits
    f =RexxBits(64) -- implemented as a Long with max 64 bits

64 bits is the maximum, e g.

    h=RexxBits(77) -- will give an erro, with the current implementation.

Questions:

(a) shall this class be named RexxBits (as it currently is), or simply
Bits ?
(b) does there already exist any Java class doing this?

The intention is, that the Rexx operators *and* (&), *or* (|), and *xor*
(&&)
shall get the usual BINARY LOGIC meaning, when EITHER of the operands
is a RexxBits (Bits) Object.

What do you think about this proposed language enhancement ??.

Thomas Schneider.

PS: this would:

(a) clarify IN the declaration that a set of blags are store in a
RexxBits variable.

(b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits variables) are
used.

--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge
Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team
(www.netrexx.org)

_______________________________________________
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: Bit and Bits arithmetic in Rexx

Patric Bechtel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Thomas,

there's java.util.BitSet. It will play nicely with >64 bits even.

Thomas Schneider schrieb am 30.10.2011 13:49:

> Hello there,
>
> as Kermit did now enhance class Rexx in his after 3.1 version, so
> that it may be properly subclassed, I would now like to intruduce
> classes RexxBits and RexxStem as Subclasses of Rexx.
>
> proposed Syntax will be:
>
> a=RexxBits(15)  -- implemented as a Short with max 15 Bits
> b=RexxBits(16)  -- implemented as a Short with max.16 Bits
>
> c=RexxBits(20)  -- implemented as an Integer with max 20 bits
> d=RexxBits(32)  -- detto.
>
> e=RexxBits(37) -- implemented as a Long with max 37 bits f
> =RexxBits(64) -- implemented as a Long with max 64 bits
>
> 64 bits is the maximum, e g.
>
> h=RexxBits(77) -- will give an erro, with the current
> implementation.
>
> Questions:
>
> (a) shall this class be named RexxBits (as it currently is), or
> simply Bits ? (b) does there already exist any Java class doing
> this?
>
> The intention is, that the Rexx operators *and* (&), *or* (|), and
> *xor* (&&) shall get the usual BINARY LOGIC meaning, when EITHER of
> the operands is a RexxBits (Bits) Object.
>
> What do you think about this proposed language enhancement ??.
>
> Thomas Schneider.
>
> PS: this would:
>
> (a) clarify IN the declaration that a set of blags are store in a
> RexxBits variable.
>
> (b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits
> variables) are used.
>

- --
cu, Patric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: GnuPT 2.5.2

iEYEARECAAYFAk6tUxYACgkQfGgGu8y7ypCF8QCgpdda6fMXkUZd8mfKEY4yc+Hr
5MQAoI71lzOANe+Q4eFALl+Pc7nL6CQx
=cY6O
-----END PGP SIGNATURE-----
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Bit and Bits arithmetic in Rexx

ThSITC
Hello Patric,

    (a) thanks for your hint. Din't know. Will print out the Java Docs.

    (b) do you know wether NetRexx Binary op's and, or, xor do properly
handle Java BitSets ?

    (c) I will. however, proceed to write a couple of NetRexx test
programs, when you cannot answer  it by brain ... ;-)

I personally feel that NetRexx shall be able to handle BitSets properly.

Will now proceed to printout the Java docs and adapt my RexxBits class
anyway (as I'm using it a lot, not beeing aware about BitsSets, however :-()
.
Also, my feeling is that NRL3.pdf would need a section about this (Chip,
what do you say ??)

Thomas.
===========================================================
Am 30.10.2011 14:37, schrieb Patric Bechtel:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Thomas,
>
> there's java.util.BitSet. It will play nicely with>64 bits even.
>
> Thomas Schneider schrieb am 30.10.2011 13:49:
>> Hello there,
>>
>> as Kermit did now enhance class Rexx in his after 3.1 version, so
>> that it may be properly subclassed, I would now like to intruduce
>> classes RexxBits and RexxStem as Subclasses of Rexx.
>>
>> proposed Syntax will be:
>>
>> a=RexxBits(15)  -- implemented as a Short with max 15 Bits
>> b=RexxBits(16)  -- implemented as a Short with max.16 Bits
>>
>> c=RexxBits(20)  -- implemented as an Integer with max 20 bits
>> d=RexxBits(32)  -- detto.
>>
>> e=RexxBits(37) -- implemented as a Long with max 37 bits f
>> =RexxBits(64) -- implemented as a Long with max 64 bits
>>
>> 64 bits is the maximum, e g.
>>
>> h=RexxBits(77) -- will give an erro, with the current
>> implementation.
>>
>> Questions:
>>
>> (a) shall this class be named RexxBits (as it currently is), or
>> simply Bits ? (b) does there already exist any Java class doing
>> this?
>>
>> The intention is, that the Rexx operators *and* (&), *or* (|), and
>> *xor* (&&) shall get the usual BINARY LOGIC meaning, when EITHER of
>> the operands is a RexxBits (Bits) Object.
>>
>> What do you think about this proposed language enhancement ??.
>>
>> Thomas Schneider.
>>
>> PS: this would:
>>
>> (a) clarify IN the declaration that a set of blags are store in a
>> RexxBits variable.
>>
>> (b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits
>> variables) are used.
>>
> - --
> cu, Patric
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: GnuPT 2.5.2
>
> iEYEARECAAYFAk6tUxYACgkQfGgGu8y7ypCF8QCgpdda6fMXkUZd8mfKEY4yc+Hr
> 5MQAoI71lzOANe+Q4eFALl+Pc7nL6CQx
> =cY6O
> -----END PGP SIGNATURE-----
>


--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge
Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team
(www.netrexx.org)

_______________________________________________
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: Bit and Bits arithmetic in Rexx

Jeff Hennick
In reply to this post by ThSITC
Should such a proposal be implemented at whatever level, and I'm not taking any stand on that now, I respectively suggest that in the spirit of Rexx, that there NOT be a maximum of 64 or any other number.   The specific implementation details should not be considered when a new NetRexx feature is proposed or even defined, only the "problem to be solved."

Reread Design Principles in M.F.C.'s The Rexx Language, where he states "Documentation before implementation."

In this case, also remember one of the Fundamental Language Concepts is "No defined size or shape limits."

Jeff Hennick

On 10/30/2011 8:49 AM, Thomas Schneider wrote:
Hello there,

   as Kermit did now enhance class Rexx in his after 3.1 version,
so that it may be properly subclassed, I would now like to intruduce classes RexxBits and RexxStem as Subclasses of Rexx.

   proposed Syntax will be:

   a=RexxBits(15)  -- implemented as a Short with max 15 Bits
   b=RexxBits(16)  -- implemented as a Short with max.16 Bits

   c=RexxBits(20)  -- implemented as an Integer with max 20 bits
   d=RexxBits(32)  -- detto.

   e=RexxBits(37) -- implemented as a Long with max 37 bits
   f =RexxBits(64) -- implemented as a Long with max 64 bits

64 bits is the maximum, e g.

   h=RexxBits(77) -- will give an erro, with the current implementation.

Questions:

(a) shall this class be named RexxBits (as it currently is), or simply Bits ?
(b) does there already exist any Java class doing this?

The intention is, that the Rexx operators *and* (&), *or* (|), and *xor* (&&)
shall get the usual BINARY LOGIC meaning, when EITHER of the operands
is a RexxBits (Bits) Object.

What do you think about this proposed language enhancement ??.

Thomas Schneider.

PS: this would:

(a) clarify IN the declaration that a set of blags are store in a RexxBits variable.

(b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits variables) are used.



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

Reply | Threaded
Open this post in threaded view
|

Re: Bit and Bits arithmetic in Rexx

Patric Bechtel
In reply to this post by ThSITC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Thomas,

a) don't print it out. Read it. No need to kill trees for that.
b) nope. That would be another language enhancements: operator
overloading. Neither can your RexxBits, btw.

Why do you think that it needs a section about that?

Thomas Schneider schrieb am 30.10.2011 14:53:

> Hello Patric,
>
> (a) thanks for your hint. Din't know. Will print out the Java
> Docs.
>
> (b) do you know wether NetRexx Binary op's and, or, xor do
> properly handle Java BitSets ?
>
> (c) I will. however, proceed to write a couple of NetRexx test
> programs, when you cannot answer  it by brain ... ;-)
>
> I personally feel that NetRexx shall be able to handle BitSets
> properly.
>
> Will now proceed to printout the Java docs and adapt my RexxBits
> class anyway (as I'm using it a lot, not beeing aware about
> BitsSets, however :-() . Also, my feeling is that NRL3.pdf would
> need a section about this (Chip, what do you say ??)
>
> Thomas.
> =========================================================== Am
> 30.10.2011 14:37, schrieb Patric Bechtel: Hi Thomas,
>
> there's java.util.BitSet. It will play nicely with>64 bits even.
>
> Thomas Schneider schrieb am 30.10.2011 13:49:
>>>> Hello there,
>>>>
>>>> as Kermit did now enhance class Rexx in his after 3.1
>>>> version, so that it may be properly subclassed, I would now
>>>> like to intruduce classes RexxBits and RexxStem as Subclasses
>>>> of Rexx.
>>>>
>>>> proposed Syntax will be:
>>>>
>>>> a=RexxBits(15)  -- implemented as a Short with max 15 Bits
>>>> b=RexxBits(16)  -- implemented as a Short with max.16 Bits
>>>>
>>>> c=RexxBits(20)  -- implemented as an Integer with max 20
>>>> bits d=RexxBits(32)  -- detto.
>>>>
>>>> e=RexxBits(37) -- implemented as a Long with max 37 bits f
>>>> =RexxBits(64) -- implemented as a Long with max 64 bits
>>>>
>>>> 64 bits is the maximum, e g.
>>>>
>>>> h=RexxBits(77) -- will give an erro, with the current
>>>> implementation.
>>>>
>>>> Questions:
>>>>
>>>> (a) shall this class be named RexxBits (as it currently is),
>>>> or simply Bits ? (b) does there already exist any Java class
>>>> doing this?
>>>>
>>>> The intention is, that the Rexx operators *and* (&), *or*
>>>> (|), and *xor* (&&) shall get the usual BINARY LOGIC meaning,
>>>> when EITHER of the operands is a RexxBits (Bits) Object.
>>>>
>>>> What do you think about this proposed language enhancement
>>>> ??.
>>>>
>>>> Thomas Schneider.
>>>>
>>>> PS: this would:
>>>>
>>>> (a) clarify IN the declaration that a set of blags are store
>>>> in a RexxBits variable.
>>>>
>>>> (b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits
>>>> variables) are used.
>>>>
> -- cu, Patric
>>
>
>

- --
cu, Patric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: GnuPT 2.5.2

iEYEARECAAYFAk6ta6cACgkQfGgGu8y7ypDbRgCfRbLsrr+j2AuW0+6tEdCT/cDi
HTEAoOgpoNaw+8oTc+sVjWlvv759G6ne
=2gZw
-----END PGP SIGNATURE-----
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Bit and Bits arithmetic in Rexx

ThSITC
In reply to this post by Jeff Hennick
Hello Jeff,
   (1) I do apprepriate your comment about the Limits.
   (2) Patric Bechtel did gave me the hint about Java's class BitSet (in Java Utils). i'm just making some initial tests of that. Major difference to my current RexxBits is that I'm numbering bits from 1 to 32, but BitSet does use
0 to 31. I'm just trying to see wether the *and*, *or*, and *xor* Operators do work with BitSet's, and, when not, where MFC's Code would need modification.

Question: What would YOU prefer there at IBM-Netrexx: Numbering the Bits
0 to 31 (as Java does) *or* 1 to 32 (as current rexxBits does) ??

As I haven't yet *officially* released RexxBits, I can even change it
in my own current personal usage ...

RexxBits also has shiftr (shift Right), shiftl (shift Left) etc, as I have been used to these routines from earlier systems I did work on ... 

  (3) as I need to learn SVN now with the utmost priority for beeing able to maintain my contributions to org.netrexx (compatibility.jar and utils.jar),
I might later be able to make this modification (in synchronization with Kermit's progress) when need arises. I'm now nearly thru with reading Mike's code... :-)

I'm happy I do understand already a bit ...

Have a nice Sunday, and thanks,
Thomas.
========================================================


   
Am 30.10.2011 15:03, schrieb Jeff Hennick:
Should such a proposal be implemented at whatever level, and I'm not taking any stand on that now, I respectively suggest that in the spirit of Rexx, that there NOT be a maximum of 64 or any other number.   The specific implementation details should not be considered when a new NetRexx feature is proposed or even defined, only the "problem to be solved."

Reread Design Principles in M.F.C.'s The Rexx Language, where he states "Documentation before implementation."

In this case, also remember one of the Fundamental Language Concepts is "No defined size or shape limits."

Jeff Hennick

On 10/30/2011 8:49 AM, Thomas Schneider wrote:
Hello there,

   as Kermit did now enhance class Rexx in his after 3.1 version,
so that it may be properly subclassed, I would now like to intruduce classes RexxBits and RexxStem as Subclasses of Rexx.

   proposed Syntax will be:

   a=RexxBits(15)  -- implemented as a Short with max 15 Bits
   b=RexxBits(16)  -- implemented as a Short with max.16 Bits

   c=RexxBits(20)  -- implemented as an Integer with max 20 bits
   d=RexxBits(32)  -- detto.

   e=RexxBits(37) -- implemented as a Long with max 37 bits
   f =RexxBits(64) -- implemented as a Long with max 64 bits

64 bits is the maximum, e g.

   h=RexxBits(77) -- will give an erro, with the current implementation.

Questions:

(a) shall this class be named RexxBits (as it currently is), or simply Bits ?
(b) does there already exist any Java class doing this?

The intention is, that the Rexx operators *and* (&), *or* (|), and *xor* (&&)
shall get the usual BINARY LOGIC meaning, when EITHER of the operands
is a RexxBits (Bits) Object.

What do you think about this proposed language enhancement ??.

Thomas Schneider.

PS: this would:

(a) clarify IN the declaration that a set of blags are store in a RexxBits variable.

(b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits variables) are used.




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



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
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: Bit and Bits arithmetic in Rexx

Jeff Hennick
I am not sure how your proposed RexxBits class differs from a Binary String.

See http://www-01.ibm.com/software/awdtools/netrexx/library/nrlbinar.html#refbinary
Logical operations (and, or, and exclusive or) apply to all the bits of the operands, ...
While arrays are zero based, substr is one based, for example:
'abc'.substr(2) => 'bc'
( http://www-01.ibm.com/software/awdtools/netrexx/library/nrlrexxc.html#substr )

Since you would need to use substr to read a particular bit, I'd say that is the way to go.

Jeff

On 10/30/2011 12:37 PM, Thomas Schneider wrote:
Hello Jeff,
   (1) I do apprepriate your comment about the Limits.
   (2) Patric Bechtel did gave me the hint about Java's class BitSet (in Java Utils). i'm just making some initial tests of that. Major difference to my current RexxBits is that I'm numbering bits from 1 to 32, but BitSet does use
0 to 31. I'm just trying to see wether the *and*, *or*, and *xor* Operators do work with BitSet's, and, when not, where MFC's Code would need modification.

Question: What would YOU prefer there at IBM-Netrexx: Numbering the Bits
0 to 31 (as Java does) *or* 1 to 32 (as current rexxBits does) ??

As I haven't yet *officially* released RexxBits, I can even change it
in my own current personal usage ...

RexxBits also has shiftr (shift Right), shiftl (shift Left) etc, as I have been used to these routines from earlier systems I did work on ... 

  (3) as I need to learn SVN now with the utmost priority for beeing able to maintain my contributions to org.netrexx (compatibility.jar and utils.jar),
I might later be able to make this modification (in synchronization with Kermit's progress) when need arises. I'm now nearly thru with reading Mike's code... :-)

I'm happy I do understand already a bit ...

Have a nice Sunday, and thanks,
Thomas.
========================================================


   
Am 30.10.2011 15:03, schrieb Jeff Hennick:
Should such a proposal be implemented at whatever level, and I'm not taking any stand on that now, I respectively suggest that in the spirit of Rexx, that there NOT be a maximum of 64 or any other number.   The specific implementation details should not be considered when a new NetRexx feature is proposed or even defined, only the "problem to be solved."

Reread Design Principles in M.F.C.'s The Rexx Language, where he states "Documentation before implementation."

In this case, also remember one of the Fundamental Language Concepts is "No defined size or shape limits."

Jeff Hennick

On 10/30/2011 8:49 AM, Thomas Schneider wrote:
Hello there,

   as Kermit did now enhance class Rexx in his after 3.1 version,
so that it may be properly subclassed, I would now like to intruduce classes RexxBits and RexxStem as Subclasses of Rexx.

   proposed Syntax will be:

   a=RexxBits(15)  -- implemented as a Short with max 15 Bits
   b=RexxBits(16)  -- implemented as a Short with max.16 Bits

   c=RexxBits(20)  -- implemented as an Integer with max 20 bits
   d=RexxBits(32)  -- detto.

   e=RexxBits(37) -- implemented as a Long with max 37 bits
   f =RexxBits(64) -- implemented as a Long with max 64 bits

64 bits is the maximum, e g.

   h=RexxBits(77) -- will give an erro, with the current implementation.

Questions:

(a) shall this class be named RexxBits (as it currently is), or simply Bits ?
(b) does there already exist any Java class doing this?

The intention is, that the Rexx operators *and* (&), *or* (|), and *xor* (&&)
shall get the usual BINARY LOGIC meaning, when EITHER of the operands
is a RexxBits (Bits) Object.

What do you think about this proposed language enhancement ??.

Thomas Schneider.

PS: this would:

(a) clarify IN the declaration that a set of blags are store in a RexxBits variable.

(b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits variables) are used.




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



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)


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



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

Reply | Threaded
Open this post in threaded view
|

Re: Bit and Bits arithmetic in Rexx

ThSITC
RexxBits *currently* uses a function oriented style, having the primitive variable holding
the Bits (maybe byte,short,int,long) *or* a Rexx variable as the first parameter.

The functions are straightforward, as or,and,xor,not, set,clear,shiftl,shiftr,  etc.

I will now modify RexxBits to allow Java BitSets as a parameter as well.

My question only was, that I'm numbering the Bits 1,2,...  size (depends of size of first arg)
and wether I should stay with this, or not ...

Current source is on Project NetRexx at Kenai, under package org.netrexx.thsitc,runtime.compatibility.

I'm currently in process to release this package for downloading from org.netrexx.

It is now open sourced under the ICU license.
 
Thomas.
=============================================================================

Am 30.10.2011 22:45, schrieb Jeff Hennick:
I am not sure how your proposed RexxBits class differs from a Binary String.

See http://www-01.ibm.com/software/awdtools/netrexx/library/nrlbinar.html#refbinary
Logical operations (and, or, and exclusive or) apply to all the bits of the operands, ...
While arrays are zero based, substr is one based, for example:
'abc'.substr(2) => 'bc'
( http://www-01.ibm.com/software/awdtools/netrexx/library/nrlrexxc.html#substr )

Since you would need to use substr to read a particular bit, I'd say that is the way to go.

Jeff

On 10/30/2011 12:37 PM, Thomas Schneider wrote:
Hello Jeff,
   (1) I do apprepriate your comment about the Limits.
   (2) Patric Bechtel did gave me the hint about Java's class BitSet (in Java Utils). i'm just making some initial tests of that. Major difference to my current RexxBits is that I'm numbering bits from 1 to 32, but BitSet does use
0 to 31. I'm just trying to see wether the *and*, *or*, and *xor* Operators do work with BitSet's, and, when not, where MFC's Code would need modification.

Question: What would YOU prefer there at IBM-Netrexx: Numbering the Bits
0 to 31 (as Java does) *or* 1 to 32 (as current rexxBits does) ??

As I haven't yet *officially* released RexxBits, I can even change it
in my own current personal usage ...

RexxBits also has shiftr (shift Right), shiftl (shift Left) etc, as I have been used to these routines from earlier systems I did work on ... 

  (3) as I need to learn SVN now with the utmost priority for beeing able to maintain my contributions to org.netrexx (compatibility.jar and utils.jar),
I might later be able to make this modification (in synchronization with Kermit's progress) when need arises. I'm now nearly thru with reading Mike's code... :-)

I'm happy I do understand already a bit ...

Have a nice Sunday, and thanks,
Thomas.
========================================================


   
Am 30.10.2011 15:03, schrieb Jeff Hennick:
Should such a proposal be implemented at whatever level, and I'm not taking any stand on that now, I respectively suggest that in the spirit of Rexx, that there NOT be a maximum of 64 or any other number.   The specific implementation details should not be considered when a new NetRexx feature is proposed or even defined, only the "problem to be solved."

Reread Design Principles in M.F.C.'s The Rexx Language, where he states "Documentation before implementation."

In this case, also remember one of the Fundamental Language Concepts is "No defined size or shape limits."

Jeff Hennick

On 10/30/2011 8:49 AM, Thomas Schneider wrote:
Hello there,

   as Kermit did now enhance class Rexx in his after 3.1 version,
so that it may be properly subclassed, I would now like to intruduce classes RexxBits and RexxStem as Subclasses of Rexx.

   proposed Syntax will be:

   a=RexxBits(15)  -- implemented as a Short with max 15 Bits
   b=RexxBits(16)  -- implemented as a Short with max.16 Bits

   c=RexxBits(20)  -- implemented as an Integer with max 20 bits
   d=RexxBits(32)  -- detto.

   e=RexxBits(37) -- implemented as a Long with max 37 bits
   f =RexxBits(64) -- implemented as a Long with max 64 bits

64 bits is the maximum, e g.

   h=RexxBits(77) -- will give an erro, with the current implementation.

Questions:

(a) shall this class be named RexxBits (as it currently is), or simply Bits ?
(b) does there already exist any Java class doing this?

The intention is, that the Rexx operators *and* (&), *or* (|), and *xor* (&&)
shall get the usual BINARY LOGIC meaning, when EITHER of the operands
is a RexxBits (Bits) Object.

What do you think about this proposed language enhancement ??.

Thomas Schneider.

PS: this would:

(a) clarify IN the declaration that a set of blags are store in a RexxBits variable.

(b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits variables) are used.




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



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)


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




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



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
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: Bit and Bits arithmetic in Rexx

ThSITC
In reply to this post by Jeff Hennick
Jeff, and all,
   using a STRING based implementation of BitSet's is very slow...
Thus I'm using byte,short,int,long currently.
  Didn't (at least in my code) have the need for more than 64 flags currently
for one variable. I will, however, extend this to use java BitSet' as well, so that in Fact
the number of Bits available is practically unlimited.
  Will be very handy when we implement Java ENUM's in NetRexx.
Thomas.
=================================================================


.
Am 30.10.2011 22:45, schrieb Jeff Hennick:
I am not sure how your proposed RexxBits class differs from a Binary String.

See http://www-01.ibm.com/software/awdtools/netrexx/library/nrlbinar.html#refbinary
Logical operations (and, or, and exclusive or) apply to all the bits of the operands, ...
While arrays are zero based, substr is one based, for example:
'abc'.substr(2) => 'bc'
( http://www-01.ibm.com/software/awdtools/netrexx/library/nrlrexxc.html#substr )

Since you would need to use substr to read a particular bit, I'd say that is the way to go.

Jeff

On 10/30/2011 12:37 PM, Thomas Schneider wrote:
Hello Jeff,
   (1) I do apprepriate your comment about the Limits.
   (2) Patric Bechtel did gave me the hint about Java's class BitSet (in Java Utils). i'm just making some initial tests of that. Major difference to my current RexxBits is that I'm numbering bits from 1 to 32, but BitSet does use
0 to 31. I'm just trying to see wether the *and*, *or*, and *xor* Operators do work with BitSet's, and, when not, where MFC's Code would need modification.

Question: What would YOU prefer there at IBM-Netrexx: Numbering the Bits
0 to 31 (as Java does) *or* 1 to 32 (as current rexxBits does) ??

As I haven't yet *officially* released RexxBits, I can even change it
in my own current personal usage ...

RexxBits also has shiftr (shift Right), shiftl (shift Left) etc, as I have been used to these routines from earlier systems I did work on ... 

  (3) as I need to learn SVN now with the utmost priority for beeing able to maintain my contributions to org.netrexx (compatibility.jar and utils.jar),
I might later be able to make this modification (in synchronization with Kermit's progress) when need arises. I'm now nearly thru with reading Mike's code... :-)

I'm happy I do understand already a bit ...

Have a nice Sunday, and thanks,
Thomas.
========================================================


   
Am 30.10.2011 15:03, schrieb Jeff Hennick:
Should such a proposal be implemented at whatever level, and I'm not taking any stand on that now, I respectively suggest that in the spirit of Rexx, that there NOT be a maximum of 64 or any other number.   The specific implementation details should not be considered when a new NetRexx feature is proposed or even defined, only the "problem to be solved."

Reread Design Principles in M.F.C.'s The Rexx Language, where he states "Documentation before implementation."

In this case, also remember one of the Fundamental Language Concepts is "No defined size or shape limits."

Jeff Hennick

On 10/30/2011 8:49 AM, Thomas Schneider wrote:
Hello there,

   as Kermit did now enhance class Rexx in his after 3.1 version,
so that it may be properly subclassed, I would now like to intruduce classes RexxBits and RexxStem as Subclasses of Rexx.

   proposed Syntax will be:

   a=RexxBits(15)  -- implemented as a Short with max 15 Bits
   b=RexxBits(16)  -- implemented as a Short with max.16 Bits

   c=RexxBits(20)  -- implemented as an Integer with max 20 bits
   d=RexxBits(32)  -- detto.

   e=RexxBits(37) -- implemented as a Long with max 37 bits
   f =RexxBits(64) -- implemented as a Long with max 64 bits

64 bits is the maximum, e g.

   h=RexxBits(77) -- will give an erro, with the current implementation.

Questions:

(a) shall this class be named RexxBits (as it currently is), or simply Bits ?
(b) does there already exist any Java class doing this?

The intention is, that the Rexx operators *and* (&), *or* (|), and *xor* (&&)
shall get the usual BINARY LOGIC meaning, when EITHER of the operands
is a RexxBits (Bits) Object.

What do you think about this proposed language enhancement ??.

Thomas Schneider.

PS: this would:

(a) clarify IN the declaration that a set of blags are store in a RexxBits variable.

(b) avoid the need of OPTIONS BINARY when FLAGS (RexxBits variables) are used.




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



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)


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




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



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
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