16 ms·
Things That Turbo Pascal is Smaller Than
- skeptical 15y agoNot a surprise to anyone familiar with pascal's grammer.
- baddox 15y agoA language's grammar wouldn't necessarily be a good indicator of implementation size, would it?
- groovy2shoes 15y agoNot necessarily. Some grammars can be parsed with simpler code than others, but optimizations can make a compiler larger. Also of note is that Turbo Pascal was written by hand in assembly language, and the executable wasn't likely to have been linked with any libraries.
- MatthewPhillips 15y agoInteresting, I didn't know this but Turbo Pascal was written by Anders Hejlsberg (of Delphi and C# fame).
- bhangi 15y agoIndeed TP did not have any linking step. I still recall trying to fruitlessly find "Link" on the menu for quite some time until it hit me -- oh, no linking needed. But TP did include a run-time with each of the generated executable. This run-time was part of the compiler and it was approximately 10K (from memory, so I could be wrong). That makes the compiler about 22Kbytes worth of code, which is even more impressive.
- groovy2shoes 15y agoI wasn't aware that the runtime was included in the executable. Oh, the things we did in the DOS days!
- barrkel 15y agoPascal's grammar is so simple by design that it can be parsed and codegenned in a single recursive descent pass. Not many languages are like that, especially these days.
- tluyben2 15y agoThere are a billion Lisp parsers in a few lines of Python, C, Lisp, etc. Any Pascal ones like that? Edit; not meant sarcastic, I would really like to see such a simple parser as was implied.
- colanderman 15y ago"parsed and codegenned" he said. Any Lisp compilers like that?
- groovy2shoes 15y agoI believe that's how the Clojurescript compiler currently works (though I haven't looked at the code in detail). Compilers that don't do it that way usually have optimizations going on in between the parse and codegen phases, not because it's impossible to do with Lisp syntax.
- fogus 15y agoClojureScript has a two-pass compiler; more if you consider GClosure a step.
- xyzzyz 15y ago"because it's impossible to do with Lisp syntax." The problem is not with Lisp syntax. The problem is with Lisp's semantics, which makes it much more difficult (if at all possible) to compile in one pass. Things like closures, conditions or macros are absent in Pascal.
- ajross 15y agoNo, but only by definition. Passing through an s-expression representation is a requirement for a lisp compiler, because the tree to be compiled might have been built at runtime. Certainly lisp's grammar is no more complicated than pascal's. Nor, frankly, is K&R C, which is is also a very simple representation. The ANSI process added some edge cases that complicated it, but really it's pretty simple.
- skeptical 15y agoYes it would. Not a bullet proof one (is there any?) but a good indicator.
- gecko 15y agoI cut my teeth with two programming languages, Smalltalk and Delphi (basically Turbo Pascal for Windows), and was actually just screwing around with Free Pascal (http://freepascal.org/ http://freepascal.org/) on a nostalgia kick. I ended up learning Delphi mostly by happenstance--I ended up getting gifted a free copy of Delphi 3, whereas VisualBasic and Visual C++ were comparatively expensive at the time--but I am incredibly, incredibly glad that I learned that first. Where C++'s grammar is convoluted, confusing, and contradictory, Turbo Pascal's and Delphi's manage to be very simple and straightforward with comparable power. I spent a lot less time coming to terms with syntax, and a lot more time familiarizing myself with machine code, calling conventions, and libraries. Having a straightforward grammar doesn't just help the compiler use less space. It helps your brain use less space on raw syntax.
- throwawayday 15y agoit also helps you logically deduce stuff you don't know. I remember that after a while, I could almost guess the names of functions that I didn't really know - that's what having a naming convention and regular syntax do for you
- Roboprog 15y agoYeah, I don't think that C++ killed Delphi. Java killed Delphi. Java may kinda look like C++, but Java 1.1 acted a lot like Borland Pascal plus a UCSD pcode-system. Nested blocks, strong typing, easy string manipulation, portable interpreter. And support for strings over 255 chars long, too! :-)
- ChuckMcM 15y agoTurbo Pascal totally rocked. I remember thinking "I can totally dump MASM and Visual C now!"
- pjmlp 15y agoReally?! Pity that Visual C did not exist at the time.
- yangyang 15y agoMaybe he meant QuickC (http://en.wikipedia.org/wiki/QuickC http://en.wikipedia.org/wiki/QuickC)
- ChuckMcM 15y agoWhat I meant was Microsoft's bloated and unwieldy C compiler, I don't recall if it had achieved the moniker 'visual' by DOS 4 or if that waited until Win95 release. It came in a green box on at least 4 floppies and was a PITA to use. Turbo Pascal, compared to that, made me wonder why Microsoft didn't adopt it as their 'main' implementation tool.
- DanBC 15y agoWikipedia has some rumour: >Bill Gates saw the success of Turbo Pascal "in very personal terms, and 'couldn't understand why [Microsoft's] stuff was so slow. He would bring in poor Greg Whitten [programming director of Microsoft languages] and yell at him for half an hour.' He couldn't understand why Kahn had been able to beat an established competitor like Microsoft." It's certainly possible that someone was using TurboPascal (discontinued mid 90s) at same time as VisualC or the early version of MS C.
- Roboprog 15y agoI seem to remember MS "Programmer's Workbench" for C/C++ 6 on DOS in the early 90s. It was a PITA, and I far and away preferred the Borland tool stack. The one thing the MS C compiler seemed good at was compiling gigantic "translitered" functions (generated by a code translator of the company where I was working at the time). Otherwise, meh. Turbo Pascal for Windows was simply awesome, (unfairly) compared to the C SDK for Windows 3.X, as well. The windowing library (objects), and the way it linked methods as event callbacks were much easier to read and write than hand-crufted event loops/switches in C. MS eventually made something comparable in C++, but I was long gone to *nix land by the time that mattered.
- Hitchhiker 15y agoAnybody here loved http://en.wikipedia.org/wiki/Turbo_Vision http://en.wikipedia.org/wiki/Turbo_Vision back in the day ? ;-)
- tluyben2 15y agoYes, I was. I still open it up to compile and play around with some old things I made.
- Hitchhiker 15y agoNostalgia :-)
- tluyben2 15y agoYeah! Slight small headache when I see my code from then. It's not great now, but luckily I progressed somewhat.
- cperciva 15y agoYep. I loved it so much that I wrote a really evil hack to use Turbo Vision in 640x480 graphics mode -- by hooking the vsync interrupt, comparing Turbo Vision's text-mode output to a shadow copy, and making the corresponding changes to the (graphical-mode) displayed output. Net result, Turbo Vision with an added GraphicObject. ... god that code was ugly.
- dugmartin 15y agoYes. I made very good money in grad school creating a stats package for the fourth edition of book from one of my professors using Turbo Vision.
- davepeck 15y ago...and the original VisiCalc executable [1], at 27520 bytes, is smaller than the _app icons_ in a modern iOS app bundle! VisiCalc was, essentially, _the_ killer app of the early PC era. The march of progress. ;-) [1] http://www.danbricklin.com/history/vcexecutable.htm http://www.danbricklin.com/history/vcexecutable.htm
- watmough 15y agoThe 60 Minutes interview passed over the Apple II very briefly, but it was tremendously significant, for being one of the first computers popularized with a killer app. Obviously, this wasn't the be-all and end-all, but VisiCalc did for sure sell many Apple II computers.
- SageRaven 15y agoMy first encounter with TP was as a high school senior in 89/90 in an AP programming course. What a blast. Anyway, for those who miss it, the binaries for Borland TP/TC were released some time ago. Probably linked off the Wikipedia page. The entire Borland Turbo series was cool. I had Turbo C, Pascal, and BASIC. Though Quick BASIC was the gold standard (and almost as fun), my heart will always have a soft spot for the original Borland DOS text-based IDEs. In terms of utility value per byte of executable, that was such an interesting time. There were so many cool boot sector viruses and utils during that era. Anyone else remember that full-featured DOS-based .COM text editor that fit in a single floppy disk sector (512B)? The original text-based DESQView? So many, many neat programs given the limited hardware.
- ja27 15y agoI'm trying to remember what all I used to run from a single 360k DOS floppy on a 640k 8088. I had at least DESQView, QEdit (which might be the editor you're thinking of), and a VT100 emulator.
- Luyt 15y agoI really liked Turbo C... It was so nicely integrated: the editor, compiler, linker, visual debugger and excellent help system. It also had a nice paned IDE which actually looked good and made it very usable on those old DOS systems. [I had been using Alcyon C on the Atari ST and Lattice C on PC before I discovered Turbo C]. I always have been (and still am) a fan of the Borland series of developer tools - still using C++Builder today and still liking it. http://en.wikipedia.org/wiki/Philippe_Kahn http://en.wikipedia.org/wiki/Philippe_Kahn "Philippe Kahn is a technology innovator and entrepreneur, who is credited with creating the first camera phone solution sharing pictures instantly on public networks. [...] Kahn has founded four successful technology companies: His current company, Fullpower Technologies, of which he is CEO, Starfish Software, LightSurf Technologies, Borland. Fullpower provides solutions converging life sciences, wireless technology, sensing such as accelerometrics, nanotechnology and MotionX solutions. MotionX is the core technology that powers the Jawbone UP Band and the Nike+ GPS solutions."
- davedx 15y agoYep, I learned C in Turbo C! It was so confusing, going from a BASIC interpreter to a compiled source language in an IDE. The good ol' days.
- phil 15y agoCool post, but I really like this paragraph from his "recovering programmer" page (linked in the sidebar): "Somewhere along the lines, I realized I was looking at everything backward, from an implementation point of view, not from the perspective of a finished application, not considering the user first. And I realized that the inherent bitterness and negativity of programming arguments and technical defensiveness on the web were making me bitter and negative. I've consciously tried to rewind, to go back to when programming was a tool for implementing my visions, not its own end."
- angrycoder 15y ago80% of what is on his blog is worth a read. The entries are terse, insightful, and nostalgic without being sappy.
- karterk 15y agoDang, I wish it had a RSS feed! I now have a bunch of really good plain HTML sites which I have to check manually for post updates.
- lordgilman 15y agoThere's an atom feed linked on the side. http://prog21.dadgum.com/atom.xml http://prog21.dadgum.com/atom.xml
- 1000110101 15y agomanually? so you're saying you're incapable or just too lazy to write your own "rss". the second s is for simple. you have all the tools you need in any base unix installation to automate this. it would take you minutes to do. perhaps this is precisely the point of the recovering programmer comment. there is a reluctance to doing anything for oneself. fear of implementing something for yourself, your own way, because someone else has implemented it their way, placed it in a repository and it's managed to gain a following of users. god bless the people who still enjoy diy and writing negative code.
- sebbi 15y agoGraphics were lightning fast on my first 1MB VGA card ... good old times
- rbanffy 15y agoI think the MS-DOS version is not smaller than the CP/M 80 version I learned Pascal with ;-)
- cleaver 15y agoI would be surprised if the CP/M version was any smaller. Turbo Pascal was smaller and faster than anything else at the time. However, the CP/M version would not have been a native compiler. Pascal generally compiled to p-code which was then interpreted (and was therefore slower).
- TheoLib 15y agoUCSD Pascal compiled to p-code. Other Pascals compiled to native code. The Wikipedia entry for Turbo Pascal indeed mentions that the TP-generated executables were extremely fast, which was a revelation to UCSD users.
- peteri 15y agoThe CP/M version was a native compiler. The real limitation with the Z80 version was that recursion required either a compile time switch or annotation on the functions (It's so long ago I can't remember) Somewhere I have a copy of just the editor portion of turbo pascal (from memory it's around 13K) that I snaffled when I worked for Borland in the mid 80s. Sadly no good anymore as 16 bit COM programs won't run on my 64 bit system.
- Tangaroa 15y agoLooking around my old DOS files, qbasic.exe is 254,799 bytes, plus a 133,810 help file. 400kb is larger than anything on that list, but we can think of lots of things larger than 400k. I don't seem to have Turbo C++ on my system any more, but it came on floppies and was probably no more than 15MB unpacked. The entire MS-DOS 5.0 distribution is around 2.2MB. Norton Utilities is 2,316,176 bytes. For a complex application that uses graphics and fonts, Print Shop is 2,716,489 bytes. The average Flash game is larger these days, although that is largely due to music and bitmaps. Individual files in my /usr/bin that are larger than all of MS-DOS or Norton include python2.7 (2,375,356) mono (2,637,288), gdb (3,888,248), doxygen (5,413,488), and smbclient (6,512,344), and these files are stripped. Linux kernel modules are still relatively small. Most are under 50k, although mac80211 is 257,001 and i915 is 451,033. The psmouse module is 73,312, almost twice the size of Turbo Pascal to drive my mouse. Most files in /bin are still small. Turbo Pascal is just barely larger than ed (38,464) and cat (38,484), and is smaller than touch (42,552) on my system as well. Turbo Pascal is also smaller than the gzipped man file for rsync (49,400), /etc/bash_completion (58,739), the Neko compiler (176,073) and DLL (94,203) for Windows, and GNU cmp for Windows (57,344).
- bryanlarsen 15y agoYes, most files in /bin are small, but that's because they're dynamically linked to libc, amongst others. I bet you virtually all of them would be larger than Turbo Pascal if statically linked.
- joezydeco 15y agoWe used to joke that a JPEG screenshot of an old Atari 2600 game was always larger than the object code that ran the actual game.
- ajross 15y agoLiterally true. The 2600 had no framebuffer, because there wasn't enough RAM to fit the displayed screen. Stuff was generated at runtime as the raster progressed down the screen.
- mmahemoff 15y agoLeads to an interesting compression algo.
- wlievens 15y agoSomewhat like http://en.wikipedia.org/wiki/Fractal_compression http://en.wikipedia.org/wiki/Fractal_compression
- hippich 15y agoCould someone explain why touch program is 47 Kbytes size? Just checked my Ubuntu machine to confirm this.
- mkopinsky 15y agoProbably because it's statically linked with some standard libraries. If you write a hello world app in C++ and compile/link with all the defaults, you'll see similar results.
- deleted 15y ago[deleted]
- beza1e1 15y agoIt is not. It even dynamically links to libpthread ...
- tedunangst 15y agoYou should use OpenBSD, then it's only 10k. As for why, objdump -s gives some hints. Lots of the file is really just zeros (you can see this with hexdump too), and the various sections of the file are padded for alignment.
- pdw 15y agoI think you can blame the GNU `--date` option. It supports many, many possible input formats (http://www.gnu.org/s/coreutils/manual/html_node/Date-input-formats.html http://www.gnu.org/s/coreutils/manual/html_node/Date-input-f...) and the implementation has to be quite complex.
- cleaver 15y agoTurbo Pascal wasn't my introduction to programming, but it was where I started to find my way. The edit, compile, test was factors of magnitude faster than any other compilers. Like the post says, it was very small, even for the time. The editor + compiler was smaller than most text editors and many non-programmers would use it as a word processor. At a time when a lot of systems only had 160KB floppy drives (and no hard-drive), the size made a difference. One great feature I remember was you could add inline assembler for things that needed to be faster (my IBM clone processor was only 4.77MHz). I spent hours shaving cycles off my Conway's Life program that was half Pascal and half assembler.
- deadcyclo 15y agoI have much the same history as you. Started out in basic, but turbo pascal was what really got me going. I must admit that sometimes I really miss those days. But then I remember the horrible feeling when the diskette and the backup diskette with my hard work died, and suddenly I don't miss it that much after all.
- kabdib 15y agoTP is about the same size as Leor Zolman's C compiler for the 8080. Fast-forward about seven years, and my company was looking at an interpreted BASIC implementation that took about 120K. Since this was supposed to live in ROM, you could think about it as Real Money. We dug into it and found all kinds of fat -- the usual 13 fear-based reimplementations of strlen and strcpy, about a zillion porting layers, endless amounts of cut-and-paste nonsense. Somewhere between 1978 and 1985, the software industry's drive to be lean and mean on PCs died. I found myself writing 'sed' scripts to do peephole optimization on the intermediate assembly language of one of the C compilers we were using. It was pathetic. Now, of course, I light my cigars with gigabytes. But in terms of actual cost, I'm still a cheap bastard and I probably don't spend any more money per year on CPUs, memory or storage than I did 30 years ago. Had a chance last year to write a mission-critical hunk of code that /had/ to fit into 1920 bytes. I can't tell you how much fun that was.
- hrabago 15y agoI learned programming with Turbo Pascal. I remember appreciating how it used a "Smart Linker" could produce really small executables because it stripped out any unreferenced code. I can't remember now how small the Hello World .exe files were, but they were small.
- marcins 15y agoI don't see why he compared Turbo Pascal to the Wikipedia page on C++ - Turbo Pascal is also much smaller than the Wikipedia page on Turbo Pascal :)
- miked 15y agoThat wasn't the only thing that was small about TP. The entire documentation for version 2 was a single book about 8 inches high, 5 1/2 inches wide and about an inch think. You could learn the entire language, IDE, library, and debugger in a weekend. Only six months before I met TP I had been using punch cards on the University's mainframe. TP2 was pure shock and awe.
- wanorris 15y agoA whole inch thick? The first edition of The C Programming Language couldn't have been half that!
- ramchip 15y agoAccording to the OP, "You could learn the entire language, IDE, library, and debugger in a weekend." This implies that the manual covers a lot more ground than The C Programming Language, which (AFAIK) doesn't say anything about Emacs, GDB, GCC, sockets...
- 89988989 15y agoDon't obsess over size guys, its how you use it is what matters at the end of the day.
- malbs 15y agoThe old computer joke... - Cheap - Fast - Good Choose any two With TP, you got all three!
- lloeki 15y ago$ file /usr/bin/touch /usr/bin/touch: Mach-O universal binary with 2 architectures /usr/bin/touch (for architecture x86_64): Mach-O 64-bit executable x86_64 /usr/bin/touch (for architecture i386): Mach-O executable i386 So actually touch on Lion is ~half of 44016. But that's being nitpicky ;)
- 4ad 15y agoYou are assuming i386 and amd64 have the same code density, which is not true, also you are neglecting the Mach-O headers and how sections are zero-padded for alignment.
- lloeki 15y agocp /usr/bin/touch ./; for arch in i386 x86_64; do lipo -thin $arch touch -o touch.$arch; done; ls -l touch* -r-xr-xr-x 1 lloeki staff 44016 31 Oct 11:37 touch -r-xr-xr-x 1 lloeki staff 19440 31 Oct 11:37 touch.i386 -r-xr-xr-x 1 lloeki staff 19440 31 Oct 11:37 touch.x86_64
- 4ad 15y agoThe object code is significantly less then the size of the binaries, Mach-O files (and ELF files and PE-COFF files) zero pad sections, allign them and generally have extraneous sections. The boxes are the same, the content is different.
- lloeki 15y ago> cat touch.x86_64 | perl -p -e 's/\0//' | wc -c 19407 > cat touch.i386 | perl -p -e 's/\0//' | wc -c 19408 > otool -tV touch.x86_64 | wc -l 742 > otool -tV touch.i386 | wc -l 808 Hmmm. So, now what? The article mentioned Lion's touch(1) size, and I wanted to point out that it actually covers two arches. We know there is padding, alignment, headers and density whatnot. The end result is that makes a negligible difference between the two arches, hence "~half".
- huhtenberg 15y agoWhile Turbo Pascal 3 was good, any true connoisseur would tell you that the pinnacle of Turbo Pascal evolution was the version 5.5 (with an exception of one annoying item in the editor †). † The Find box was overlapping the highlighted search item when latter happened to be in the top visible line.
- vl 15y ago5.5 was the best - yellow font on blue background will always bring fond memories, may be I should set Eclipse to that :) And then came 6.0 and Turbo Vision - out of a sudden it was so easy to write programs with windows. I still remember how I was reading printed out Turbo Vision manual.
- husted 15y agoAhh the warm feelings of memories. My first job involved Modula2 and the Brief editor. As I recalled Modula2 was supposed to be the successor of Pascal but I guess it never really took off. At least I've never met anyone who did any programming in Modula2. This reminds me of .kkrieger[1], a game made by German demo group. It's a 3D game where the executable at 96k is smaller than most readme.txt files for other games. If we cut down all the abstractions layers we're using every day we could create amazingly small program than ran at blistering pace. Of cause development time would explode :-) [1] http://en.wikipedia.org/wiki/.kkrieger http://en.wikipedia.org/wiki/.kkrieger
- cturner 15y agoDo older versions of turbo pascal have any edge over freepascal?
- RexRollman 15y agoI still think it is appalling that recent commercial operating systems take gigabytes of disk space to install.
- Tloewald 15y agoWhat truly appalls me is 900mb patches.
- untog 15y agoWhat truly appalls me is not using patches. Why do I have to download the entire firmware each time, Apple? Why? Why?!
- RexRollman 15y agoAre you talking about iOS updates? If so, I believe this has changed with iOS 5, at least with over the air self-updating.
- untog 15y agoThat's good to hear. I still had to download an 80MB iTunes update recently, but hopefully the update tech they're using will spread across the company.
- Tloewald 15y agoIt might be fun to compare think/lightspeed pascal/c since they included a full GUI IDE (and inline assembler) as well as full support for the Mac toolbox. (These products were to the Mac what borland's products were for DOS and Windows.) I know you could fit early versions of lightspeed pascal or c on a single floppy disk with a copy of System 3.2.
- FreshCode 15y agoComparing executable byte counts with source code or English character counts is ridiculous.
- sehugg 15y agoAlready posted, but relevant (and fairly technical) details about Turbo Pascal 3: http://pcengines.ch/tp3.htm http://pcengines.ch/tp3.htm
- georgieporgie 15y agoTurbo Pascal 6.0 was the pinnacle of IDEs. Or the pinnacle of my joy in programming, which, of course, is difficult to distinguish. :-) I spent hours upon hours poring over VGA graphics code in Pascal, then assembly (called by Pascal, since I wasn't sophisticated enough to understand how to build a stand-alone EXE from ASM) in high school. I would tweak things, then run against the slick built-in profiler, then refine some more. Some time later, I came across this vast information pipe called Usenet and found out that everything I worked on was years out of date, since ModeX provided dramatically faster access to video memory. Ignorance is bliss...
- bardamu 15y agoI'm surprised that nobody mentioned Wirth and Oberon yet. His '95 paper "A Plea for Lean Software" mentions Wirth's law: "Software is getting slower more rapidly than hardware becomes faster."
- icey 15y agoTurbo Pascal was my first programming language. I thought it was the coolest thing ever that I could write a game, put it on a floppy disk and share it with all my friends. I wish there was something like Github back then; I lost all my early source code years ago. It would be fun to see how terrible it looked :)