comp.lang.ada
 help / color / mirror / Atom feed
From: Pi <pi3_1415926536@yahoo.ca>
Subject: Re: ada vs. cpp
Date: Thu, 4 Oct 2001 04:42:00 -0400
Date: 2001-10-04T04:42:00-04:00	[thread overview]
Message-ID: <4XUu7.18551$4l5.2541822@news20.bellglobal.com> (raw)
In-Reply-To: 9pgu0l01687@drn.newsguy.com

mike@nospam wrote :

> In article <tTRu7.25751$S_6.2879078@news20.bellglobal.com>, Pi says...
> >
>  
> >
> >You say that it's text-based.
> >Do you have to parse the text-input?
> >In this case I would consider using Perl[1] for the parsing
> >and than the actual treatement in Ada.
> >(Strings aren't Ada's strength)
> >
> 
> 
> first, perl is ugly. it is write-only language.
> 
> second, I think Ada is brilliant for strings, I used only standard
> Ada packages for strings, and the standard Ada library strings are quite
> good.

I find string parsing with Ada standard library's ugly.

> and even though I have worked much in it, I understand that GNAT
> has now snobol-like package (and you can't say sbitbol aint for strings)
> and GNAT also has perl like reqular expressions package too. 

Didn't know this, just found it ...
forget what I said about Perl and use GNAT.Regpat ;-)

> (even
> Java 1.4 has now a reqular expression classes, so there is no reason
> to use perl anymore :)
> 
> >2nd : Objects :
> >as long as you dont need special features you're fine with Ada.
> >Just consider a package like an object and you're cool.
> >
> 
> I think the confusion comes from this: In java, the most popular OO
> language these days, a package is really nothing but a directory where
> files exist in it. Each file represents a class (not considering inner and
> private classes for the moment).
> 
> i.e. in Java
> 
> class  <---> own file
> 
> In Ada, a package is declared/defined in a file. i.e.
> 
> Ada package <--> own File
> 
> very loosely put.
> 
> So, the object in Ada sits in a file that "belong" to a
> package. This is the core difficulity many face when trying to use Ada
> OO features I think.
> 

Maybe, but I still use one file per "class" in Ada.
I find it much more lisible if I export only one (tagged) type per package.
(plus any convenient enumartion type, subtypes, etc ...)

So you have the class and his methods clearly regrouped.
And you can use package extention + tagged type extention combined.

> 
> Now DELPHI has the same thing as Ada, but in DELPHI,
> an object has it own 'class' key work inside a package, which makes it
> less confusing to some.  It is all syntax suger, and at the end it all
> comes down to the same thing, but in Ada it does take a little more time
> to get used to doing OO if one comes from Java or C++. It is all about the
> object.method() vs. method(object) notation.
> 

But in Ada you have no "end" after the definition of the methods.
The "end" comes after the attributes,
but the position of the methods has a *major* impact,
especially if you want to use polymorphism.

IIRC you have to specify the headers (but *only* the headers)
of all method that you want to use polymorph *directly* after
the declaration of the tagged type.

And this is poorly documented and the compiler warnings are of
no much help either.

> >
> >4th : Polymorphism
> >Argh, only possible with tagged type and true crap, so stick with C++
> 
> I do not understand the above. a tagged record is a record you can extend,
> what is so hard about it? think of a tagged record + its operations as a
> class.
> 

See above why I consider polymorphism in Ada an ugly patchwork.

> >5th : Multiple Heritage
> >Not possible with Ada.
> >
> 
> big deal. MI is not possible in Java too, but I do not see it stopping
> people from using Java (2.5 million programmers use Java these days and
> counting).
> 

He asked if he should port his project from cpp to Ada.
What do I know if he uses MI?

You're right, normally nobody needs it,
but when you need it it causes problems,
so you wont use it anyway.

> >[1] Perl is your worst nightmare for big project,
> >but the best language for text parsing out there,
> >so if you use it, use it *only* for the parsing.
>  
> Untill you get to have to fix the code, then you are stuck wasting hours
> and hours trying to figure what the code does.
> 

It's much easier to write unreadable code in Perl,
but that doesn't mean you have too.

Beside, the parsing of an input line would be very short.
Maybe 10 lines of code + 30 lines of commentary.
(but GNAT.Regpat is still a better choice)

> There is no perfect language. May be someone should invent a language
> which looks like Java, but acts like Ada, then it will be a real winner :)
> 

So true, Java has the most beautiful grammar + syntax I've ever seen,
<g> interested in writing an Java to Ada compiler? (only half kidding)

> Java has nice global features, but week at the core languge level (it is
> like an enterprise version of VB). Ada is best engineered language, but
> not much window dressing on it to attract the industry.
> 
> Try to do an enumeration type in Java with the same features that comes
> with Ada per-build, and you'll see what I mean. (one simple example).
> There is a whole section (2-3 pages) in 'effective Java' book on how to
> make an enumeration type safe in Java, and at the end, it does not give
> you 5% of what Ada enumeration does in one line.
> 

Very true (had to do this once), but

if you want an enumeration type you shouldn't use Java.
An enumeration type is not an OO-Concept and therefor isn't included.

Beside, as you have to write it yourself you can also
make it more powerful. (Enumeration of objects?)

But, I admit, I missed enumerations in Java ...

-- 
3,14159265359



  reply	other threads:[~2001-10-04  8:42 UTC|newest]

Thread overview: 148+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-03 20:42 ada vs. cpp Ralph M�ritz
2001-10-03 20:56 ` Preben Randhol
2001-10-03 21:07   ` Ralph M�ritz
2001-10-04  5:08     ` Pi
2001-10-04  5:07       ` Ed Falis
2001-10-04  5:13       ` David Starner
2001-10-04 10:57         ` Preben Randhol
2001-10-04 13:18           ` Marin David Condic
2001-10-04 16:30             ` Pascal Obry
2001-10-04 17:05               ` Marin David Condic
2001-10-05 15:22               ` Mike Mohr
2001-10-06  9:15                 ` Pascal Obry
2001-10-06 11:23                   ` MM
2001-10-06 12:27                     ` Marc A. Criley
2001-10-06 16:53                     ` James Rogers
2001-10-09 13:51                     ` Marin David Condic
2001-10-09 14:13                       ` James Rogers
2001-10-09 14:25                         ` Marin David Condic
2001-10-10 16:46                           ` Warren W. Gay VE3WWG
2001-10-09 15:10                         ` Robert*
2001-10-09 16:17                           ` James Rogers
2001-10-11 12:03                             ` David Botton
2001-10-09 14:43                       ` Robert*
2001-10-09 15:18                         ` Wes Groleau
2001-10-09 18:21                           ` Marin David Condic
2001-10-09 20:37                             ` James Rogers
2001-10-09 16:21                         ` James Rogers
2001-10-09 16:43                           ` Lutz Donnerhacke
2001-10-10  5:18                         ` Richard Riehle
2001-10-10 13:21                           ` Marin David Condic
2001-10-10 14:15                           ` Wes Groleau
2001-10-22  2:07                             ` David Thompson
2001-10-22 13:35                               ` Wes Groleau
2001-10-22 19:14                                 ` Ole-Hjalmar Kristensen
2001-10-23  5:40                               ` Richard Riehle
2001-10-09 15:06                       ` Ole-Hjalmar Kristensen
     [not found]                       ` <9pv2f20jf4@drn.newsguy <3BC3240B.96703A8B@worldnet.att.net>
2001-10-10  5:47                         ` Simon Wright
2001-10-06 22:38                   ` Frode Tennebø
2001-10-06 23:48                     ` mike
2001-10-07  7:31                       ` Pascal Obry
2001-10-08 14:55                   ` Mike Mohr
2001-10-08 15:07                     ` Mike Mohr
2001-10-08 16:34                     ` Robert*
2001-10-08 17:47                       ` Mike Mohr
2001-10-08 18:38                         ` Robert*
2001-10-09 14:56                           ` Mike Mohr
2001-10-09 15:20                             ` Wes Groleau
2001-10-09 16:14                             ` Steven Deller
2001-10-09 16:55                             ` Pascal Obry
2001-10-08 19:19                         ` James Rogers
2001-10-09  8:17                         ` Pascal Obry
2001-10-09 15:46                         ` Ted Dennison
2001-10-09 17:35                           ` Mike Mohr
2001-10-09 18:45                             ` Ted Dennison
2001-10-08 18:02                   ` Ted Dennison
2001-10-09  4:59               ` David Thompson
2001-10-04 13:16         ` Ted Dennison
2001-10-05  7:50         ` Dmitry Kazakov
2001-10-05 13:31           ` David Starner
2001-10-05 15:34             ` Ted Dennison
2001-10-05 17:49               ` David Starner
2001-10-05 18:54                 ` Wes Groleau
2001-10-05 22:02                   ` James Rogers
2001-10-05 22:35                     ` Wes Groleau
2001-10-06  3:44                   ` David Starner
2001-10-08  8:18             ` Dmitry Kazakov
2001-10-08 13:33               ` David Starner
2001-10-09 13:36                 ` Wes Groleau
2001-10-09 15:29                   ` David Starner
2001-10-10 11:01                     ` Dmitry Kazakov
2001-10-10 11:20                       ` Lutz Donnerhacke
2001-10-10 12:14                         ` Robert*
2001-10-10 13:31                           ` Lutz Donnerhacke
2001-10-10 14:36                         ` Steven Deller
2001-10-10 14:59                           ` Wes Groleau
2001-10-10 15:15                           ` Lutz Donnerhacke
2001-10-10 15:16                           ` Dmitry Kazakov
2001-10-10 16:10                             ` Florian Weimer
2001-10-11  8:02                               ` Dmitry Kazakov
2001-10-10 15:59                         ` Brian Rogoff
2001-10-10 18:50                           ` David Starner
2001-10-11  9:28                             ` Lutz Donnerhacke
2001-10-10 14:03                       ` David Starner
2001-10-10 16:40                         ` Ted Dennison
2001-10-10 17:53                         ` Pascal Obry
2001-10-10 23:11                           ` David Starner
2001-10-11  3:00                             ` James Rogers
2001-10-22  2:10                               ` David Thompson
2001-10-05 13:52           ` James Rogers
2001-10-05 14:28             ` Larry Kilgallen
2001-10-05 14:07           ` Ted Dennison
2001-10-16  4:52           ` David Thompson
2001-10-16 10:21             ` Dmitry Kazakov
2001-11-13  2:12               ` David Thompson
2001-11-13 10:21                 ` Dmitry A. Kazakov
2001-11-13 16:05                   ` Ted Dennison
2001-11-14  9:29                     ` Dmitry A. Kazakov
2001-10-04  6:01       ` mike
2001-10-04  8:42         ` Pi [this message]
2001-10-04 12:22           ` James Rogers
2001-10-04 17:50         ` perl Warren W. Gay VE3WWG
2001-10-04 19:27           ` perl maa
2001-10-05 12:15             ` perl Georg Bauhaus
2001-10-04 19:28           ` perl Larry Kilgallen
2001-10-05  7:24           ` perl Lutz Donnerhacke
2001-10-05 12:38             ` perl Georg Bauhaus
2001-10-06 19:00               ` perl Florian Weimer
2001-10-04 16:26       ` ada vs. cpp Pascal Obry
2001-10-04 18:47         ` David Botton
2001-10-04 22:29         ` Jacob Sparre Andersen
2001-10-04 22:31           ` Wes Groleau
2001-10-04 22:52           ` Preben Randhol
2001-10-05 12:43             ` Georg Bauhaus
2001-10-05 13:09               ` Preben Randhol
2001-10-06  1:05         ` Mike Silva
2001-10-04 13:50     ` Ted Dennison
2001-10-03 21:03 ` Marin David Condic
2001-10-04  2:40 ` Jeff
2001-10-05  1:23 ` Adrian Hoe
2001-10-05  4:34   ` mike
2001-10-05  4:42   ` mike
2001-10-05 11:13     ` Adrian Hoe
  -- strict thread matches above, loose matches on Subject: below --
2001-10-12 20:54 Richard Pinkall-Pollei
2001-10-12 21:28 ` Vector..
2001-10-13  7:07   ` Dale Stanbrough
2001-10-14  8:15   ` Jean-Marc Bourguet
2001-10-15 10:04   ` Nexus
2001-10-15 12:18   ` Lutz Donnerhacke
2001-10-15 21:25     ` Florian Weimer
2001-10-22  2:08       ` David Thompson
2001-10-22  7:04         ` Florian Weimer
2001-10-22  7:31           ` Lutz Donnerhacke
2001-11-13  2:12           ` David Thompson
2001-10-16  8:47     ` Jean-Marc Bourguet
2001-10-16 10:08       ` Lutz Donnerhacke
2001-10-16 11:07         ` Jean-Marc Bourguet
2001-10-16 12:00           ` Lutz Donnerhacke
2001-10-16 19:08           ` Darren New
2001-10-16 15:46         ` Florian Weimer
2001-10-16 19:31           ` Stephen Leake
2001-10-16 20:13             ` Florian Weimer
2001-10-16 21:42               ` Stephen Leake
2001-10-17  8:37                 ` Florian Weimer
2001-10-17  8:45                   ` Lutz Donnerhacke
2001-10-16 13:45       ` Ted Dennison
2001-10-16 13:54         ` Jean-Marc Bourguet
2001-10-16 13:54         ` Lutz Donnerhacke
2001-10-15 13:44   ` Marin David Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox