From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dd4586b9dd51c602 X-Google-Attributes: gid103376,public From: "Marin David Condic, 561.796.8997, M/S 731-96" Subject: Re: general-purpose vs. domain-specific programming languages Date: 1998/01/05 Message-ID: <98010512040396@psavax.pwfl.com>#1/1 X-Deja-AN: 313494576 Sender: Ada programming language Comments: To: westley@calspan.com X-VMS-To: SMTP%"INFO-ADA@VM1.NODAK.EDU" X-VMS-Cc: SMTP%"westley@CALSPAN.COM",CONDIC Newsgroups: comp.lang.ada Date: 1998-01-05T00:00:00+00:00 List-Id: "Terry J. Westley" writes: >Here are the sorts of questions I would like such research to address: > Why do people use Perl so much for CGI programming? > Why can't I write some libraries so that Ada is just as easy to > use to search and replace data in text files as Perl? > Why is string and list handling so much easier in Tcl and Perl > than in Ada? > I don't know Perl, so I can't speak to specific features. It would seem that even in a 'string friendly' language like Perl, you'd still need to specify certain things like the source file, the object file, the string (or meta-string?) to search for and the string with which to replace it. In Ada, you might build a package like this: package Perl_Like_Utilities is procedure Search_And_Replace ( Source_File : in String ; -- OS dependent filename. Object_File : in String ; -- OS dependent filename. Search : in String ; Replace : in String) ; -- And whatever else you think you need. end Perl_Like_Utilities ; Then using Text_IO or Stream_IO and the various string manipulation packages, you could build up the procedures you need. Of course, at this point, you are acting in the same capacity as the Perl-primitive-implementor. The guy who had to code up the behavior of the Search_And_Replace primitive (whatever it is in Perl) had to operate by reading the file and laboriously comparing characters - probably in assembler. But its a job you only do once. I'll agree that the string handling packages in Ada (See "Strings - A.4.1" in the ARM for the description of Ada.Strings, Ada.Strings.Maps, Ada.Strings.Fixed, Ada.Strings.Bounded, Ada.Strings.Unbounded) can be confusing. They don't provide the utilities that *I* would have written (everybody has their own favorite way of doing things) but they are fairly "regular" ("orthogonal" is also a favorite term) and they will usually get the job done. As with anything else, you've got to spend the time to learn "The Ada Way" of doing it and not try to write Perl (or Snobol, or Lisp, or Basic) only with Ada syntax. I'd suspect that if you could come up with a list of your favorite Perl primitives and a description of their semantics, it would be possible to build an Ada package that provided equivalent features, perhaps by utilizing the Ada.Strings... packages as the underlying implementation. (Maybe you'd like to e-mail me some examples and we could investigate how difficult the job might be.) A decent specification might even gain some wider acceptance as a defacto standard if it was circulated widely. MDC Marin David Condic, Senior Computer Engineer Voice: 561.796.8997 Pratt & Whitney GESP, M/S 731-96, P.O.B. 109600 Fax: 561.796.4669 West Palm Beach, FL, 33410-9600 Internet: CONDICMA@PWFL.COM ============================================================================= "Outside of a dog, a book is man's best friend; inside a dog, it's too dark to read..." -- Groucho Marx =============================================================================