I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT SHIFT
operator for all kind of integers (byte, short, int, long) will be worthwhile. As '<<' (for left shift, as in Bob's PYTHON sample code) and '>>' (for right shift) *are already* occupied by the respective *STRICT COMPARISON Operator's* in Rexx and NetRexx, I'm proposing to use: '<<<' for LEFT SHIFT '>>>' for RIGHT SHIFT This would allow for quick TYPING. Also, the '^' operator should be defined as a synonym to the cryptic '&&' for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be used (might be used) as the UNARY NOT operator. What do you think? Thomas. -- 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 |
On 10/1/11 09:07 Thomas Schneider said:
> I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT SHIFT > operator for all kind of integers (byte, short, int, long) will be > worthwhile. > > As '<<' (for left shift, as in Bob's PYTHON sample code) > and '>>' (for right shift) > > *are already* occupied by the respective *STRICT COMPARISON Operator's* > in Rexx and NetRexx, > > I'm proposing to use: > > '<<<' for LEFT SHIFT > '>>>' for RIGHT SHIFT > > This would allow for quick TYPING. > > Also, the '^' operator should be defined as a synonym to the cryptic '&&' > for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be used > (might be used) as the UNARY NOT operator. > > What do you think? <sarcasm level=dripping> You gotta be kidding me. The caret (^) should not be used as an XOR operator because, due to its position on the keyboard <shift-6> it has been used for years by many (mostly Unix) implementations of Rexx as a NOT operator, making it much more appropriate as a secondary glyph for the _one, true, NOT-sign_ reverse-virgule (\). OTOH, many languages use the caret as a power operator, so if we allowed that instead of the already overloaded asterisk (*) in exponentiation (**) we could save a character. That would leave the tilde (~) available as a secondary glyph for the XOR operator. Furthermore, since there are logical operations that missing from Rexx/NetRexx, why don't we use the NOT sign to signify the negation of the result of a logical operation? This would give us the ability to easily specify NAND, NOR, and XNOR logical operations: NOR: A \| B == \(A | B) == (\A & \B) NAND: A \& B == \(A & B) == (\A | \B) XNOR: A \~ B == \(A ~ B) == (\A && \B) Better yet, let's save the tilde for a really useful operator, the three-state logic gate: A & B ~ G & C == (A & C) iff G=0 A & B ~ G & C == (A & B & C) iff G=1 Just think how much simpler this makes NetRexx programming of convoluted logic problems, and how much easier it makes it for the novice programmer to understand the language! Just think how much easier it will be to explain logical operators to neophytes. Just think how easy it will be to write totally indecipherable NetRexx! Just think how many better things the developers have to do with their limited time and energy. What part of Mike's (self-)admonition to "Keep the language SMALL!" do you fail to comprehend? There is ABSOLUTELY NO NEED for an additional glyph for the XOR or NOT operators! The very existence of the Rexx Built-in Functions was an incredibly prescient decision to extract all the inessential but "nice to have" functionality from the language proper and place it where it won't be accidentally invoked by the novice programmer. That (the Netrexx equivalent) is where your proposals should go, and that does not require that you get any feedback or permission from the NetRexx developers. Can you not create a 'shift' method to do what you want to do? Why do you persist in petitioning to change the fundamentally lean and muscular body of NetRexx with features you can easily add in an object-oriented way? Your Fiat must have a luggage rack, trailer hitch, air horn, 300kph speedometer, fog lamps, and fuzzy dice hanging from the rear-view mirror. </sarcasm> Thomas, for the record, I will oppose every attempt by you to simply add complexity to the NetRexx language just because {some lesser language} has it. -Chip- _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by ThSITC
While I like the idea of logical operations in order to inter-operate
with other languages like Java that use binary types, I am not sure the shift operators are needed - NetRexx already has them albeit as 4 characters: left shift = *2** right shift = %2** You can use them to create shift methods if you want: ---------------------- NetRexx code ----------------------------- d = int 5 say d "=" Rexx(d).d2x.x2b say "left 1" shiftleft(d,1).d2x.x2b say "left 2" shiftleft(d,2).d2x.x2b say "left 3" shiftleft(d,3).d2x.x2b say "left 4" shiftleft(d,4).d2x.x2b say "right 1" shiftright(d,1).d2x.x2b say "right 2" shiftright(d,2).d2x.x2b say "right 3" shiftright(d,3).d2x.x2b d=shiftleft(d,1) say d d=shiftleft(d,1) say d method shiftleft(d,s) static return d*2**s method shiftright(d,s) static return d%2**s ----------------------- output log ------------------------------------ 5 = 0101 left 1 1010 left 2 00010100 left 3 00101000 left 4 01010000 right 1 0010 right 2 0001 right 3 0000 10 20 ------------------------------------------------------------------------ -- KK On 10/1/2011 2:07 AM, Thomas Schneider wrote: > I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT SHIFT > operator for all kind of integers (byte, short, int, long) will be > worthwhile. > > As '<<' (for left shift, as in Bob's PYTHON sample code) > and '>>' (for right shift) > > *are already* occupied by the respective *STRICT COMPARISON Operator's* > in Rexx and NetRexx, > > I'm proposing to use: > > '<<<' for LEFT SHIFT > '>>>' for RIGHT SHIFT > > This would allow for quick TYPING. > > Also, the '^' operator should be defined as a synonym to the cryptic '&&' > for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be used > (might be used) as the UNARY NOT operator. > > What do you think? > > Thomas. > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Kermit, Chip, and all.
You are *most probably rigth*. But then, I thing, we should have 'shiftl' (for shift Left) and 'shiftr' (for shift right) as STANDARD Methods in the Rexx Class, please. I personally do use the short names (shiftl, shiftr), as those have been the Names General Eletric Information Services (GEISCO) did use at GEISCO's MARK III Service, in FORTRAN 77, since 1974, so I'm accustomed to that abbreviations. By the way, all those functions are already implemented as FUNCTION's (not methods) in my class 'RexxBits' in my org.netrexx.thsitc.runtime.compatibility (since years) <grin> :-) Thomas Schneider. ===================================================================================== Am 02.10.2011 04:44, schrieb Kermit Kiser: > While I like the idea of logical operations in order to inter-operate > with other languages like Java that use binary types, I am not sure > the shift operators are needed - NetRexx already has them albeit as 4 > characters: > > left shift = *2** > right shift = %2** > > You can use them to create shift methods if you want: > ---------------------- NetRexx code ----------------------------- > d = int 5 > > say d "=" Rexx(d).d2x.x2b > > say "left 1" shiftleft(d,1).d2x.x2b > say "left 2" shiftleft(d,2).d2x.x2b > say "left 3" shiftleft(d,3).d2x.x2b > say "left 4" shiftleft(d,4).d2x.x2b > > say "right 1" shiftright(d,1).d2x.x2b > say "right 2" shiftright(d,2).d2x.x2b > say "right 3" shiftright(d,3).d2x.x2b > > d=shiftleft(d,1) > say d > d=shiftleft(d,1) > say d > > method shiftleft(d,s) static > return d*2**s > > method shiftright(d,s) static > return d%2**s > ----------------------- output log ------------------------------------ > > 5 = 0101 > left 1 1010 > left 2 00010100 > left 3 00101000 > left 4 01010000 > right 1 0010 > right 2 0001 > right 3 0000 > 10 > 20 > > ------------------------------------------------------------------------ > > -- KK > > > On 10/1/2011 2:07 AM, Thomas Schneider wrote: >> I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT SHIFT >> operator for all kind of integers (byte, short, int, long) will be >> worthwhile. >> >> As '<<' (for left shift, as in Bob's PYTHON sample code) >> and '>>' (for right shift) >> >> *are already* occupied by the respective *STRICT COMPARISON Operator's* >> in Rexx and NetRexx, >> >> I'm proposing to use: >> >> '<<<' for LEFT SHIFT >> '>>>' for RIGHT SHIFT >> >> This would allow for quick TYPING. >> >> Also, the '^' operator should be defined as a synonym to the cryptic >> '&&' >> for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be used >> (might be used) as the UNARY NOT operator. >> >> What do you think? >> >> Thomas. >> > > _______________________________________________ > 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 |
You are not making sense again Thomas. What does "xyz".shiftleft(1) mean?
Rexx class objects are strings. Shift is a binary operation and only makes sense for binary objects like bytes, integers, etc. Shifting string objects is only going to give you garbage. -- KK On 10/2/2011 12:23 PM, Thomas Schneider wrote: > Kermit, Chip, and all. > > You are *most probably rigth*. > > But then, I thing, we should have 'shiftl' (for shift Left) and > 'shiftr' (for shift right) as STANDARD Methods > in the Rexx Class, please. > > I personally do use the short names (shiftl, shiftr), as those have > been the Names General Eletric Information Services (GEISCO) > did use at GEISCO's MARK III Service, in FORTRAN 77, since 1974, so > I'm accustomed to that abbreviations. > > By the way, all those functions are already implemented as FUNCTION's > (not methods) in my class 'RexxBits' in my > > org.netrexx.thsitc.runtime.compatibility > > (since years) <grin> :-) > > Thomas Schneider. > ===================================================================================== > > > > > > Am 02.10.2011 04:44, schrieb Kermit Kiser: >> While I like the idea of logical operations in order to inter-operate >> with other languages like Java that use binary types, I am not sure >> the shift operators are needed - NetRexx already has them albeit as 4 >> characters: >> >> left shift = *2** >> right shift = %2** >> >> You can use them to create shift methods if you want: >> ---------------------- NetRexx code ----------------------------- >> d = int 5 >> >> say d "=" Rexx(d).d2x.x2b >> >> say "left 1" shiftleft(d,1).d2x.x2b >> say "left 2" shiftleft(d,2).d2x.x2b >> say "left 3" shiftleft(d,3).d2x.x2b >> say "left 4" shiftleft(d,4).d2x.x2b >> >> say "right 1" shiftright(d,1).d2x.x2b >> say "right 2" shiftright(d,2).d2x.x2b >> say "right 3" shiftright(d,3).d2x.x2b >> >> d=shiftleft(d,1) >> say d >> d=shiftleft(d,1) >> say d >> >> method shiftleft(d,s) static >> return d*2**s >> >> method shiftright(d,s) static >> return d%2**s >> ----------------------- output log ------------------------------------ >> >> 5 = 0101 >> left 1 1010 >> left 2 00010100 >> left 3 00101000 >> left 4 01010000 >> right 1 0010 >> right 2 0001 >> right 3 0000 >> 10 >> 20 >> >> ------------------------------------------------------------------------ >> >> -- KK >> >> >> On 10/1/2011 2:07 AM, Thomas Schneider wrote: >>> I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT SHIFT >>> operator for all kind of integers (byte, short, int, long) will be >>> worthwhile. >>> >>> As '<<' (for left shift, as in Bob's PYTHON sample code) >>> and '>>' (for right shift) >>> >>> *are already* occupied by the respective *STRICT COMPARISON Operator's* >>> in Rexx and NetRexx, >>> >>> I'm proposing to use: >>> >>> '<<<' for LEFT SHIFT >>> '>>>' for RIGHT SHIFT >>> >>> This would allow for quick TYPING. >>> >>> Also, the '^' operator should be defined as a synonym to the cryptic >>> '&&' >>> for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be used >>> (might be used) as the UNARY NOT operator. >>> >>> What do you think? >>> >>> Thomas. >>> >> >> _______________________________________________ >> 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/ |
... and that is exactly why I've already proposed to allow Rexx methods
for primitive Java types ... Thomas. ======================================================== Am 02.10.2011 23:34, schrieb Kermit Kiser: > You are not making sense again Thomas. What does "xyz".shiftleft(1) mean? > > Rexx class objects are strings. Shift is a binary operation and only > makes sense for binary objects like bytes, integers, etc. Shifting > string objects is only going to give you garbage. > > -- KK > > > On 10/2/2011 12:23 PM, Thomas Schneider wrote: >> Kermit, Chip, and all. >> >> You are *most probably rigth*. >> >> But then, I thing, we should have 'shiftl' (for shift Left) and >> 'shiftr' (for shift right) as STANDARD Methods >> in the Rexx Class, please. >> >> I personally do use the short names (shiftl, shiftr), as those have >> been the Names General Eletric Information Services (GEISCO) >> did use at GEISCO's MARK III Service, in FORTRAN 77, since 1974, so >> I'm accustomed to that abbreviations. >> >> By the way, all those functions are already implemented as FUNCTION's >> (not methods) in my class 'RexxBits' in my >> >> org.netrexx.thsitc.runtime.compatibility >> >> (since years) <grin> :-) >> >> Thomas Schneider. >> ===================================================================================== >> >> >> >> >> >> Am 02.10.2011 04:44, schrieb Kermit Kiser: >>> While I like the idea of logical operations in order to >>> inter-operate with other languages like Java that use binary types, >>> I am not sure the shift operators are needed - NetRexx already has >>> them albeit as 4 characters: >>> >>> left shift = *2** >>> right shift = %2** >>> >>> You can use them to create shift methods if you want: >>> ---------------------- NetRexx code ----------------------------- >>> d = int 5 >>> >>> say d "=" Rexx(d).d2x.x2b >>> >>> say "left 1" shiftleft(d,1).d2x.x2b >>> say "left 2" shiftleft(d,2).d2x.x2b >>> say "left 3" shiftleft(d,3).d2x.x2b >>> say "left 4" shiftleft(d,4).d2x.x2b >>> >>> say "right 1" shiftright(d,1).d2x.x2b >>> say "right 2" shiftright(d,2).d2x.x2b >>> say "right 3" shiftright(d,3).d2x.x2b >>> >>> d=shiftleft(d,1) >>> say d >>> d=shiftleft(d,1) >>> say d >>> >>> method shiftleft(d,s) static >>> return d*2**s >>> >>> method shiftright(d,s) static >>> return d%2**s >>> ----------------------- output log ------------------------------------ >>> >>> 5 = 0101 >>> left 1 1010 >>> left 2 00010100 >>> left 3 00101000 >>> left 4 01010000 >>> right 1 0010 >>> right 2 0001 >>> right 3 0000 >>> 10 >>> 20 >>> >>> ------------------------------------------------------------------------ >>> >>> >>> -- KK >>> >>> >>> On 10/1/2011 2:07 AM, Thomas Schneider wrote: >>>> I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT >>>> SHIFT operator for all kind of integers (byte, short, int, long) >>>> will be worthwhile. >>>> >>>> As '<<' (for left shift, as in Bob's PYTHON sample code) >>>> and '>>' (for right shift) >>>> >>>> *are already* occupied by the respective *STRICT COMPARISON >>>> Operator's* >>>> in Rexx and NetRexx, >>>> >>>> I'm proposing to use: >>>> >>>> '<<<' for LEFT SHIFT >>>> '>>>' for RIGHT SHIFT >>>> >>>> This would allow for quick TYPING. >>>> >>>> Also, the '^' operator should be defined as a synonym to the >>>> cryptic '&&' >>>> for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be used >>>> (might be used) as the UNARY NOT operator. >>>> >>>> What do you think? >>>> >>>> Thomas. >>>> >>> >>> _______________________________________________ >>> 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 |
That is not likely to happen for at least three reasons:
1) It would greatly confuse new and unaware NetRexx programmers, especially those used to Java behavior. 2) It violates object programming principals (data encapsulation, etc.) and could cause logical or security problems. 3) It is not really needed since you can easily wrap Java items if you want to use NetRexx methods on them: java_integer=int 12345;say Rexx(java_integer).right(3) -- KK On 10/3/2011 4:43 AM, Thomas Schneider wrote: > ... and that is exactly why I've already proposed to allow Rexx > methods for primitive Java types ... > > Thomas. > ======================================================== > Am 02.10.2011 23:34, schrieb Kermit Kiser: >> You are not making sense again Thomas. What does "xyz".shiftleft(1) >> mean? >> >> Rexx class objects are strings. Shift is a binary operation and only >> makes sense for binary objects like bytes, integers, etc. Shifting >> string objects is only going to give you garbage. >> >> -- KK >> >> >> On 10/2/2011 12:23 PM, Thomas Schneider wrote: >>> Kermit, Chip, and all. >>> >>> You are *most probably rigth*. >>> >>> But then, I thing, we should have 'shiftl' (for shift Left) and >>> 'shiftr' (for shift right) as STANDARD Methods >>> in the Rexx Class, please. >>> >>> I personally do use the short names (shiftl, shiftr), as those have >>> been the Names General Eletric Information Services (GEISCO) >>> did use at GEISCO's MARK III Service, in FORTRAN 77, since 1974, so >>> I'm accustomed to that abbreviations. >>> >>> By the way, all those functions are already implemented as >>> FUNCTION's (not methods) in my class 'RexxBits' in my >>> >>> org.netrexx.thsitc.runtime.compatibility >>> >>> (since years) <grin> :-) >>> >>> Thomas Schneider. >>> ===================================================================================== >>> >>> >>> >>> >>> >>> Am 02.10.2011 04:44, schrieb Kermit Kiser: >>>> While I like the idea of logical operations in order to >>>> inter-operate with other languages like Java that use binary types, >>>> I am not sure the shift operators are needed - NetRexx already has >>>> them albeit as 4 characters: >>>> >>>> left shift = *2** >>>> right shift = %2** >>>> >>>> You can use them to create shift methods if you want: >>>> ---------------------- NetRexx code ----------------------------- >>>> d = int 5 >>>> >>>> say d "=" Rexx(d).d2x.x2b >>>> >>>> say "left 1" shiftleft(d,1).d2x.x2b >>>> say "left 2" shiftleft(d,2).d2x.x2b >>>> say "left 3" shiftleft(d,3).d2x.x2b >>>> say "left 4" shiftleft(d,4).d2x.x2b >>>> >>>> say "right 1" shiftright(d,1).d2x.x2b >>>> say "right 2" shiftright(d,2).d2x.x2b >>>> say "right 3" shiftright(d,3).d2x.x2b >>>> >>>> d=shiftleft(d,1) >>>> say d >>>> d=shiftleft(d,1) >>>> say d >>>> >>>> method shiftleft(d,s) static >>>> return d*2**s >>>> >>>> method shiftright(d,s) static >>>> return d%2**s >>>> ----------------------- output log >>>> ------------------------------------ >>>> >>>> 5 = 0101 >>>> left 1 1010 >>>> left 2 00010100 >>>> left 3 00101000 >>>> left 4 01010000 >>>> right 1 0010 >>>> right 2 0001 >>>> right 3 0000 >>>> 10 >>>> 20 >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> >>>> -- KK >>>> >>>> >>>> On 10/1/2011 2:07 AM, Thomas Schneider wrote: >>>>> I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT >>>>> SHIFT operator for all kind of integers (byte, short, int, long) >>>>> will be worthwhile. >>>>> >>>>> As '<<' (for left shift, as in Bob's PYTHON sample code) >>>>> and '>>' (for right shift) >>>>> >>>>> *are already* occupied by the respective *STRICT COMPARISON >>>>> Operator's* >>>>> in Rexx and NetRexx, >>>>> >>>>> I'm proposing to use: >>>>> >>>>> '<<<' for LEFT SHIFT >>>>> '>>>' for RIGHT SHIFT >>>>> >>>>> This would allow for quick TYPING. >>>>> >>>>> Also, the '^' operator should be defined as a synonym to the >>>>> cryptic '&&' >>>>> for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be >>>>> used >>>>> (might be used) as the UNARY NOT operator. >>>>> >>>>> What do you think? >>>>> >>>>> Thomas. >>>>> >>>> >>>> _______________________________________________ >>>> 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/ >> >> > > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Hello Kermit, David,
whil'st I think I do know NetRexx enough to code it this way, and actually are doing it when needed, I also do think we should reconsider this when NetRexxC 3.01 is out, for a later release. All of this is the reason why I did already propose, to: 1.) Support the usage of *function oriented notations*. 2.) Intruduce a new option in the middle of -nobinray and -binary May I mention that I do *NOT* require these options for Rexx2Nrx (as I'm translating all Rexx builtin FUNCTIONS to NetRexx BUILTIN methods, with properly surrounding all primitive Java Type Variables by the powerful Rexx(...) operator, which does then allow to use primitive types. Thomas. ================================================== Am 04.10.2011 09:43, schrieb Kermit Kiser: > That is not likely to happen for at least three reasons: > > 1) It would greatly confuse new and unaware NetRexx programmers, > especially those used to Java behavior. > 2) It violates object programming principals (data encapsulation, > etc.) and could cause logical or security problems. > 3) It is not really needed since you can easily wrap Java items if you > want to use NetRexx methods on them: java_integer=int 12345;say > Rexx(java_integer).right(3) > > -- KK > > On 10/3/2011 4:43 AM, Thomas Schneider wrote: >> ... and that is exactly why I've already proposed to allow Rexx >> methods for primitive Java types ... >> >> Thomas. >> ======================================================== >> Am 02.10.2011 23:34, schrieb Kermit Kiser: >>> You are not making sense again Thomas. What does "xyz".shiftleft(1) >>> mean? >>> >>> Rexx class objects are strings. Shift is a binary operation and only >>> makes sense for binary objects like bytes, integers, etc. Shifting >>> string objects is only going to give you garbage. >>> >>> -- KK >>> >>> >>> On 10/2/2011 12:23 PM, Thomas Schneider wrote: >>>> Kermit, Chip, and all. >>>> >>>> You are *most probably rigth*. >>>> >>>> But then, I thing, we should have 'shiftl' (for shift Left) and >>>> 'shiftr' (for shift right) as STANDARD Methods >>>> in the Rexx Class, please. >>>> >>>> I personally do use the short names (shiftl, shiftr), as those have >>>> been the Names General Eletric Information Services (GEISCO) >>>> did use at GEISCO's MARK III Service, in FORTRAN 77, since 1974, so >>>> I'm accustomed to that abbreviations. >>>> >>>> By the way, all those functions are already implemented as >>>> FUNCTION's (not methods) in my class 'RexxBits' in my >>>> >>>> org.netrexx.thsitc.runtime.compatibility >>>> >>>> (since years) <grin> :-) >>>> >>>> Thomas Schneider. >>>> ===================================================================================== >>>> >>>> >>>> >>>> >>>> >>>> Am 02.10.2011 04:44, schrieb Kermit Kiser: >>>>> While I like the idea of logical operations in order to >>>>> inter-operate with other languages like Java that use binary >>>>> types, I am not sure the shift operators are needed - NetRexx >>>>> already has them albeit as 4 characters: >>>>> >>>>> left shift = *2** >>>>> right shift = %2** >>>>> >>>>> You can use them to create shift methods if you want: >>>>> ---------------------- NetRexx code ----------------------------- >>>>> d = int 5 >>>>> >>>>> say d "=" Rexx(d).d2x.x2b >>>>> >>>>> say "left 1" shiftleft(d,1).d2x.x2b >>>>> say "left 2" shiftleft(d,2).d2x.x2b >>>>> say "left 3" shiftleft(d,3).d2x.x2b >>>>> say "left 4" shiftleft(d,4).d2x.x2b >>>>> >>>>> say "right 1" shiftright(d,1).d2x.x2b >>>>> say "right 2" shiftright(d,2).d2x.x2b >>>>> say "right 3" shiftright(d,3).d2x.x2b >>>>> >>>>> d=shiftleft(d,1) >>>>> say d >>>>> d=shiftleft(d,1) >>>>> say d >>>>> >>>>> method shiftleft(d,s) static >>>>> return d*2**s >>>>> >>>>> method shiftright(d,s) static >>>>> return d%2**s >>>>> ----------------------- output log >>>>> ------------------------------------ >>>>> >>>>> 5 = 0101 >>>>> left 1 1010 >>>>> left 2 00010100 >>>>> left 3 00101000 >>>>> left 4 01010000 >>>>> right 1 0010 >>>>> right 2 0001 >>>>> right 3 0000 >>>>> 10 >>>>> 20 >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> >>>>> -- KK >>>>> >>>>> >>>>> On 10/1/2011 2:07 AM, Thomas Schneider wrote: >>>>>> I personally do think, that INTRODUCING a LEFT SHIFT and RIGHT >>>>>> SHIFT operator for all kind of integers (byte, short, int, long) >>>>>> will be worthwhile. >>>>>> >>>>>> As '<<' (for left shift, as in Bob's PYTHON sample code) >>>>>> and '>>' (for right shift) >>>>>> >>>>>> *are already* occupied by the respective *STRICT COMPARISON >>>>>> Operator's* >>>>>> in Rexx and NetRexx, >>>>>> >>>>>> I'm proposing to use: >>>>>> >>>>>> '<<<' for LEFT SHIFT >>>>>> '>>>' for RIGHT SHIFT >>>>>> >>>>>> This would allow for quick TYPING. >>>>>> >>>>>> Also, the '^' operator should be defined as a synonym to the >>>>>> cryptic '&&' >>>>>> for the EXCLUSIVE OR, and, most probably, the Tilde '~' should be >>>>>> used >>>>>> (might be used) as the UNARY NOT operator. >>>>>> >>>>>> What do you think? >>>>>> >>>>>> Thomas. >>>>>> >>>>> >>>>> _______________________________________________ >>>>> 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/ >>> >>> >> >> > > _______________________________________________ > 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 |
Free forum by Nabble | Edit this page |