News for hackers. Stuff that matters.
Re:Pascal at Apple by loeg on Friday July 21, 2017 @11:02PM (#14825160)
Speaking of few differences from C and busted string semantics: my least favorite thing about Pascal is that strings and some types are 1-indexed, but dynamic arrays are 0-indexed.

https://stackoverflow.com/questions/4083356/array-begin-from...

Re:Pascal at Apple by clouddrover on Saturday July 22, 2017 @02:49AM (#14825785)
And an annoying difference between the desktop and mobile compilers for Delphi is that on desktop strings are 1-indexed as they've always been but on mobile strings are 0-indexed:

http://docwiki.embarcadero.com/RADStudio/Berlin/en/Migrating...

Re:Pascal at Apple by kabdib on Saturday July 22, 2017 @12:56AM (#14825476)
Oh lordy, I'd forgotten the array index thing. That was painful.
Re:Pascal at Apple by clouddrover on Saturday July 22, 2017 @03:02AM (#14825807)
The Low and High compiler intrinsics make array indexes easy to deal with. You don't need to care about the indexing to iterate over the array. You just go from Low(array) to High(array):

http://docwiki.embarcadero.com/Libraries/Berlin/en/System.Lo...

Re:Pascal at Apple by kabdib on Saturday July 22, 2017 @05:23AM (#14826199)
I don't remember if Apple Pascal had those intrinsics or not. But I never saw any code that used them, and I read most of the Pascal code base for MPW and a bunch for the OS.
Re:Pascal at Apple by pjmlp on Saturday July 22, 2017 @08:55AM (#14826952)
Turbo Pascal had them.
Re:Pascal at Apple by pjmlp on Saturday July 22, 2017 @08:54AM (#14826948)
Coming from Basic that wasn't a problem.

It always felt quite natural to me.

Re:Pascal at Apple by yardshop on Friday July 21, 2017 @11:33PM (#14825248)
And the string length is in the 0 byte, meaning no strings longer than 255 bytes. At least in old Turbo Pascal anyway!
Re:Pascal at Apple by clouddrover on Saturday July 22, 2017 @02:46AM (#14825778)
Yes, this is not a limitation in Free Pascal or Delphi. The ShortString type still exists and is limited to 255 bytes. But the AnsiString, WideString, and UnicodeString types are variable length and can be up to 2 gigabytes:

http://docwiki.embarcadero.com/RADStudio/Berlin/en/String_Ty...

Re:Pascal at Apple by yuhong on Sunday July 23, 2017 @05:51PM (#14834603)
In the case of classic Mac OS it was part of the API.
Re:Pascal at Apple by pjmlp on Saturday July 22, 2017 @08:57AM (#14826963)
With 640 KB it wasn't as there was a lot of space to have bigger strings.

Besides, there were arrays as well, and TPW had safer strings without that limitation PCharStr.