TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: DAVID NOON
from: IVAN TODOROSKI
date: 1999-01-19 16:11:00
subject: Pl/I

On Saturday, 16 January 1999,
     DAVID NOON wrote to IVAN TODOROSKI about Pl/I

IT>>  Anyway, even if there isn't, I suppose it would be trivial to write
IT>>  such a function in PL/I...

  Lets see what can I make out of this...

 DN> =========================== XRANGE.PLI==============================
 DN>  /* Same as REXX's XRANGE() built-in function */
 DN>  XRANGE:
 DN>  PROC(lb,ub) RETURNS(CHAR(256) VAR) OPTIONS(REENTRANT REORDER);
                                                 ^^^^^^^^^ Huh!?

 DN>      DCL  (lb,ub)             CHAR(1) BYVALUE;
                                           ^^^^^^^!!!

 DN>      DCL  curr_byte           BIN FIXED(8,0) UNSIGNED,
                                   ^^^^^^^^^^^^^^ What??!?

  OK, the PROC() declaration looks standard enough, except for those
  OPTIONS() there... does that REENTRANT mean what I think it means?

   Are you saying that you can actually tell the compiler which
   functions are thread-safe and which aren't? If you don't specify
   REENTRANT, will the compiler take special measures to ensure that no
   two threads execute inside that function at the same time? What about
   that REORDER?

   It's obvious that DCL (probably short for DECLARE?) is for defining
   variables etc., much like VAR in Pascal. The first declares lb and ub
   as CHAR's (or is that one-element arrays of CHAR?), and what caught
   my attention was that BYVALUE keyword! Do you mean you can actually
   specify the way the parameter is passed for each parameter?! Now
   that's what I call total control :) Most languages tend to abstract
   the hardware away from your hands, but this one accepts the reality!

  And the more I grind thruogh this code, the stranger it gets! What's
  that BIN FIXED(8,0) stuff? Are you defining a single byte integer
  there? Does this mean that you can define 24-bit integers, or maybe
  even 19-bit ones? This is insane... :)

 DN>           result              CHAR(256) VAR INIT(''),

            OK, this one is pretty much self-explanatory...

 DN>           (BYTE,RANK)         BUILTIN;

           ... but this one isn't!

 DN>      /* Loop through from lower byte to upper byte */
 DN>      DO curr_byte = RANK(lb) TO RANK(ub);
 DN>           result ||= BYTE(curr_byte);
 DN>      END;

 DN>      /* Job done */
 DN>      RETURN(result);
 DN>  END XRANGE;

  The rest is pretty much clear, except those RANK() and BYTE()
  functions you used there...

In my opinion, a language in which you can grasp the meaning of most of
the statements without ever having seen it before must be a GoodThing(tm).

Especially when those statements put such power in your hands...

 This is one of the reasons I like REXX so much, and don't like Perl at
 all...

IT>>  And one more thing, does PL/I support variable numbers of parameteres
IT>>  like in REXX?

 DN> Not like REXX, but like C. The OS/2 compiler uses the same back-end as
 DN> Visual Age C++, so many object code issues are handled the same way.

       Good enough for me!

                                                            - Ivan -

.!. "Hello World!"  15 Errors, 17 Warnings.
--- Terminate 5.00/Pro [OS/2]
 þ TerMail/QWK þ  
* Origin: GET ALL YOUR FIDO HERE! telnet://bbs.docsplace.org (1:3603/140)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 635/444 506 728 639/252
SEEN-BY: 670/218
@PATH: 3603/140 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.