The syntactic SUGAR after an IF statement

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

The syntactic SUGAR after an IF statement

ThSITC
Hello there,
   I *do know*, I#m going on your nerves.... :-(

Nevertheless, there is *some syntactic sugar* (and, even more, SEMANTIC
sugar) in the definition of
the IF statement.

As I recall:

If expression [;] THEN [;] instruction

Whilst, historically, that is FINE, actually, there is NO SEMANTIC
meaning for the
END of instruction [denoted by ';' in the syntac definition, but which
might be a 'Carriage return' (CR)'
as well.

Now, as I see it (personally, only personal opinion)

1.) We MUST REFINE that to:

if condition [;] THEN [;] instruction

An IF-verb MUST be followed by a LOGICAL CONDITION,
either a simple COMPARISON, as I call it, or a BOOLEAN expression.

The compiler can check that, with stronger typing rules..

2.) We MAY REFINE that, that the keyword THEN is optional, and ',' is
NOT the same than (CR).

This would allow code as:

     if (a=b) [THEN]      (CR)
        k=z
       x=y
     ELSE (CR)
       say 'we are in the ELSE BLOCK here'
     end if

Thus, having a differentiation between the ';' and the (CR) would help a
LOT!

What do you say?

Same holds true for keywords ELSE, and OTHERWISE.
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
Reply | Threaded
Open this post in threaded view
|

Re: The syntactic SUGAR after an IF statement

George Hovey-2
Thomas,
Just a small point.  You say

"An IF-verb MUST be followed by a LOGICAL CONDITION,
either a simple COMPARISON, as I call it, or a BOOLEAN expression."

but a comparison is a boolean expression, eg

a = 0
b = 1
Say "(a = b) =" (a = b)
a = 1
b = 1
Say "(a = b) =" (a = b)

says

(a = b) = 0
(a = b) = 1

George

On Thu, Nov 17, 2011 at 10:42 AM, Thomas Schneider <[hidden email]> wrote:
Hello there,
 I *do know*, I#m going on your nerves.... :-(

Nevertheless, there is *some syntactic sugar* (and, even more, SEMANTIC sugar) in the definition of
the IF statement.

As I recall:

If expression [;] THEN [;] instruction

Whilst, historically, that is FINE, actually, there is NO SEMANTIC meaning for the
END of instruction [denoted by ';' in the syntac definition, but which might be a 'Carriage return' (CR)'
as well.

Now, as I see it (personally, only personal opinion)

1.) We MUST REFINE that to:

if condition [;] THEN [;] instruction

An IF-verb MUST be followed by a LOGICAL CONDITION,
either a simple COMPARISON, as I call it, or a BOOLEAN expression.

The compiler can check that, with stronger typing rules..

2.) We MAY REFINE that, that the keyword THEN is optional, and ',' is NOT the same than (CR).

This would allow code as:

   if (a=b) [THEN]      (CR)
      k=z
     x=y
   ELSE (CR)
     say 'we are in the ELSE BLOCK here'
   end if

Thus, having a differentiation between the ';' and the (CR) would help a LOT!

What do you say?

Same holds true for keywords ELSE, and OTHERWISE.
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/



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

Reply | Threaded
Open this post in threaded view
|

Re: The syntactic SUGAR after an IF statement

ThSITC
Hello George,
   in *my internal Code*, and *my internal Declarations*, I'm distinguishing between:


a) COMPARISONS (also, some-times, called RELATIONS, eg: A=B OR C OR D  (in COBOL)
b) BOOLEAN Expressions: e.g. A AND B in COBOL (or A & B in Rexx (any dialect)

etc, etc.

When interested, at all, send me a private mail, and I can send you immediatly the TRICKS that
I did use for all my pre-processors.

But please note that much of them have been ported from FORTRAN 77, to IBM Rexx,
then to IBM COMPILED REXX, and now boots-trapped (with my private version of Rexx2Nrx)
to finally be NetRexx Classes (each former %INCLUDE bacame a class!)

And, to QUOTE your example below, a BIT:

I would DISALLOW BOOLEAN Expressions in a SAY verb (personal opinion, again),
as it is MOST probably a spelling error!

I would define:

SAY Text-Expression .... ;-)

But as I'm neither the author of Rexx nor NetRexx, maybe I finally would have to define
my own language  (called rey, for breivity ??)
;-) ;-) ;-)

Anyway, George, when interested to read the internal doc's:

NO PROBLEM, Just send a private mail!

Greetings from dark Vienna,
Thomas.
===================================================================
Am 17.11.2011 18:32, schrieb George Hovey:
Thomas,
Just a small point.  You say

"An IF-verb MUST be followed by a LOGICAL CONDITION,
either a simple COMPARISON, as I call it, or a BOOLEAN expression."

but a comparison is a boolean expression, eg

a = 0
b = 1
Say "(a = b) =" (a = b)
a = 1
b = 1
Say "(a = b) =" (a = b)

says

(a = b) = 0
(a = b) = 1

George

On Thu, Nov 17, 2011 at 10:42 AM, Thomas Schneider <[hidden email]> wrote:
Hello there,
 I *do know*, I#m going on your nerves.... :-(

Nevertheless, there is *some syntactic sugar* (and, even more, SEMANTIC sugar) in the definition of
the IF statement.

As I recall:

If expression [;] THEN [;] instruction

Whilst, historically, that is FINE, actually, there is NO SEMANTIC meaning for the
END of instruction [denoted by ';' in the syntac definition, but which might be a 'Carriage return' (CR)'
as well.

Now, as I see it (personally, only personal opinion)

1.) We MUST REFINE that to:

if condition [;] THEN [;] instruction

An IF-verb MUST be followed by a LOGICAL CONDITION,
either a simple COMPARISON, as I call it, or a BOOLEAN expression.

The compiler can check that, with stronger typing rules..

2.) We MAY REFINE that, that the keyword THEN is optional, and ',' is NOT the same than (CR).

This would allow code as:

   if (a=b) [THEN]      (CR)
      k=z
     x=y
   ELSE (CR)
     say 'we are in the ELSE BLOCK here'
   end if

Thus, having a differentiation between the ';' and the (CR) would help a LOT!

What do you say?

Same holds true for keywords ELSE, and OTHERWISE.
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/




_______________________________________________
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