Live data from Hacker News

Pascal at Apple

blog.fogus.me

41–50 of 145 posts

Re: Pascal at Apple

#41

It may seem quaint now, but Apple Pascal was a serious tool. I took AP Computer Science in 1985 and the language taught was UCSD Pascal on the Apple ][+. (In the 80's, C on an Apple ][ was impossible. The only C compiler you could get was for a card that went in the expansion slot that included a Z80 processor.) When I went to college in 1986, Pascal was the primary language used in all entry-level courses at Virgini…

My first job out of college was porting the interpreter from Macintosh Pascal (the predecessor to Lightspeed/THINK Pascal, sold by Apple) from the Macintosh back to the Apple II (as "Apple II Instant Pascal", also sold by Apple). Boy, was that fun. Had to tuck the interpreter into a 4K "fold" of the Apple II memory map -- a block of address space that was normally mapped to ROM could be switched to point to the corresponding RAM in the language card that would otherwise be inaccessible.

[Edit: to be clear, neither of these were the UCSD Pascal referenced in the original article; I had that on my Apple II in college, and demoed a baseball statistics program I wrote in it to the THINK people as part of my job interview.]

Re: Pascal at Apple

#42
post #2

I really miss Pascal; it was a great and safe language for beginners. As it was extended with Objects and Modules, it was great for development. But there are good reasons it was surpassed by C. In early Pascal, you got a pointer by allocating memory; you could not get a pointer to an existing variable. You'd be surprised how often that gets in the way when implementing a data structure. Just try to implement the fol…

> Just try to implement the following function in C without using the address-of operator:

Pascal had `var` arguments, i.e. call-by-reference, which can be used for similar purposes. Call-by-reference isn't a complete replacement for C pointers, of course, but it also avoided the whole host of memory safety issues arising from C's more general model and which plague C to this day.

> But once you've switched to C, the sheer verbosity of Pascal is bothersome. Instead of "{" and "}" Pascal uses "begin" and "end". It uses "procedure" or "function" to introduce a function.

That's entirely subjective, I think. As somebody who grew up with Pascal and learned C later, I found the C syntax to be comparatively hard to read. I do favor the Modula-2/Eiffel/Ada approach of having "end" terminators instead of "begin" / "end" blocks (which share the troubles that braces have), though.

Re: Pascal at Apple

#43
post #10

I joined Apple in 1987, about the time they started ditching Pascal in favor of C. C++ (in the form of CFront) was just starting to be a thing. Apple's Pascal had been extended to the point where there were few true differences between it and C, other than - strings with busted semantics (size being part of the type being a huge mistake, leading to a proliferation of types like Str255, Str32, Str31, Str64, etc). I sh…

I liked nested functions in Pascal, and put them in D. They turn out to be surprisingly useful: 1. Properly encapsulating their scope, as opposed to having static functions sit awkwardly somewhere else. 2. Factoring out common code within the function. 3. A lot of my need for goto statements vanished with nested functions. 4. Take the address of a nested function, and it serves as a lambda. 5. No need to create "Cont…

Off-topic, but nested functions are one of my favorite gcc extensions.

Re: Pascal at Apple

#44
post #12
post #2

I really miss Pascal; it was a great and safe language for beginners. As it was extended with Objects and Modules, it was great for development. But there are good reasons it was surpassed by C. In early Pascal, you got a pointer by allocating memory; you could not get a pointer to an existing variable. You'd be surprised how often that gets in the way when implementing a data structure. Just try to implement the fol…

How does Pascal compare to python for absolute begginers?

Pascal is a smaller language, and so easier to come to grips with at first glance. The syntax is tailored towards some verbosity which usually appeals to beginners. However, the downside is that you don't have a lot of leverage to do things in Pascal: Python pushes you down a path where you are writing something productive very quickly and can reach into the standard libraries to do many tasks - it makes some things very easy. Pascal requires some time to prepare the solution and encode it in syntax, and it's harder to find what you need, but there is usually code somewhere online that you can adapt. This is a lot to ask of beginners who want to do practical work, though. As of right now Pascal retains a lot of strength in desktop GUI code.

In terms of safety/dangerous code, modern Object Pascal style lets you be as dangerous as C if you want, but the default semantics are much more comfortable, and take you away from the danger zone more often.

Both Python and Pascal are relatively easy to get up and running with, and have pretty solid, standardized toolchains for industry use: in contrast C and C++ leave the build process relatively undefined and varying between compilers and platforms, which has resulted in a huge amount of friction to get any project building on a new machine.

Re: Pascal at Apple

#45
My first programming language was (obviously) BASIC, but my second was Pascal. I took AP computer programming in high school and it was taught with Pascal on Apple II and IIe computers. My dad later bought me Turbo Pascal for the PC (I remember a yellow box with "+ Objects" on it, so it must have been 5.5 Pro in 1989), and I used it on his machine, but never did much with it other than tinker. I finally got what I viewed as a real programming setup when I got DICE (Dillon's Integrated C Environment) for my Amiga a couple years later. Still didn't do much more than tinker, though, until I got a Linux box a couple years after that and source code for everything was available for poking at.

Anyway, Pascal was very common in education back then and Apply was very common in education...ergo, Apple and Pascal went together a lot of the time.

Re: Pascal at Apple

#46
post #4

Earlier quoted context omitted.

When I drive my car without an engine, it only goes downhill. I almost stopped using cars because I thought there was nothing interesting there. It's 2017. Turn on your JavaScript.

I know 10 years ago turning off Javascript was still a real concern. I tend to be of the mindset that in 2017 a browser without Javascript is like a browser without a mouse/trackpad - technically viable, but no one does it, so depending on Javascript is a given. Know of any good statistics on this however?

I've been doing it for over 10 years with no problems. Very rarely do I need Javascript. When I do it is only because some website form for something important, e.g., banking, is forcing it upon users. Then I switch to a graphical browser. It sometimes surprises me how seldom this happens.

IME, most websites work great without JS. Others require a little work to get to the data. And very, very few are comletely non-functional without JS.

Personally, I am inclined to agree with you that the number of folks turning JS off is small. Otherwise methinks developers would make more websites completely non-functional without JS to compel users to use JS. Thankfully, they do not.

As for Pascal, the question is: Is Pascal a better language for teaching programming than Java or Python? At one time Pascal was very popular for this purpose.

Re: Pascal at Apple

#47
post #10

I joined Apple in 1987, about the time they started ditching Pascal in favor of C. C++ (in the form of CFront) was just starting to be a thing. Apple's Pascal had been extended to the point where there were few true differences between it and C, other than - strings with busted semantics (size being part of the type being a huge mistake, leading to a proliferation of types like Str255, Str32, Str31, Str64, etc). I sh…

I liked nested functions in Pascal, and put them in D. They turn out to be surprisingly useful: 1. Properly encapsulating their scope, as opposed to having static functions sit awkwardly somewhere else. 2. Factoring out common code within the function. 3. A lot of my need for goto statements vanished with nested functions. 4. Take the address of a nested function, and it serves as a lambda. 5. No need to create "Cont…

Nested functions are good if you have no alternative. If you use them as lambdas or a means of code folding, (both of which don't exist in older IDEs and compilers) you will have to keep jumping around in code in order to follow the logic. That is a very tiring thing to do, especially if you just switched jobs.

Re: Pascal at Apple

#48
post #12
post #2

I really miss Pascal; it was a great and safe language for beginners. As it was extended with Objects and Modules, it was great for development. But there are good reasons it was surpassed by C. In early Pascal, you got a pointer by allocating memory; you could not get a pointer to an existing variable. You'd be surprised how often that gets in the way when implementing a data structure. Just try to implement the fol…

How does Pascal compare to python for absolute begginers?

Overall not well. It's statically typed, which can be helpful. And as mentioned, Pascal, was used widely in teaching so one would say well. However! So was Python, in it's ABC infancy.

Note that there are multiple Pascals, especially in the late 70s and 80s. Pure, true Pascal was annoying and restrictive [1].

No commercially successful Pascal was pure. The classic was Turbo Pascal which was disdained by purists but enormously successful. It's inventor went on to work on Delphi (a sort of Pascal which is still popular) C#, and Typescript.

https://en.wikipedia.org/wiki/Anders_Hejlsberg

1. e.g. semicolons were separators, not terminators. You'd get a syntax error if you had a semicolon after your last statement of a program/procedure.

Re: Pascal at Apple

#49
post #10

I joined Apple in 1987, about the time they started ditching Pascal in favor of C. C++ (in the form of CFront) was just starting to be a thing. Apple's Pascal had been extended to the point where there were few true differences between it and C, other than - strings with busted semantics (size being part of the type being a huge mistake, leading to a proliferation of types like Str255, Str32, Str31, Str64, etc). I sh…

I liked nested functions in Pascal, and put them in D. They turn out to be surprisingly useful: 1. Properly encapsulating their scope, as opposed to having static functions sit awkwardly somewhere else. 2. Factoring out common code within the function. 3. A lot of my need for goto statements vanished with nested functions. 4. Take the address of a nested function, and it serves as a lambda. 5. No need to create "Cont…

Good points, all.

I think I misliked Pascal's nested procedures because they weren't true lambdas; once the outer procedure returned, the inner procs were no longer callable (just one contiguous stack, right?). Early-on, using C++ lambdas, I found myself making the same mistake in a design for some asynchronous completion stuff. Embarrassing; C++ and Pascal are not JavaScript/Lisp/Scheme/Smalltalk :-)

Re: Pascal at Apple

#50
post #32
post #10

I joined Apple in 1987, about the time they started ditching Pascal in favor of C. C++ (in the form of CFront) was just starting to be a thing. Apple's Pascal had been extended to the point where there were few true differences between it and C, other than - strings with busted semantics (size being part of the type being a huge mistake, leading to a proliferation of types like Str255, Str32, Str31, Str64, etc). I sh…

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...

Oh lordy, I'd forgotten the array index thing. That was painful.
Post reply on HN