I by no means meant to criticize the technique you described.  On the contrary, 
I find it cool and refreshing.  I like when it makes me think to determine what 
it is doing and how.

OTOH you are perfectly correct that a 1000-line if clause is just as (or maybe 
more) hard to decipher.

Managers and even sometimes fellow programmers do not always like it when code 
makes them think ...  :)

Peter

-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On 
Behalf Of Rob van der Heij
Sent: Friday, October 25, 2013 8:36 AM
To: [email protected]
Subject: Re: signum

On 24 October 2013 16:25, Farley, Peter x23353
<[email protected]>wrote:

> Wow.  I have occasionally been accused of using obscure, "unmaintainable"
> code in the name of efficiency, but that "gubbins" example and Rob's
> default parameter assignment parse make me look positively conservative.
>

Oh dear, I need to defend myself...  As Paracelsus said "Alle Dinge sind
Gift.. " (Google for the rest) and even if you have something like
if/then/else that is simple to understand, when you have enough the result
gets complicated (like a 1000-line if clause)

Getting back to HLASM, I inherited macro that (simplified) starts like this:
     MACRO
     FOOBAR  &A=,&B=,&C=
Now it needs to test that exactly one of the 3 parameters is being used,
and it does so using a cascade of simple AIF statement using ('&A' EQ ' ')
to verify that. This may have been trivial before, and got tedious when C=
was added. The error messages also introduced an ordering of the
alternatives that does not match the argument (eg "must not B when A is
specified" when invoked as  FOOBAR B=1,A=3).

While I agree the following takes some creativity, it's basically not more
complicated and easier to maintain when you add another one...

 LCLA    &P
&P       SETA K'&A+K'&B+K'&C
 AIF     (&P EQ 1).FOOX
 MNOTE 8,'Foobar using &P of the A= B= C= options'
.FOOX    ANOP  ,

Rob
--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

Reply via email to