Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.os.vms    |    DEC's VAX* line of computers & VMS.    |    264,096 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 262,263 of 264,096    |
|    =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Lawrence D'Oliveiro    |
|    Re: Fun trick    |
|    14 Jan 25 11:03:27    |
   
   From: arne@vajhoej.dk   
      
   On 1/13/2025 11:38 PM, Lawrence D'Oliveiro wrote:   
   > On Mon, 13 Jan 2025 21:08:11 -0500, John Reagan wrote:   
   ### They are probably most useful for modules, but why not allow   
   ### them for programs?   
   >> Extended Pascal says only MODULEs so we just didn't   
   >> think about allowing them in PROGRAMs even though we allow [INITIALIZE].   
   >   
   > Not sure what the point would be in having them in PROGRAMs, anyway.   
      
   Definitely most useful for modules. I was just wondering   
   why not allow it in programs as well.   
      
   It seems to have been explicit disallowed. The error message is:   
      
   %PASCAL-E-TOPROGRAM, TO BEGIN/END DO not allowed in PROGRAM   
      
   If one start to look for something useful then I would say that   
   TO BEGIN is just code after PROGRAM BEGIN, but TO END is more   
   than just code before PROGRAM END as it get triggered by other   
   program exits as well.   
      
   Demo:   
      
   $ type m.pas   
   module m(input,output);   
      
   to begin do writeln('m to begin');   
   to end do writeln('m to end');   
      
   end.   
   $ type p.pas   
   [inherit('m', 'sys$library:starlet')]   
   program p(input,output);   
      
   [initialize]   
   procedure init;   
      
   begin   
    writeln('init');   
   end;   
      
   procedure done;   
      
   begin   
    writeln('done');   
   end;   
      
   var   
    ent : integer64;   
    desblk : array [1..4] of integer;   
    cond : integer;   
      
   begin   
    writeln('begin');   
    desblk[1] := 0;   
    desblk[2] := iaddress(done);   
    desblk[3] := 0;   
    desblk[4] := iaddress(cond);   
    $dclexh(desblk);   
    $get_entropy(ent, 8);   
    if (ent mod 2) = 0 then $exit(SS$_NORMAL);   
    $canexh(desblk);   
    writeln('end');   
   end.   
   $ pas/env m   
   $ pas p   
   $ link p + m   
   $ run p   
   m to begin   
   init   
   begin   
   end   
   m to end   
   $ run p   
   m to begin   
   init   
   begin   
   done   
   m to end   
   $ run p   
   m to begin   
   init   
   begin   
   end   
   m to end   
   $ run p   
   m to begin   
   init   
   begin   
   done   
   m to end   
      
   Arne   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca