delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/10/03:10:18

To: djgpp AT delorie DOT com
Date: Fri, 10 Dec 1999 06:44:20 0000
From: "Nimrod Alonzo Abing" <synflood AT eudoramail DOT com>
Message-ID: <MJDOCCMKEPBCBAAA@shared1-mail.whowhere.com>
Mime-Version: 1.0
X-Sent-Mail: off
X-Mailer: MailCity Service
Subject: Turbo Pascal with OOP (was Re: Why not DJGPP?)
X-Sender-Ip: 208.160.246.197
Organization: QUALCOMM Eudora Web-Mail (http://www.eudoramail.com:80)
Reply-To: djgpp AT delorie DOT com

On Tue, 07 Dec 1999 13:29:31   Michael Abbott aka frEk wrote:
>Heya all
>
>Jared Stevens wrote:
>
>> On Sat, 04 Dec 1999, you wrote:
>> > WOW!!! You learn C at school. Just comes to show how BEHIND
>> > south africa really is. We still do that ol' boring PASCAL
>> > stuff. It really erretates me because I'm so accustomed to
>> > working with C (I use DJGPP by the way) and always make
>> > errors at school.

--

About Pascal (Blaise Pascal that is), he was good with  numbers ;-) Though I learned C before I learned Pascal, it was through Turbo Pascal 5 and up that I learned the basic concepts of object oriented programming. I later learned C++ and found how weak the OOP features of TP were. The C++ IMHO has the most powerful macro preprocessor, it allows you to completely redefine the language. Since C++ is a superset of C, it sticks with the nature of C in that it allows seemingly strange syntax to compile (and run). Other great features of C++ are operator and function overloading which, for me is the most useful feature.

In C++ you can:

   my_class class1, class2;

   class1 = class2;

If the = operater has been overloaded, the assignment statement would operate properly, all data members will be copied as they were defined in the = operator method.

In TP, you would have to copy each member one by one:

   object1, object2 : my_object;

   object1.init;
   object2.init;

   object1.data1 := object2.data1;
   object1.data2 := object2.data2;

            . . .

   object1.datann := object2.datann;

For me this approach is far from efficient and it's very prone to errors. One more thing: Turbo Pascal doesn't allow functions to return user object types. An example of what Pascal cannot do:
 
  class1.get_ptr_to_object ()->do_something ();

  get_ptr_to_object () returns a pointer to an
  object that is a private data member of
  class1.

I have a lot of gripes regarding Pascal the language, but it would make this message to long for its own good. There are many C++ features that are lacking or poorly implemented in Pascal.

Pascal doesn't have:

   1. template keyword for creating generic
      functions and classes.
 
   2. dynamic_cast<>() and static_cast<>()

   3. try ... catch ... throw

   4. casting between completely unrelated
      data types

   5. default function parameters

These for me are very important in programming, especially systems programming.

One thing I like about Pascal is that it's easy to do pseudocode and put it through Pascal to see if your algorithm works. And Pascal code is very readable even if done by bad proggers. Plus its strict syntax and data typing catches frequently made errors when programming.

--

>>
>> Glad I don't live in south africa. :)

You should try living in the Philippines >:-)

>
>I'm an ex-SAan (been in oz for a year now:) and had the same problem :) The biggest
>one was the project we had to do every year. The class would divide itself up into
>groups and every group could make anything they wanted as long as it was in Turbo
>Pascal. My friends and I were making great games (well by school standards anyway :)
>but couldn't use them because they were in DJGPP not TP :( We had to make something
>inferior (which was better than any of the other projects anyway)...
>
>It was more fun charging people to do their projects because they had no idea how to
>program at all :)
>
>The schools are having problems with all the subjects not just the computer science so
>that's probably the last thing they will fix :(
>
>> > eg  C/C++         PASCAL
>> > IF ( a==b )   IF a=b
>> >
>> > sux doesn't it.
>>
>> Yep. It does. I learned C before I entered High School, but they wouldn't let
>> me take a C/C++ class because it was the most advanced class in the school, and
>> it wasn't totally a class yet... it didn't have a set curriculum and they just
>> threw it in with the Pascal class. (so there was a C++ class and pascal class
>> in the same room with one teacher.) It didn't become a real class until last year,
>> when the computer science AP test was written in C/C++. (And we have the best
>> computer science department in the district.)
>
>I also learnt C before highschool otherwise there is no way I would've made it through
>the boring c.sci lessons :)
>
>Tho' I didn't really learn Pascal (couldn't be bothered) until the last year where I
>played around a little to get a feel for the language and then used the help menus!
>Shows how easy our computer science exams were :)
>
>> > to reply: DJGPP is an excelent (did someone mention FREE)
>> > compiler and I had no real trouble (apart from my stupid
>> > errors) with it.
>>
>> I agree... I prefer it to Borland and Watcom. It has been faster and has had
>> way better support, (via this list and a few other resources).
>
>That's what great about free / GNU products! Instead of some lame company doing the
>requests they care about, you get a whole bunch of people fixing all the problems they
>have with the product. Could you image if Linux was owned by a company like M$ !!! :)
>
>- Michael
>
>


Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019