RE: NetRexx enhancements: multiple assignments andnewassign opserators

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

RE: NetRexx enhancements: multiple assignments andnewassign opserators

christel.u.w.pachl christel.u.w.pachl
Here I have to partly support Tom ..
15 years ago I "Invented" the PL/I Macro incby1(blabla) in order to avoid writing blabla=blabla+1
only a year ago I learned that PL/I (my first professional love) was extended to support blabla+=1

Some Rexxes do as well (I guess ooRexx) but not TSO Rexx

Wouldn't it be nice if a "family" of languges would share the same features??

Walter

---- Mike Cowlishaw <[hidden email]> schrieb:

> The objection is the usual one.  Every time you add a new special syntax you
> make programs less easy to read/understand for the occasional programmer.  
>
> The net effect is that you save a few keystrokes for the experienced programmer
> (who is probably a faster typist anyway) and the expense of making programs more
> inscrutable for the less experienced, or new, programmer.
>
> [I agree that 'a+=1' is handy.  However, a shorter syntax might be possible:
> 'a+1' (the first symbol is assumed to be the recipient).  a++, however, is pure
> jargon.  Commas on the left of = really don't save much, especially in a
> language where 0 is the default initializer, and discourage people from
> documenting their variables.]
>
> Mike
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of
> > Thomas Schneider
> > Sent: 23 September 2010 11:35
> > To: IBM Netrexx
> > Subject: [Ibm-netrexx] NetRexx enhancements: multiple
> > assignments and newassign opserators
> >
> >   Hello there,
> >     I would like to discuss the idea to enhance the
> > assignment statement as follows:.
> >
> > e.g.:
> >
> >     a=x -- already there
> >
> > 1.) enhanced assignment operators:
> >
> > proposed new syntax (as in ooRexx 4.0):
> >
> >     a += b
> >     a -=  b
> >
> >      etc ...
> >
> > i.e. the equal sign may be preceeded by an operator, as in
> > other languages. (even PL/I does now support this syntax,
> > originally invented for C, I think)
> >
> > 2.) multiple assignment syntax:
> >
> > The comma may be used on the left hand side of an assignment
> > to separate a list of variables. :
> >
> >     i, ,j,k = int 0 -- indices, for instance
> >
> >     m,n += 3 -- increase m and n by 3
> >
> > Would make programs much shorter.
> >
> > I just implemented a trial version in my own Parser, but
> > would propose this for
> > NetRexx3 as well.
> >
> > Note: Also, PL/I does support this syntax.
> >
> > Any objections?
> >
> > Thomas Schneider (Tom)
> >
> > --
> > Thomas Schneider Projects ReyC & LOGOS on www.KENAI.com
> > _______________________________________________
> > Ibm-netrexx mailing list
> > [hidden email]
> >
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: NetRexx enhancements: multiple assignmentsandnewassign opserators

measel
Totally agree with Mike.

/*overload methods that increment*/
/* indented wherever the hell I felt like it */

                       
class Trexx
       
                       
                method increment(what = Rexx) returns Rexx
                return  what + 1
                method increment(what = Int) returns Int
                return  what + 1
                method increment(what = String) returns String
                        myInt = int
                        myInt = Integer.parseInt(what.trim())
                        return myInt + 1
       
        method main(args = String[]) public static
                Trexx()
        method Trexx()
                dostuff()
                       
        method dostuff()
        tom = Rexx 0
        mike = 1000
        say 'increment rexx'
        loop while tom < mike
             tom = increment(tom)
        end
        say tom
        say 'increment integer'
        tom = Int 0
        mike = 1000
        loop while tom < mike
             tom = increment(tom)
        end
        say tom
        say 'increment string'
        tom = String "0"
        mike = 1000
        loop while tom < mike
             tom = increment(tom)
        end

/* I always hated pl1 */

NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005.  All rights reserved.
Program Trexx.nrx
  === class Trexx ===
    method increment(Rexx)
    method increment(int)
    method increment(String)
    function main(String[])
    constructor Trexx()
      overrides Object()
    method dostuff
Compilation of 'Trexx.nrx' successful

C:\t42\NetRexx>java Trexx
increment rexx
1000
increment integer
1000
increment string
1000

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Walter Pachl
Sent: Thursday, September 23, 2010 8:57 AM
To: IBM Netrexx
Subject: RE: [Ibm-netrexx] NetRexx enhancements: multiple assignmentsandnewassign opserators

Here I have to partly support Tom ..
15 years ago I "Invented" the PL/I Macro incby1(blabla) in order to avoid writing blabla=blabla+1
only a year ago I learned that PL/I (my first professional love) was extended to support blabla+=1

Some Rexxes do as well (I guess ooRexx) but not TSO Rexx

Wouldn't it be nice if a "family" of languges would share the same features??

Walter

---- Mike Cowlishaw <[hidden email]> schrieb:

> The objection is the usual one.  Every time you add a new special syntax you
> make programs less easy to read/understand for the occasional programmer.  
>
> The net effect is that you save a few keystrokes for the experienced programmer
> (who is probably a faster typist anyway) and the expense of making programs more
> inscrutable for the less experienced, or new, programmer.
>
> [I agree that 'a+=1' is handy.  However, a shorter syntax might be possible:
> 'a+1' (the first symbol is assumed to be the recipient).  a++, however, is pure
> jargon.  Commas on the left of = really don't save much, especially in a
> language where 0 is the default initializer, and discourage people from
> documenting their variables.]
>
> Mike
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of
> > Thomas Schneider
> > Sent: 23 September 2010 11:35
> > To: IBM Netrexx
> > Subject: [Ibm-netrexx] NetRexx enhancements: multiple
> > assignments and newassign opserators
> >
> >   Hello there,
> >     I would like to discuss the idea to enhance the
> > assignment statement as follows:.
> >
> > e.g.:
> >
> >     a=x -- already there
> >
> > 1.) enhanced assignment operators:
> >
> > proposed new syntax (as in ooRexx 4.0):
> >
> >     a += b
> >     a -=  b
> >
> >      etc ...
> >
> > i.e. the equal sign may be preceeded by an operator, as in
> > other languages. (even PL/I does now support this syntax,
> > originally invented for C, I think)
> >
> > 2.) multiple assignment syntax:
> >
> > The comma may be used on the left hand side of an assignment
> > to separate a list of variables. :
> >
> >     i, ,j,k = int 0 -- indices, for instance
> >
> >     m,n += 3 -- increase m and n by 3
> >
> > Would make programs much shorter.
> >
> > I just implemented a trial version in my own Parser, but
> > would propose this for
> > NetRexx3 as well.
> >
> > Note: Also, PL/I does support this syntax.
> >
> > Any objections?
> >
> > Thomas Schneider (Tom)
> >
> > --
> > Thomas Schneider Projects ReyC & LOGOS on www.KENAI.com
> > _______________________________________________
> > Ibm-netrexx mailing list
> > [hidden email]
> >
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NetRexx enhancements: multiple assignmentsandnewassign opserators

alansam


On 23 September 2010 08:35, Measel, Mike <[hidden email]> wrote:
Totally agree with Mike.


And that's another nice thing about NetRexx: you don't need to overload for all datatypes, just use the Rexx type and let NetRexx do implicit conversions for you.

Here's a slightly modified version of your sample:

/* NetRexx */
options replace format comments java crossref savelog symbols

Trace methods

class Trexx


method increment(what = Rexx) returns Rexx
  return  what + 1

method main(args = String[]) public static
  Trexx()
  return

method Trexx()
  dostuff()
  return

method dostuff()

  tom_r = Rexx 0
  mike = 5

  say 'increment rexx'
  loop while tom_r < mike
    tom_r = increment(tom_r)
  end
  say tom_r

  say 'increment integer'
  tom_i = Int 0
  loop while tom_i < mike
    tom_i = increment(tom_i)
  end
  say tom_i

  say 'increment string'
  tom_s = String "0"
  loop while tom_s < mike
    tom_s = increment(tom_s)
  end
  say tom_s

  say 'increment float'
  tom_f = float 0.1
  loop while tom_f < mike
    tom_f = increment(tom_f)
  end
  say tom_f

  return


Program Trexx.nrx
  === class Trexx ===
    method increment(Rexx)
    function main(String[])
    constructor Trexx()
      overrides Object()
    method dostuff
Compilation of 'Trexx.nrx' successful

 
=> Finished <=
java -cp . Trexx 
increment rexx
5
increment integer
5
increment string
5
increment float
5.1
=> Finished <=

Alan.
--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: NetRexx enhancements: multiple assignmentsandnewassign opserators

Thomas.Schneider.Wien
Alan, that's an interesting answer!

That's actually nearly the INTERNAL Code I am generating....

   INC ii jj       -- increment item number ii by item number jj
   DEC ii jj    -- decrement item number ii by item number jj

There is a document, named PP.doc, documenting this internal Code
I am producing ...

The interesting Part is that the Internal Code is identical for all supported Languages (PL/I, COBOL, Rexx, etc ... -end of advertisement- <grin>)

Let's see what this discussion brings out ..
Tom.
========================================================


Am 23.09.2010 19:57, schrieb Alan Sampson:


On 23 September 2010 08:35, Measel, Mike <[hidden email]> wrote:
Totally agree with Mike.


And that's another nice thing about NetRexx: you don't need to overload for all datatypes, just use the Rexx type and let NetRexx do implicit conversions for you.

Here's a slightly modified version of your sample:

/* NetRexx */
options replace format comments java crossref savelog symbols

Trace methods

class Trexx


method increment(what = Rexx) returns Rexx
  return  what + 1

method main(args = String[]) public static
  Trexx()
  return

method Trexx()
  dostuff()
  return

method dostuff()

  tom_r = Rexx 0
  mike = 5

  say 'increment rexx'
  loop while tom_r < mike
    tom_r = increment(tom_r)
  end
  say tom_r

  say 'increment integer'
  tom_i = Int 0
  loop while tom_i < mike
    tom_i = increment(tom_i)
  end
  say tom_i

  say 'increment string'
  tom_s = String "0"
  loop while tom_s < mike
    tom_s = increment(tom_s)
  end
  say tom_s

  say 'increment float'
  tom_f = float 0.1
  loop while tom_f < mike
    tom_f = increment(tom_f)
  end
  say tom_f

  return


Program Trexx.nrx
  === class Trexx ===
    method increment(Rexx)
    function main(String[])
    constructor Trexx()
      overrides Object()
    method dostuff
Compilation of 'Trexx.nrx' successful

 
=> Finished <=
java -cp . Trexx 
increment rexx
5
increment integer
5
increment string
5
increment float
5.1
=> Finished <=

Alan.
--
Can't tweet, won't tweet!
_______________________________________________ Ibm-netrexx mailing list [hidden email]


--
Thomas Schneider Projects ReyC & LOGOS on www.KENAI.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)