🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1008

Continuation of previous letter

#1008
From: Cobus Debeer
Date: Fri, 27 Jul 1990 04:22
73 lines
3495 bytes
 
Hello: 
 
   With regard to the function without a RETURN statement, I believe that 
   both the compile-time error and the run-time error should occur.  In  
   keeping with the philosophy of M2, the compiler is 'strict' and should 
   not accept dubious code or code that is obviously incorrect, like  
   function procedures that don't return values.  The existense of one or 
   more RETURN statements does not guarentee that all possible points of 
   of return from the procedure returns a value and this must be caught at 
   run-time.  See the following : 
      PROCEDURE Error () : INTEGER; 
      BEGIN 
         IF Condition1 THEN 
            ... 
            RETURN 1; 
         ELSIF Condition2 THEN 
            Code; MoreCode; 
         END; 
      END Error; 
   There is at least two ways in which the procedure can end without a RETURN 
   statement. 
 
  With regards to differences between the JPI compiler and PIM2, I have  
  experienced the following difference in the worst possible way.  In a def 
  file I wrote : 
 
  DEFINITION MODULE RegExp; 
 
  PROCEDURE PosNL( Source, Pat  : ARRAY OF CHAR; VAR Len :     
          CARDINAL; OccurrenceNo : CARDINAL ) : CARDINAL; 
  END RegExp. 
 
  IMPLEMENTATION MODULE RegExp; 
 
  PROCEDURE PosNL( Source, Pat  : ARRAY OF CHAR; VAR Len :     
          CARDINAL; StartFrom : CARDINAL ) : CARDINAL; 
  BEGIN .. END PosNL; 
 
  etc 
  END RegExp. 
 
  After writing the implementation of the function as declared in the def  
  and using it I changed my mind as to how it should work and I changed the  
  implementation and the name of the last parameter.  Later I re-used the 
  code and nearly lost my sanity ...  The compiler should not just count the 
  parameters and check their types, it must also check that the names of the 
  parameters are identical as declared in the definition and implementation  
  parts.  Just imagine what will happen in a multi-programmer project where  
  the DEF files are the only part available to the implementer of other  
  modules ( as it should be ).  The old V2 Logitec compiler got this right. 
 
  I would love to get hold of a new release of your libraries that use 
  assembler pieces as the versions that I have is now broken due to the new 
  release of the compiler.  If you ever need regular expression matching 
  code, I have a working matcher which I will make available to anybody 
  who offers something in return ( or who asks nicely ) but I am not willing 
  to put the source on a bulletin board. 
 
  Do you know if a YACC / LEX equivilent tool exists for M2 ie. something that 
  produces M2 as output from a grammer as input ? 
 
  Regards 
  Cobus de Beer 
 
 
 


--  
uucp: uunet!m2xenix!puddle!5!491!1.0!Cobus.Debeer
Internet: Cobus.Debeer@p0.f1.n491.z5.fidonet.org
Technical Details
Message-ID: <2370.26B1547F@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!unicorn!ogicse!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p0.f1.n491.z5.fidonet.org!Cobus.Debeer

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!unicorn!ogicse!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p0.f1.n491.z5.fidonet.org!Cobus.Debeer
From: Cobus.Debeer@p0.f1.n491.z5.fidonet.org (Cobus Debeer)
Newsgroups: comp.lang.modula2
Subject: Continuation of previous letter
Message-ID: <2370.26B1547F@puddle.fidonet.org>
Date: 27 Jul 90 04:22:17 GMT
Sender: ufgate@puddle.fidonet.org (newsout1.26)
Organization: FidoNet node 5:491/1.0 - Golden City Opus, Johannesburg RSA
Lines: 73