[comp.sys.amiga] Language Designs

lishka@uwslh.UUCP (Fish-Guts) (09/17/88)

In article <2113@mva.cs.liv.ac.uk> rkl@mva.cs.liv.ac.uk writes:
>Well, if you have over 100 string concatenations in your program (as I often
>do in my major Pascal programs), then I'd far rather use + than concat.

     If you are doing a *lot* of string manipulations in your programs,
you may want to consider programming languages more suited towards
that purpose.  I believe that "Icon" is one of them, and there is a
version available for the Amiga (this info comes from a friend who
knows a lot about many languages; I personally have not used Icon, so
don't just trust me...look into it for yourself).

>In article <3417@crash.cts.com>, haitex@pnet01.cts.com (Wade Bickel) writes:
>>  There are many string manipulation functions provided in Benchmark
>> Modula-2, and it is easy enough to deal with these things without them anyway.
>
>In standard Pascal, there's no such things as dynamic strings, let alone the
>+ operator to concatenate two strings. In fact, you quickly grow to hate
>standard Pascal because of this and you want to strangle Nicklaus Wirth.

     Dynamic strings are not always a great idea.  You need some sort
of memory-management/garbage-collection scheme to allocate/de-allocate
memory for strings, which can be costly (in terms of time and space)
if your application doesn't use the particular memory-management to
its full potential.  Besides, any memory-management is more costly
than no memory-management.

     I personally do not mind C's methods (i.e. strcat, strcpy, etc).
It let's me do the memory management *if*I*need*it*.  I do not find it
too awkward to use.  What qualifications can I base my opinions on?
Wellll, I wrote a natural language parser/generator a year ago, which
used a *lot* of string manipulations.  Even though the original code
was written in Pascal, I threw away the Pascal string operators,
linked in the C string library, and used those instead.  Faster, more
efficient, and not a lot of bother, even though I had to type
"(void) strcat(foobar, glarch)" instead.

>>  What happens when you concatenate two strings and the destination is too
>> short to hold the result?
>
>Ho hum. There are, on decent Pascal compilers, options to enable/disable range
>checking. Hence you can either :
>1) Enable range checking. This will generate a run-time error when the string
>   is too long.
>2) Disable range checking. This will truncate the string to its maximum length
>   allowed if it is too long.
>
>> How much run-time code do you want to include to handle programmer sloppyness?
>
>See above. Enabling range checking adds about 2K to the average program length.

     And a more time per string operation.  And possibly fragmented
memory if a dynamic method is used.  Each solution (Dynamic Strings,
Static Strings with and without Range Checking) has it good and bad
points.  And they *all* have bad points!

>>         PASCAL is especially unsuited to the Amiga
>
>The reason it is unsuited to the Amiga is because Borland haven't done
>Turbo Pascal on it yet ! You'll soon understand what I mean if you try to
>use MetaComCo Pascal - yuck !

     A friend who has used Turbo-Pascal (and who is an excellent
programmer) knocks it because it is not (or at least was not) suited
to real development work.  One of the reasons he sited was the
inability to perform non-local goto's.  I know a lot of people
like/use Borland's programs, but I would like to know how many are
developers.  I have heard similar complaints about Turbo-Prolog.
Don't get me wrong: I am not trying to knock Borland (their Turbo
products seem to be great products at a great price), but they are not
the end-all-be-all compilers/interpreters that many people seem to want
to make them out to be.  To me they seem to be excellent products for
people who are starting out learning a particular language.  BTW, more
than one friend has complained about Turbo-Pascal.

     I haven't used MetaComco Pascal, but I have used Berkeley Pascal.
All I can say is "never again...."

>>         Maybe you should take a look at Amiga Basic.
>
>Maybe you should get a spelling checker.

     Maybe we should all open our minds a bit (myself included).  I
agree that a good Pascal on the Amiga is warranted, because it is a
nice language for beginning programmers (and some developers).  I
don't think it would work as *the* language for the Amiga...the
pointers in particular are way to restrictive (yes, if I set my
pointer at location 0, I want it to point there! ;-)

     However, knocking every other language in existence because they
do not have the "+" operator for string concatenation is a bit naive.
There are *very* good reasons why some languages do not have the
operator, and dismissing those languages as inadequate is foolish.
Lisp does not even allow "infix" operators...that does not mean it is
a bad language because you cannot write "string1 = string2 + string3".
Different languages are designed for different purposes.  Some are
designed specifically for string operations...even more so than Pascal
(i.e. check Icon and possibly Awk).  Most are not...there are other
design goals out there besides concatenating strings. 

>Richard K. Lloyd,       **** This is a MicroVAX II running VAX/VMS V4.7 ****

					.oO Chris Oo.

-- 
Christopher Lishka                 ...!{rutgers|ucbvax|...}!uwvax!uwslh!lishka
Wisconsin State Lab of Hygiene                   lishka%uwslh.uucp@cs.wisc.edu
Immunology Section  (608)262-1617                            lishka@uwslh.uucp
				     ----
"...Just because someone is shy and gets straight A's does not mean they won't
put wads of gum in your arm pits."
                         - Lynda Barry, "Ernie Pook's Commeek: Gum of Mystery"