[comp.sys.mac] LSP 2.0 FLAME

mikeoro@hubcap.UUCP (Michael K O'Rourke) (02/09/89)

I just tried to take an old turbo pascal program and port it in to LSP 2.0.
But lo and behold to my great surprise did i find the stupidest apparent error
in LSP.

if a is of type string and i say :

a := '5';

it promptly dislikes

a := a + '3';

Come on!! I've been doing this for years! I should get a = 53. What's the 
problem? Rich?

Michael O'Rourke
 

drc@claris.com (Dennis Cohen) (02/09/89)

In article <4359@hubcap.UUCP> mikeoro@hubcap.UUCP (Michael K O'Rourke) writes:
>I just tried to take an old turbo pascal program and port it in to LSP 2.0.
>But lo and behold to my great surprise did i find the stupidest apparent error
>in LSP.
>
>if a is of type string and i say :
>
>a := '5';
>
>it promptly dislikes
>
>a := a + '3';
>
>Come on!! I've been doing this for years! I should get a = 53. What's the 
>problem? Rich?

I'm not Rich, but I couldn't let this one pass.

This is one of my pet peeves re Turbo, the other being the lack of Get and
Put.  "+" is only string concatenation in Turbo.  It doesn't exist in that
guise in Pascal.  You won't find it in other Mac or DOS Pascal compilers
and definitely will not find it in "standard" Pascals on larger systems (or
extended ones that I am aware of).  This is NOT a bug in LSP -- it is a
silly extension in Turbo that they don't even make clear is non-standard
(though you can find out that it's an extension if you know where to look).

Use concat if that is what you want to do.  That's what is provided by most
compilers for string concatenation -- although it is also an extension.  At
least it is a fairly "standard" extension. :-)

Dennis Cohen
Claris Corp.
------------
Disclaimer:  Any opinions expressed above are _MINE_!

mikeoro@hubcap.UUCP (Michael K O'Rourke) (02/10/89)

> This is one of my pet peeves re Turbo, the other being the lack of Get and
> Put.  "+" is only string concatenation in Turbo.  It doesn't exist in that
> guise in Pascal.  You won't find it in other Mac or DOS Pascal compilers
> and definitely will not find it in "standard" Pascals on larger systems (or
> extended ones that I am aware of).  This is NOT a bug in LSP -- it is a
> silly extension in Turbo that they don't even make clear is non-standard
> (though you can find out that it's an extension if you know where to look).

Oh really? I guess it has been a long time since I've used standard pascal.
I've been using turbo on the ibm and mac for so long.

Now I guess I'll eat my words. Sorry Rich. But hey, how about making it a       
feature in the next version.  I really think it is an incredibly nicety. Having
to type concat all the time will be a real pain!

Humbly,

Michael O'Rourke.

thecloud@pnet06.cts.com (Ken Mcleod) (02/10/89)

mikeoro@hubcap.UUCP (Michael K O'Rourke) writes:
>
>if a is of type string and i say :
>
>a := '5';
>
>it promptly dislikes
>
>a := a + '3';

  'a' is defined as an array of chars, not a pointer... you can't do
addition on arrays! If TP let you do this, that doesn't mean it's right,
or even standard. 

  Try instead the standard Pascal library function 'concat', as in:

a := '5';
a := concat(a, '3');  { now the string a is '53' }

-k
==========    .......    ===================================   ============
Ken McLeod   :.     .:   UUCP: {crash uunet}!pnet06!thecloud   "They mean
----------  :::.. ..:::  InterNet: thecloud@pnet06.cts.com      to win
!(C)1988       ////            or thecloud@dhw68k.cts.com       Wimbledon!"

bezanson@adobe.COM (Brian Bezanson) (02/10/89)

In article <4359@hubcap.UUCP> mikeoro@hubcap.UUCP (Michael K O'Rourke) writes:
>I just tried to take an old turbo pascal program and port it in to LSP 2.0.
>But lo and behold to my great surprise did i find the stupidest apparent error
>in LSP.
>if a is of type string and i say :
>a := '5';
>it promptly dislikes
>a := a + '3';
>Come on!! I've been doing this for years! I should get a = 53. What's the 
>problem? Rich?

What've you've shown us is how Turbo Pascal allows you to do some things
a non-standard or 'BASIC' way. I could see doing string concatenations with
BASIC like this. In pascal I'd do this in the 'standard' way (standard in that
most modern pascal compilers support these string operators):

a:='5'; {like you did before}
concat(a, '3'); {use the provided string routines}

Not to flame, though it is tempting ;-), Turbo allows for a lot of non-standard
Pascal techniques. You can't expect another compiler will support those
features. It took a long time for Lightspeed Pascal and TML Pascal to
have the 'different' Pascal features that Apple originally put into Lisa and 
then MPW Pascal. 


Brian Bezanson					bezanson@adobe.com

"These words are my own, complete with my personal typos and mistakes!-)"