home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,313 of 2,978   
   Dr Engelbert Buxbaum to RadSurfer   
   Re: const assignment not the same?   
   05 Feb 05 18:43:37   
   
   From: engelbert_buxbaum@hotmail.com   
      
   RadSurfer wrote:   
      
   > const   
   > manifest = 1234;   
   >   
   > Why does const use   =    and not   :=   ?   
      
    = denotes equality in a mathematical sence, for example a = 1.   
      
    := is an assinment, for example i := i+1 (take the content of variable   
   i, add 1 to it and store the result back into the space that i   
   occupies). Note that i = i+1 is mathematical nonsense, there is no i for   
   which that equation would be true.   
      
   > Another thing:   
   > for / to / do [begin/end],   
   > repeat/while   
   > do/until, etc   
   >   
   > What about what 'C/Cpp' would call 'continue' and 'break' ?   
      
   continue and break are not required in Pascal, they are implicit in   
   Pascals block structure. There is one case in nested if-statements where   
   Pascals block structure fails:   
      
   if condition 1   
     then   
        if condition_2   
          then   
             Statement_1   
          else   
             begin   
             end   
     else   
        Statement_2   
      
   Note the empty "else begin end" statement in the nested if-clause, which   
   is required for the compiler to know that the second else refers to the   
   first condition (I once spend an entire week tracing that logical error   
   in one of my early programms). Modula and Oberon have the endif   
   statement to avoid that ambiguity.   
      
   >   
   > The TP 5.5 documentation seems weak on explaining how to Continue a   
   > loop,   
   > and how to Break out early...   
      
   you normally don't. In proper structured programming, a loop simply goes   
   on until th exit condition is true, and the limits of the loop-clause   
   are defined by the begin..end sequence.   
      
   A break-out from a loop is also not stricly required, Error-conditions   
   inside the loop can be handled by if-clauses:   
      
   repeat   
     ...   
     if not(ErrorCondition)   
       then   
          ....   
   until ErrorCondition   
      
   However, sometimes there are so many cases to consider that a strict   
   block-logic would make the program difficult to read. For those cases   
   there are goto- and exit-statements in Pascal. Goto moves to an   
   arbitrary point in the program, exit to the end of the current block.   
      
   > I really think 'C/Cpp' was vastly much easier on the intuitive-scale   
   > then Pascal is.   
      
   They are just messier. Just as it is easier to do a blotched "will do   
   90% of the time" sort of job in any area it is easy to program in a   
   non-structured language. You just start, without much planning and   
   without thought to the logic of the problem.   
      
   In a structured language (like Pascal) you plan ahead: What is the   
   nature of the problem? How do I break down the problem into   
   sub-problems? What special cases do I need to consider? Once you have   
   done that, the actual coding will be much easier, and, what is more   
   important, your code will be easier to maintain and to reuse. Note that   
   90% of all programming effort goes not into the initial coding, but into   
   maintainance. So even a doubling in coding time may pay heavy dividends   
   later, when it halfs maintainence time.   
      
      
   > 'C/Cpp' offers so many powerful features and usually   
   > powerful   
   > libraries that I doubt I would permanently switch to TPascal;   
   > but I am going to stay with this and see what surprises surface.   
      
   C and its successors are "complete" programming languages, just as   
   Pascal and its successors. "Complete" means that any problem solvable in   
   any of these languages can be solvded in all others too. So from the   
   point of power, there is no real difference between these languages.   
   Books like "Numerical algorithms in [?]", where [?] stands for Fortran,   
   C, Pascal, Ada and some others are testimony to that. Availability of   
   subroutine libraries is probably not very different either, check for   
   example the SWAG-library. Large Computer projects like the typesetting   
   program TeX were produced in Pascal, also the original operating system   
   for Macintosh. Of course today one would do such things in   
   Pascal-successors like Modula-3 or Oberon rather than in the original   
   Pascal-language as defined by Wirth. Note however that Turbo-Pascal   
   (from version 5 onward) is a dialect which includes the advanced   
   features of those languages.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca