On 10/7/2013 11:47 AM, Scott Klement wrote:
IBM has announced support for free format in the H, F, D and P specs
this morning. Check it out
https://ibm.biz/BdDMwB
I don't really get the back and forth about brackets C-like syntax.
Coming from a .NET/Java background and then learning RPG, lack of curly
brackets and the use of colons never bothered me. I don't feel that RPG
needs to be C-like. People are obviously free to feel that would help,
but as a young guy than learned RPG in the last 10 years, it wouldn't
have mattered to me.
Like .NET / Java programmers Jon mentioned, the thing that BUGGED me to
death was having to break out of a free form grove every time I wanted
to declare a procedure. Even with my object-oriented background, I
initially resisted procedures and used sub-routines just to keep the
free-form flowing (not the brightest decision). Being able to do
procedures without leaving free is a huge step forward, without
question. What is being added is very, very positive and I am happy
about it.
B U T . . .
The issue I have with the free-form procedure definition isn't the lack
of brackets but its lack of consistency RPG itself. I could let it
slide when it was fixed, but I have a much a harder time doing that now.
I know WHY it looks the way it does (to be compiler friendly), but that
doesn't make it less ugly. I am perfectly fine with dcl-proc...end-proc
and I don't feel any overwhelming need for curly brackets. I do think
though that in lieu of dcl-pi and end-pi you should be able to use open
and closing parenthesis and then separate the parameter definitions by
colons.
That just makes sense. I can't really think of a language where the
procedure definition is radically different from the procedure call.
To me, this is absolutely how the procedure definition should look. At
least give the option to do it this way:
dcl-proc transform(
*n varchar(50) :
name varchar(10) const options(*trim) :
);
return '*** ' + name + ' ***';
end-proc;
// the call
transform(somvar:'My Name');
See the consistency? Maybe one might argue that my suggestion is
preference, but uniformity between the procedure definition and the
procedure call is pretty much a standard EVERYWHERE. So, you'll have to
excuse me I disagree that this is a "preference". The fact that you
declare a procedure one way and then call it another WILL absolutely,
without question, bug young programmers. Count on it.
I am not nitpicking or swearing a boycott. I will use the free-form
procedure definition the way it is, but hopefully people (specifically,
IBM people) will see and understand the point I am making here. I am no
compiler expert, but I have a hard time seeing why the above would be SO
hard to implement. That's probably due to ignorance, but I can say the
syntax isn't radical. It simply follows the pattern that already exists.
That all said, happy to see this finally happen. The mini-rant above
isn't a deal breaker. Far more happy about this than frustrated, but
had to get this out there.
Go easy on me. :)
As an Amazon Associate we earn from qualifying purchases.