Using the ? : syntax

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

Using the ? : syntax

gpatrick
In NetRexx how is the following syntax used?

System.out.print(f.canRead() ? "r" : "-");

Because it returns:
5 +++ System.out.printf(f.canRead() > "r" : "-")
   +++
   +++ Error: Unexpected character found in source ':' (hexadecimal encoding: 003A)
Compilation of 'read.nrx' failed [one error]
Reply | Threaded
Open this post in threaded view
|

Re: Using the ? : syntax

gpatrick
I had a typo in my original code of an ">" but the "?" still returns the same error.  I'd like to use this shortened syntax if it's available instead of using if/else.

# nrc read.nrx
NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
Copyright (c) RexxLA, 2011,2014.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program read.nrx
 5 +++ System.out.print(f.canRead() ? "r" : "-")
   +++                              ^
   +++ Error: Unexpected character found in source: '?' (hexadecimal encoding: 003F)
Compilation of 'read.nrx' failed [one error]
Reply | Threaded
Open this post in threaded view
|

Re: Using the ? : syntax

alansam
Unless I missed something recently, NetRexx doesn't support the "ternary if" syntax.  It's a C/Java affectation.

A.

On 13 November 2014 08:19, gpatrick <[hidden email]> wrote:
I had a typo in my original code of an ">" but the "?" still returns the same
error.  I'd like to use this shortened syntax if it's available instead of
using if/else.

# nrc read.nrx
NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
Copyright (c) RexxLA, 2011,2014.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program read.nrx
 5 +++ System.out.print(f.canRead() ? "r" : "-")
   +++                              ^
   +++ Error: Unexpected character found in source: '?' (hexadecimal
encoding: 003F)
Compilation of 'read.nrx' failed [one error]




--
View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Using-the-syntax-tp4027326p4027327.html
Sent from the ibm-netrexx mailing list archive at Nabble.com.

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




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

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

Alan

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

Re: Using the ? : syntax

Kermit Kiser
In reply to this post by gpatrick
If you just need an expression to return a fixed set selection, there
are ways to code such things in NetRexx. For example:

System.out.print("- r".word(1+f.canRead()))

On 11/13/2014 8:19 AM, gpatrick wrote:

> I had a typo in my original code of an ">" but the "?" still returns the same
> error.  I'd like to use this shortened syntax if it's available instead of
> using if/else.
>
> # nrc read.nrx
> NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
> Copyright (c) RexxLA, 2011,2014.   All rights reserved.
> Parts Copyright (c) IBM Corporation, 1995,2008.
> Program read.nrx
>   5 +++ System.out.print(f.canRead() ? "r" : "-")
>     +++                              ^
>     +++ Error: Unexpected character found in source: '?' (hexadecimal
> encoding: 003F)
> Compilation of 'read.nrx' failed [one error]
>
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Using-the-syntax-tp4027326p4027327.html
> Sent from the ibm-netrexx mailing list archive at 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/

Reply | Threaded
Open this post in threaded view
|

Re: Using the ? : syntax

ThSITC
*I* did *never understand* why bmy beloved NetRexx didn't use the
*chance* to implement this nowadays
so quite well know and used Syntax and Semantics of  xxxxx ? aaa:bbb    
          :-( :-(

Maybe NetRexx 4.00 ??
Thomas.

Anyway: All: Habve a nice weekend ;-)
Thomas.
=================================================================================
Am 14.11.2014 um 09:34 schrieb Kermit Kiser:

> If you just need an expression to return a fixed set selection, there
> are ways to code such things in NetRexx. For example:
>
> System.out.print("- r".word(1+f.canRead()))
>
> On 11/13/2014 8:19 AM, gpatrick wrote:
>> I had a typo in my original code of an ">" but the "?" still returns
>> the same
>> error.  I'd like to use this shortened syntax if it's available
>> instead of
>> using if/else.
>>
>> # nrc read.nrx
>> NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
>> Copyright (c) RexxLA, 2011,2014.   All rights reserved.
>> Parts Copyright (c) IBM Corporation, 1995,2008.
>> Program read.nrx
>>   5 +++ System.out.print(f.canRead() ? "r" : "-")
>>     +++                              ^
>>     +++ Error: Unexpected character found in source: '?' (hexadecimal
>> encoding: 003F)
>> Compilation of 'read.nrx' failed [one error]
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://ibm-netrexx.215625.n3.nabble.com/Using-the-syntax-tp4027326p4027327.html
>> Sent from the ibm-netrexx mailing list archive at 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/
>

--
ThSITC - The Simple IT keeps Changing www.thsitc.com www.db-123.com

_______________________________________________
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: Using the ? : syntax

George Hovey-2
Thomas,

This is an example of an idiom, i.e. a construction whose meaning cannot be deduced from its symbols alone.    It's a holdover from the antediluvian era when minimizing the number of characters typed was a major goal (perhaps because people typed on 110 baud Teletypes, and a 'good' typist was one who used two fingers); this is also the time when that pest the hard tab was born.

"if then else" has more characters, but is not cryptic.  I suspect people who love NetRexx are not in favor of more "features" of this sort.

George 

"Less is more."
   -- Ludwig Mies van der Rohe

On Sat, Nov 15, 2014 at 11:28 PM, Thomas Schneider <[hidden email]> wrote:
*I* did *never understand* why bmy beloved NetRexx didn't use the *chance* to implement this nowadays
so quite well know and used Syntax and Semantics of  xxxxx ? aaa:bbb              :-( :-(

Maybe NetRexx 4.00 ??
Thomas.

Anyway: All: Habve a nice weekend ;-)
Thomas.
=================================================================================
Am 14.11.2014 um 09:34 schrieb Kermit Kiser:

If you just need an expression to return a fixed set selection, there are ways to code such things in NetRexx. For example:

System.out.print("- r".word(1+f.canRead()))

On 11/13/2014 8:19 AM, gpatrick wrote:
I had a typo in my original code of an ">" but the "?" still returns the same
error.  I'd like to use this shortened syntax if it's available instead of
using if/else.

# nrc read.nrx
NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
Copyright (c) RexxLA, 2011,2014.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program read.nrx
  5 +++ System.out.print(f.canRead() ? "r" : "-")
    +++                              ^
    +++ Error: Unexpected character found in source: '?' (hexadecimal
encoding: 003F)
Compilation of 'read.nrx' failed [one error]




--
View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Using-the-syntax-tp4027326p4027327.html
Sent from the ibm-netrexx mailing list archive at 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/


--
ThSITC - The Simple IT keeps Changing www.thsitc.com www.db-123.com


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




--
"I don’t believe in the afterlife, although I am bringing a change of underwear." - W. Allen

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

Reply | Threaded
Open this post in threaded view
|

Re: Using the ? : syntax

Martin Packer
It's an idiom I've never got used to but
  • It's an idiom that's not hard to master.
  • It has a certain elegance.

And the reason I never got used to it is because I spend the vast majority of programming hours with languages that don't have it, such as TSO REXX.

Cheers, Martin

Martin Packer,
zChampion, Principal Systems Investigator,

Worldwide Banking Center of Excellence, IBM

+44-7802-245-584

email: [hidden email]

Twitter / Facebook IDs: MartinPacker
Blog: https://www.ibm.com/developerworks/mydeveloperworks/blogs/MartinPacker



From:        George Hovey <[hidden email]>
To:        IBM Netrexx <[hidden email]>
Date:        16/11/2014 05:18
Subject:        Re: [Ibm-netrexx] Using the ? : syntax
Sent by:        [hidden email]




Thomas,

This is an example of an idiom, i.e. a construction whose meaning cannot be deduced from its symbols alone.    It's a holdover from the antediluvian era when minimizing the number of characters typed was a major goal (perhaps because people typed on 110 baud Teletypes, and a 'good' typist was one who used two fingers); this is also the time when that pest the hard tab was born.

"if then else" has more characters, but is not cryptic.  I suspect people who love NetRexx are not in favor of more "features" of this sort.

George 

"Less is more."
   -- Ludwig Mies van der Rohe


On Sat, Nov 15, 2014 at 11:28 PM, Thomas Schneider <Thomas.Schneider@...> wrote:
*I* did *never understand* why bmy beloved NetRexx didn't use the *chance* to implement this nowadays
so quite well know and used Syntax and Semantics of  xxxxx ? aaa:bbb              :-( :-(

Maybe NetRexx 4.00 ??
Thomas.

Anyway: All: Habve a nice weekend ;-)
Thomas.
=================================================================================
Am 14.11.2014 um 09:34 schrieb Kermit Kiser:


If you just need an expression to return a fixed set selection, there are ways to code such things in NetRexx. For example:

System.out.print("- r".word(1+f.canRead()))

On 11/13/2014 8:19 AM, gpatrick wrote:

I had a typo in my original code of an ">" but the "?" still returns the same
error.  I'd like to use this shortened syntax if it's available instead of
using if/else.

# nrc read.nrx
NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
Copyright (c) RexxLA, 2011,2014.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program read.nrx
  5 +++ System.out.print(f.canRead() ? "r" : "-")
    +++                              ^
    +++ Error: Unexpected character found in source: '?' (hexadecimal
encoding: 003F)
Compilation of 'read.nrx' failed [one error]




--
View this message in context:
http://ibm-netrexx.215625.n3.nabble.com/Using-the-syntax-tp4027326p4027327.html
Sent from the ibm-netrexx mailing list archive at 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/


--
ThSITC - The Simple IT keeps Changing
www.thsitc.com www.db-123.com


_______________________________________________
Ibm-netrexx mailing list

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




--

"I don’t believe in the afterlife, although I am bringing a change of underwear." - W. Allen _______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

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

Reply | Threaded
Open this post in threaded view
|

Re: Using the ? : syntax

alansam
In that Kermit has already provided an equally elegant and very definitely REXX style idiom to solve the specific problem at the start of this thread, I for one wouldn't want the language polluted by ideas dragged in from other languages.  to see the results of that type of language design, take a look at perl.

A.

On 16 November 2014 01:48, Martin Packer <[hidden email]> wrote:
It's an idiom I've never got used to but
  • It's an idiom that's not hard to master.
  • It has a certain elegance.

And the reason I never got used to it is because I spend the vast majority of programming hours with languages that don't have it, such as TSO REXX.

Cheers, Martin

Martin Packer,
zChampion, Principal Systems Investigator,

Worldwide Banking Center of Excellence, IBM

<a href="tel:%2B44-7802-245-584" value="+447802245584" target="_blank">+44-7802-245-584

email: [hidden email]

Twitter / Facebook IDs: MartinPacker
Blog: https://www.ibm.com/developerworks/mydeveloperworks/blogs/MartinPacker



From:        George Hovey <[hidden email]>
To:        IBM Netrexx <[hidden email]>
Date:        16/11/2014 05:18
Subject:        Re: [Ibm-netrexx] Using the ? : syntax
Sent by:        [hidden email]




Thomas,

This is an example of an idiom, i.e. a construction whose meaning cannot be deduced from its symbols alone.    It's a holdover from the antediluvian era when minimizing the number of characters typed was a major goal (perhaps because people typed on 110 baud Teletypes, and a 'good' typist was one who used two fingers); this is also the time when that pest the hard tab was born.

"if then else" has more characters, but is not cryptic.  I suspect people who love NetRexx are not in favor of more "features" of this sort.

George 

"Less is more."
   -- Ludwig Mies van der Rohe


On Sat, Nov 15, 2014 at 11:28 PM, Thomas Schneider <[hidden email]> wrote:
*I* did *never understand* why bmy beloved NetRexx didn't use the *chance* to implement this nowadays
so quite well know and used Syntax and Semantics of  xxxxx ? aaa:bbb              :-( :-(

Maybe NetRexx 4.00 ??
Thomas.

Anyway: All: Habve a nice weekend ;-)
Thomas.
=================================================================================
Am 14.11.2014 um 09:34 schrieb Kermit Kiser:


If you just need an expression to return a fixed set selection, there are ways to code such things in NetRexx. For example:

System.out.print("- r".word(1+f.canRead()))

On 11/13/2014 8:19 AM, gpatrick wrote:

I had a typo in my original code of an ">" but the "?" still returns the same
error.  I'd like to use this shortened syntax if it's available instead of
using if/else.

# nrc read.nrx
NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
Copyright (c) RexxLA, 2011,2014.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program read.nrx
  5 +++ System.out.print(f.canRead() ? "r" : "-")
    +++                              ^
    +++ Error: Unexpected character found in source: '?' (hexadecimal
encoding: 003F)
Compilation of 'read.nrx' failed [one error]




--
View this message in context:
http://ibm-netrexx.215625.n3.nabble.com/Using-the-syntax-tp4027326p4027327.html
Sent from the ibm-netrexx mailing list archive at 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/


--
ThSITC - The Simple IT keeps Changing
www.thsitc.com www.db-123.com


_______________________________________________
Ibm-netrexx mailing list

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




--

"I don’t believe in the afterlife, although I am bringing a change of underwear." - W. Allen _______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

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





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

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

Alan

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

Re: Using the ? : syntax

ThSITC
In reply to this post by Martin Packer
It's for sure *easier to master and recognize* than the usage of the ampersand (&) as an *exclusive OR* in RexxY Languages ;-) ;-) ;-)
=============================================================================================================
Am 16.11.2014 um 10:48 schrieb Martin Packer:
It's an idiom I've never got used to but
  • It's an idiom that's not hard to master.
  • It has a certain elegance.

And the reason I never got used to it is because I spend the vast majority of programming hours with languages that don't have it, such as TSO REXX.

Cheers, Martin

Martin Packer,
zChampion, Principal Systems Investigator,

Worldwide Banking Center of Excellence, IBM

+44-7802-245-584

email: [hidden email]

Twitter / Facebook IDs: MartinPacker
Blog: https://www.ibm.com/developerworks/mydeveloperworks/blogs/MartinPacker



From:        George Hovey [hidden email]
To:        IBM Netrexx [hidden email]
Date:        16/11/2014 05:18
Subject:        Re: [Ibm-netrexx] Using the ? : syntax
Sent by:        [hidden email]




Thomas,

This is an example of an idiom, i.e. a construction whose meaning cannot be deduced from its symbols alone.    It's a holdover from the antediluvian era when minimizing the number of characters typed was a major goal (perhaps because people typed on 110 baud Teletypes, and a 'good' typist was one who used two fingers); this is also the time when that pest the hard tab was born.

"if then else" has more characters, but is not cryptic.  I suspect people who love NetRexx are not in favor of more "features" of this sort.

George 

"Less is more."
   -- Ludwig Mies van der Rohe


On Sat, Nov 15, 2014 at 11:28 PM, Thomas Schneider <[hidden email]> wrote:
*I* did *never understand* why bmy beloved NetRexx didn't use the *chance* to implement this nowadays
so quite well know and used Syntax and Semantics of  xxxxx ? aaa:bbb              :-( :-(

Maybe NetRexx 4.00 ??
Thomas.

Anyway: All: Habve a nice weekend ;-)
Thomas.
=================================================================================
Am 14.11.2014 um 09:34 schrieb Kermit Kiser:


If you just need an expression to return a fixed set selection, there are ways to code such things in NetRexx. For example:

System.out.print("- r".word(1+f.canRead()))

On 11/13/2014 8:19 AM, gpatrick wrote:

I had a typo in my original code of an ">" but the "?" still returns the same
error.  I'd like to use this shortened syntax if it's available instead of
using if/else.

# nrc read.nrx
NetRexx portable processor 3.03 NetRexx '3.03', build 61-20140611-2330
Copyright (c) RexxLA, 2011,2014.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program read.nrx
  5 +++ System.out.print(f.canRead() ? "r" : "-")
    +++                              ^
    +++ Error: Unexpected character found in source: '?' (hexadecimal
encoding: 003F)
Compilation of 'read.nrx' failed [one error]




--
View this message in context:
http://ibm-netrexx.215625.n3.nabble.com/Using-the-syntax-tp4027326p4027327.html
Sent from the ibm-netrexx mailing list archive at 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/


--
ThSITC - The Simple IT keeps Changing
www.thsitc.com www.db-123.com


_______________________________________________
Ibm-netrexx mailing list

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




--

"I don’t believe in the afterlife, although I am bringing a change of underwear." - W. Allen _______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


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


--
ThSITC - The Simple IT keeps Changing www.thsitc.com www.db-123.com

_______________________________________________
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