[HN Gopher] Things That Turbo Pascal Is Smaller Than (2011) ___________________________________________________________________ Things That Turbo Pascal Is Smaller Than (2011) Author : Tomte Score : 158 points Date : 2020-04-11 18:16 UTC (4 hours ago) (HTM) web link (prog21.dadgum.com) (TXT) w3m dump (prog21.dadgum.com) | hcarvalhoalves wrote: | I learned TP during college and thought programming | professionally would be simple like that... Ignorance is bliss | right? | [deleted] | throwaway_pdp09 wrote: | The BBC computers had a pascal compiler that was about 5K if I | remember. It lacked quite a lot though, like records I think, | enumerations & more, but had nestable procs/funcs so wasn't too | far off the language in other ways. Never used it BTW. | | One thing I liked about pascal but missed in every language since | is the ability to have arrays start from arbitrary values. It can | be fudged in C/C++ pretty easily but still, be nice to have it | built into languages like java/scala/so many more. | badsectoracula wrote: | Another nice feature is sets and ranges, so you can have | something like type Day = (Monday, Tuesday, | Wednesday, Thursday, Friday, Saturday, Sunday); | Days = set of Day; const Weekdays = [Monday..Friday]; | ... if Today in Weekdays then ... ... | | Sets are essentially bit flags but they look much better than a | series of #define MONDAY 0x0001 #define TUESDAY 0x0002 etc. | IMO, of course :-P. | [deleted] | wuwuno wrote: | Wrote a program to manage the sale and rental of video tapes for | an small business. I wrote it in 1984, using Turbo Pascal. The | last time I checked the store was still running the same software | in 2005. | | The application was table driven, all important configuration | items were stored in a text file as a key-value pair. It had a | bar-code scanner and was tied into a cash drawer. Receipts were | printed on small dot matrix printer. | | It took about 4 weeks to write. | | The best programming environment ever. | codr7 wrote: | I had so much fun with Turbo Pascal in the early 90's, I used it | to create everything from GUI frameworks to ANSI bulletin board | systems and keyloggers. Definitely the most creative environment | I've come across. | | Then came C++, and I wasted A LOT of time trying to wrap my head | around it while creating nothing of value before giving it up | entirely. | | My Pascal experience also landed me my first job after | university, which was to help write/maintain a system developed | in Delphi. | greenyoda wrote: | I've never used Turbo Pascal, but I've used UCSD Pascal, which | was also pretty small. In a college computer graphics course in | around 1980, we ran UCSD Pascal on Terak 8510/a machines, which | had a total of 28K 16-bit words (56K bytes) of RAM. | | The Terak was an interesting machine: | | > _The Terak 8510 /a of 1976 or 1977 was among the first desktop | personal computers with a bitmap graphics display. It was a | desktop workstation with an LSI-11 compatible processor, a | graphical framebuffer, and a text mode with downloadable fonts. | Despite the lack of a MMU, it was capable of running a stripped | version of UNIX version 6. It was the first personal machine on | which the UCSD p-System was widely used.[1] Various universities | in the USA used it in the late 1970s and early 1980s to teach | Pascal programming. It provided immediate graphic feedback from | simple programs encouraging students to learn._[1] | | Also, in those days, we were running Version 7 Unix on a PDP | 11/45, which supported several concurrent users in what would now | be an unimaginably tiny 256K of RAM. | | [1] https://en.wikipedia.org/wiki/Terak_8510/a | 0xcde4c3db wrote: | > And the whole thing was lightning fast, orders of magnitude | faster at building projects than Microsoft's compilers. | | This particular comparison is interesting when you consider that | the primary author of Turbo Pascal, Anders Hejlsberg, has been at | Microsoft working on C# and TypeScript for quite a while. | oaiey wrote: | Anders (and Typescript and C# and TurboPascal) is always about | productivity. Compile time is only a small part of that. | userbinator wrote: | It's even more interesting when you consider that it ran under | MS-DOS, which had no dynamic linking --- it's a statically linked | binary. | | _The touch command under OS X Lion (44,016 bytes)._ | | ...and I bet that one is dynamically linked. | | I believe the reason why it's so fast is because it has no | optimiser, and generates code as it parses. Pascal is also one of | the easier languages to compile. | ken wrote: | Here is touch.c [1] from macOS. The only change since Lion is | the addition of the __used attribute on a couple of consts at | the beginning. It's very similar to the FreeBSD one, though | they've diverged slightly in the past 2 decades. | | It supports 8 different flags (plus an undocumented -? flag), | with support for using absolute or relative times, setting | various timestamps on a file, and options for dealing with | symlinks and permissions and such. More features than I'll ever | need, but not outrageously so. | | On Mojave, this file is only 23392 bytes, so it's no longer | bigger than Turbo Pascal. Plus, automatic filesystem | compression shrinks this down to only 7340 bytes on disk. Since | blocks are 4096 bytes, this is actually the second-smallest | (non-empty) file! | | [1]: | https://opensource.apple.com/source/file_cmds/file_cmds-287.... | zozbot234 wrote: | Turbo Pascal programs relied on separate on-disk .BGI files | that contained object code and effectively implemented a kind | of dynamic linking (albeit in a single-task context). It was | possible to directly link them into the final executable, but | this wasn't the default. | pcardoso wrote: | Perhaps they were .TPUs instead of BGI? BGIs were the graphic | drivers IIRC. | dragonwriter wrote: | TPUs are closer than BGIs, but still aren't dynamically | linked. They are object files which are statically linked | into the final exe. | | It's possible that the author is thinking of pre-TP4.0 | chain files (which were used to get around the 64K memory | limit of .COM format before TP switched to generating | EXEs.) | FpUser wrote: | It did have overlays that were relatives of dll | api wrote: | What is all the weight in that "touch" binary? It can't be | code. My guess would be that the format is just not optimized | for size and contains a bunch of boilerplate records whose | minimum size is in the kilobytes. | haberman wrote: | I just ran Bloaty (https://github.com/google/bloaty) on | /usr/bin/touch from Catalina, and I got this: | $ bloaty `which touch` -d segments,sections --domain=file | FILE SIZE --------------- 55.1% 19.6Ki | __LINKEDIT 91.7% 18.0Ki Code Signature | 2.7% 544 Symbol Table 1.9% 376 Lazy | Binding Info 1.6% 328 String Table | 1.2% 232 Indirect Symbol Table 0.6% | 112 Binding Info 0.2% 32 Export Info | 0.1% 24 Function Start Addresses 0.0% | 8 Rebase Info 0.0% 8 Table of Non- | instructions 0.0% 0 [__LINKEDIT] | 22.2% 7.90Ki __TEXT 35.0% 2.77Ki | __TEXT,__text 33.6% 2.65Ki [__TEXT] | 17.2% 1.36Ki [Mach-O Headers] 4.2% 339 | __TEXT,__cstring 3.4% 274 __TEXT,__const | 3.3% 266 __TEXT,__stub_helper 1.9% 150 | __TEXT,__stubs 1.5% 120 | __TEXT,__unwind_info 11.2% 4.00Ki __DATA | 94.9% 3.80Ki [__DATA] 4.9% 200 | __DATA,__la_symbol_ptr 0.2% 8 | __DATA,__data 11.2% 4.00Ki __DATA_CONST | 98.4% 3.94Ki [__DATA_CONST] 1.6% 64 | __DATA_CONST,__got 0.3% 104 [Mach-O Headers] | 100.0% 35.6Ki TOTAL | | So 2.77Ki of actual code in "__TEXT,__text". | | Those [__TEXT], [__DATA], and [__DATA_CONST] sections are the | part that is lost to padding, so 10.4Ki or so. | | Disclosure: I am the author of Bloaty. | tomaszs wrote: | I have written a 3D engine in Turbo Pascal. There was a castle | you was able to walk through. It was fascinating because all | calculation has to be done manually including figuring all the | math to figure out where to plot a 3D point on a screen. Great | times. Later i have moved to Visual Basic and OpenGL. Nice | memories from primary school | smitty1e wrote: | Ah, Visceral BaySuck. I've been in places where all one had was | MSOffice, and that VBA IDE was it. | | I keep a private github repo called NVBC (NecroVisualBasiCon) | with snippets of the all the madness that was trying to trick | VBA into being a useful tool. The IDE was good, but the | language itself was surgically precise in delivering 83% of | what one wanted for a given task. | tomaszs wrote: | It was caused mostly by the way MSOffice access was delivered | to VBA at that time. And maybe also by VBA itself. Cannot | remember. Anywho. VB standalone was pretty decent. Nice you | have the library. Its part of the history | pkaye wrote: | I'd like to see a performance comparison between Turbo Pascal and | TCC (tinycc) which is about 100k is size. | icedchai wrote: | I used Turbo Pascal back in high school (1992-93, AP computer | science.) By that point, I already knew C and it felt like a step | backwards in some respects. Still, the IDE was impressive and it | was a lot of fun! | fortran77 wrote: | While today's code does a lot more, and has to deal with | everything from internationalization to accessibility, I have to | believe that we (I was around programming in those days!) were | better at computer programming back when computers had memory | measured in kilobytes than we are today. | | I still take on jobs to do embedded programming in assembly | language on PIC or similar processors and my clients are usually | amazed at what can be done in tiny amounts of code. | tomaszs wrote: | Limited resources are what drives creativity and art. I also | think understanding of programming is better of persons who had | this background | dylan604 wrote: | Severe limits/restrictions can influence some amazing | solutions. To me, this separates the real programmers from the | people that just get paid to bang out code. We went to the moon | and back on this kind of severe limitations, yet today, we | can't make a website without a library requiring 100s to 1000s | of dependencies resulting in a total download larger than the | amount of data required by the entire moon missions. That's | just for one page of useless internet. I just shake my head at | the silliness. | philistine wrote: | Not that I disagree with your point, but the computers used | for the Apollo program needed a healthy amount of printed | manuals and ground-based support to be functional. They were | only a part of the computational stack required for Apollo. | not_kurt_godel wrote: | > We went to the moon and back on this kind of severe | limitations | | Adjusting for inflation, NASA spent $283 billion going to the | moon[0]. I can't be bothered to find a breakdown of how much | of that budget could be directly tied to writing code, but I | suspect that the investment was a wee bit higher than a rando | frontend dev slapping together some libraries in 2020. | | [0] https://www.planetary.org/get-involved/be-a-space- | advocate/b... | throwanem wrote: | Real programmers don't use Pascal. | https://web.mit.edu/humor/Computers/real.programmers | analog31 wrote: | I think part of the fun in the "old days" was that you could | familiarize yourself with your tool chain in its entirety. I | mean, I knew every command in Turbo Pascal, and virtually every | feature of the "operating system" such as it was. Even finding | out information about algorithms was hard before the Internet, | so I had to wring my own. | | The microprocessor wasn't radically different from the 4 bit | computer that I built on breadboards for my college electronics | class, and I could tell you pretty much all of the things it | could do. | | Then the only limitation was you and your own wits. | | Today, not only is there a language to learn, but libraries, | and a framework, and an architecture, and a "stack" and | revision control system... you can't ever master the whole | thing and it's changing faster than the baud rate of my | eyeballs. It's still a boatload of fun, but a new kind of fun, | and sometimes I like going back to the old kind. | bdcravens wrote: | My first "professional" language was ColdFusion. I literally | took the manual that came with the install disks home and | learned it all in about a week. (1999) | oaiey wrote: | We work on the shoulders of Giants nowadays. | jonsen wrote: | Yeah, it's a giant mess. | smitty1e wrote: | Yes, but did they have smart phones in that Eden? | basementcat wrote: | The phones made cool sounding tones when you pushed the | buttons. | analog31 wrote: | They had buttons. | geophile wrote: | Turbo Pascal was an IDE and a blazingly fast compiler. In 1986, I | ran it on my 64k IBM PC (8088 4MHz). It was like nothing else I | had experienced previously. Prior to that, I had developed | software in grad school on punch cards. I occasionally had access | to a PDP-11. I don't remember what editor I used, but it | certainly wasn't an IDE. It may have been line-oriented. At work, | we had a VMS system, and I had access to a C compiler and my | first emacs. Not too bad, but nothing as immediate and responsive | as Turbo Pascal. | | Viewed another way, Turbo Pascal recaptured the incredibly rapid | edit/run cycle that I first experienced with a PDP-8M running | BASIC. Only now, I had 64k instead of my shared of 12k shared | among a maximum of four users, an IDE instead of a line editor, | and a far better language. | | Turbo Pascal also blew away anything else available on the PC. I | had a C compiler from Microsoft that was far more expensive and | far slower. | | Turbo Pascal was a truly magical piece of software. I remember | that I had some initial skepticism about it. As I recall, it took | some liberties with the language. But once I finally used it, I | was instantly converted. | | IMHO, nothing has quite captured that experience of development | until IntelliJ, starting with 4.x or 5.x. | petilon wrote: | > _Turbo Pascal was an IDE_ | | Pretty sure it was the world's _first_ IDE, not just _an_ IDE. | In a single .exe file it had a WordStar compatible text editor, | compiler, linker and libraries. | badsectoracula wrote: | AFAIK the first "IDE" was the one in the original BASIC, or | at least the first one to called that. It was command-line | based (no fancy GUIs back then) but it allowed editing, | debugging and compiling (despite BASIC dialects being | commonly interpreted, the original BASIC was a compiler) from | the same environment. | pjc50 wrote: | Possibly the environment described in | https://en.wikipedia.org/wiki/The_Mother_of_All_Demos might | be the first. | dragonwriter wrote: | > Pretty sure it was the world's first IDE, not just an IDE. | | That probably depends on whether you count live-coding | environments like Smalltalk had as "IDEs" | petilon wrote: | Hmm... you may be right. Here's the Smalltalk environment | from 1980, it is pretty impressive: | https://www.youtube.com/watch?v=JLPiMl8XUKU | pjmlp wrote: | Not only Smalltalk, check Interlisp-D, Mesa XDE and | Mesa/Cedar. | | Xerox PARC workstations were the first IDEs, alongside | Lisp Machines from Genera and TI. | corysama wrote: | The same author has a separate article on some features of | Turbo Pascal that made it so fast. | | https://prog21.dadgum.com/47.html | fortran77 wrote: | The least the IBM PC every shipped with was 128kB; that was the | smallest option IBM had shown in their catalog. That was for | the cassette version. | | Are you sure you didn't have 640kB? | dangoor wrote: | Wikipedia says that the first IBM PC debuted in 1981 with 16k | of RAM. https://en.wikipedia.org/wiki/IBM_Personal_Computer | jecel wrote: | I doubt anybody ever bought a 16KB tape-only IBM 5150 to | hook up to their TV, but it was indeed the entry level | configuration. It probably just existed to make the | machine's price look good - even today all articles quote | that configuration's price of US$1,565 (equivalent to | $4,401 in 2019) instead of the $3K or more a practical PC | would cost. | | The PC could only be expanded to 64KB on the motherboard. | Anything beyond that required expansion cards, each adding | at most 64KB initially (which opened the door for larger | third party upgrades from AST and others). With only six | slots and separate cards for the floppy disk controller, | video, serial and parallel ports the largest practical | configuration was initially only 192KB. Not that the | software could take advantage of all that (in the case of | .com stuff quickly ported from CP/M, things improved with | .exe). | | When most people try to remember the original IBM PC they | normally think of the 1983 PC XT (IBM 5160) instead which | had more slots and more memory. | | Around 1989 I was asked to fix a Basic program that tested | car shock absorbers. It took me less time to write a new | version in Turbo Pascal than it would have taken for me to | completely read the source of the original program. The IDE | made a huge difference but the speed was also important | since it allowed me to modify and try several times per | minute. | pinewurst wrote: | I bought one of those - added the other 48k + a 192k | multifunction card - way cheaper. Even sold it on at a | profit a year or so later. | analognoise wrote: | Lazarus/FreePascal? | | There's a dedicated group of troopers who have kept the flame | alive. It's cross platform. There's an Android port in | progress. There's a JavaScript backend. The IDE is like all the | good things about Delphi 7, none of the drawbacks. | themodelplumber wrote: | Yes! I use it and really enjoy it so far. There are obviously | some people using it for _very_ advanced work in medicine and | the sciences, to see some of the community posts and shared | libraries... Personally I think I'm building yet another text | editor (starting with a text viewer) but the experience has | been great. | | The community is really a nice bonus, too. | unnouinceput wrote: | I don't. Whoever thought recompiling Lazarus whenever you | need to simply add another component to its pallet really | lost the spirit of Pascal/Delphi on that one. | themodelplumber wrote: | Interesting. I haven't needed to do so, but I thought I | had heard that was a pretty quick recompile, on the order | of < 10 seconds? I know there are some tips to speed it | up. | | Here's the wiki page on component authoring: | | https://wiki.freepascal.org/How_To_Write_Lazarus_Componen | t | brnt wrote: | Where does that community hang out? I find it very | difficult to find Pascal projects on Github for instance. | FpUser wrote: | All you have to do is enter delphi in search box of | github and you get whole pile of projects. Alternatively | you can enter pascal instead of delphi. this agail will | get you pile of projects albeit smaller. If that is | difficult I am not sure what easy is. | themodelplumber wrote: | Last week I saw that kind of content on freshcode.club as | well as at least one of the Facebook groups. | EdgarVerona wrote: | I really enjoyed Turbo Pascal - the IDE, the included | libraries, the Pascal language itself. It really felt like the | python of its time. | wslh wrote: | Better than Python because it included an IDE and debugger | while Python official installation included IDLE... | AceJohnny2 wrote: | Counterpoint: what are some things that Turbo Pascal lacked that | we take for granted in a modern language environment? | mhd wrote: | What version of TP? The linked articles is about TP3, which | lacks common prog lang features that later versions definitely | had (like proper modules or objects). | | If you take a look at later versions or even early Delphi, I'd | say garbage collection. Other languages from the Wirthian | family had it, like Modula-2/3 or Oberon. | | Lambdas/first class functions. | | Unicode support. | | Syntactic sugar up the wazoo. | | Other than that, I think one could be very productive in a TP | 5.5-ish language even today. The rest would be mostly about the | infrastructure and community, like IDEs, package management and | Medium posts with lots of memes. | pjc50 wrote: | No intellisense or similar. No extensibility or scripting. | 80x25 text mode. | zozbot234 wrote: | VGA-class cards could display a 80x50 text mode. Not sure | that it was easily accessible in MS-DOS without assembly | hacks, but it could be configured from within Windows. | dragonwriter wrote: | > VGA-class cards could display a 80x50 text mode. Not sure | that it was easily accessible in MS-DOS without assembly | hacks. | | It was directly accessible from the DOS prompt with the | MODE command. | | Don't remember if TP had a library function that exposed | it. | ghaff wrote: | Yeah, there were some hacky things you could do, e.g. using | software from Quarterdeck? Don't remember. I'd have to go | back and look at docs I wrote from a program I wrote t the | time. I seem to remember supporting some alternative screen | resolutions in a an MS-DOS directory manager I sold. | Andrew_nenakhov wrote: | I have always used this mode when running TP, without any | difficulties. I think it was enabled by a simple key when | launching .exe, but I don't remember exactly, which means | it was something simple and inconsequential. | [deleted] | jandrese wrote: | Internationalization. Turbo Pascal was stuck with CP437 IIRC. | dmitriid wrote: | IDEs: | | - Intellisense | | - project-wide refactoring | | - lookup into external code (IntelliJ idea can even decompile | .jars) | | - multi-language projects | | - debugging (including stepping into external and decompiled | libs) with watch values of nearly unlimited complexity | | Language: | | - lambdas/anonymous functions | | - type inference | | - extension methods | StreamBright wrote: | I would say having an installer that depends on 3 other | languages, using a particular libc without the ability to | switch it up, unable to cross-compile to other platforms. | esnible3 wrote: | Turbo Pascal is 3.7x smaller than the Wikipedia page describing | it. Wikipedia's prose description of Turbo Pascal is 148k. | zengargoyle wrote: | Oh wow, I think I learned Pascal via Turbo Pascal. When I was 14 | in 1984 I went to a Computer Camp at Virginia Tech and we used | Pascal in this monolithic IDE sort of thing. Maybe it was | actually UCSD Pascal.... We made a simple 16 room 4x4 dungeon | with keys and doors. Each group writing the code for one room and | them tying them all together. It came out not bad for a bunch of | kids. | | When I got my Amiga a year later I was happy that there was a | Pascal compiler, then saddened that it only had stdio sort of | interface. No way to open windows and draw things or the like. | Luckily I found a FORTH that not only had a 68k assembler but | also all of the constants and things you needed to write graphics | and the bonus of making that single executable file. | | Sorta sad I never really got to use Pascal after that. By | university time it was all Assembly, FORTRAN and C for the CS | classes. | sbussard wrote: | node_modules | bdcravens wrote: | Turbo Pascal is a language I've never used professionally but | always has a special place in my heart. I grew up poor without | any kind of a computer but always considered computers "fun". As | a high school senior (1995) I took what I thought was just | another computer class; they were teaching Turbo Pascal, and I | immediately knew I discovered my life's passion. | dakna wrote: | I still have 2 post-it notes on my second monitor from when I | decided to finally deep dive into the Android Framework. | | One says "1988 Pascal", the other one "2018 Kotlin". I wrote | those after noticing how similar the syntax is for variable | declaration and it felt like going back to my roots. | | The sheer joy of knowing your IDE, the language and the target | platform all in one interface reminds me a lot of the days | staring at the blue screen of Borland Turbo Pascal in the early | 90s. I really missed it in all those years of web development I | did afterwards. | jasonv wrote: | I remember coding in Turbo Pascal to hack on PCBoard and its | fork, WWIV, which were BBS programs. ___________________________________________________________________ (page generated 2020-04-11 23:00 UTC)