Classic Computer Magazine Archive COMPUTE! ISSUE 130 / JUNE 1991 / PAGE 84

Turbo Pascal 6.0. (software upgrade) (evaluation)
by Tom Campbell

Some upgrade decisions are hard to make. I've been a staunch supporter of Microsoft Word for years now, but the change from 5.0 to 5.5 was too little too late. I had better things to do with $75. And Microsoft C version 6.0 was such an obvious hiccup that some users actually made noises in public about getting their money back (on CompuServe's MSSYS forum).

Bit if you're a Turbo Pascal user and you've considered switching to 6.0, worry no longer. It's a shoo-in. And if you've new to systems programming on the PC and are considering versions of Pascal for your next project, look no further. Turbo Pascal version 6.0 is, simply put, a masterpiece. There's a whole new integrated development environment (IDE, in Borlandese); mouse support; totally revised help; additional debugger features; a massive, tightly integrated library of user interface routines called Turbo Vision; and numerous smaller enhancements. In fact, some of the demo code for Turbo Vision is good enough for commercial applications.

The Mouse That Soared

While the most important new features of version 6.0 are Turbo Vision and better data hiding, the most obvious change is its new user interface. If you're a Turbo C ++ owner, you'll be used to the changes. Otherwise, you're in for a big surprise.

First of all, it mouses. A Microsoft-compatible mouse will work exactly as you expect a mouse to work. A click of the left button selects menu items or buttons, a drag selects text, and dialog boxes now contain multiple fields that you can jump to quite easily with the mouse.

I love it, since I'm a mouse user. I have no idea how many people will disagree with me, but I feel the new user interface is much less efficient than previous ones for users not equipped with a mouse.

While earlier versions of the Borland IDE employed submenus instead of dialog boxes and allowed every item on the submenu to be selected by pressing the firt letter of the menu item, the new IDE leans toward multifield dialogs that force the mouseless user to jump among the fields by pressing the Tab and arrow keys. This means that some commands that once required only a single keystroke now require several. Since I like to use the mouse, this didn't pose a big problem with me, but I still appreciate a good, fast keyboard interface as much as the next person. Turbo's previous IDE was great that way.

IDEs of March

The second big change in the new IDE is multiple windows with large file capacity. They have scroll bars, zoom buttons, and close buttons, so using the mouse with the new edit windows is a breeze. And when you press F3 to open a file, the current file is no longer unloaded. The editor simply creates a new window, overlapping it on the previous one.

You can open as many windows as you like, but the first nine are instantly available via Alt and the window's number, from 1 through 9 (just like Microsoft's QuickPascal). Alt-0 brings up a list of active windows, including edit windows, help windows, register windows, and so on. While some people never get the hang of using several windows at once, I find it a lifesaver and demand it of any text editor or word processor I use.

Normally, I have about four windows open: the current source file, a text file explaining the source file, an ideas list, and another file or two related to the source (for example, other units). And you can now edit files up to a megabyte in size. Of course, you program using modern structuring and never use files that large, knowing that a well-designed software project is spread over many small, easily understood modules! Nonetheless, this large file size is handy for reviewing other people's code or large documentation files.

If you pay close attention to the windowing system, you'll begin to notice that all windows, not just edit windows, are used to their fullest potential. For example, you can use the Copy Example command from the Edit menu while perusing a help screen to place it in a temporary storage area called the Clipboard, then paste that code right into an edit window.

You can also select just part of any help window using the same selection techniques you use in an edit window. If you pop up a debug or help window, it becomes accessible through the Alt-number trick, and so on.

You now customize the integrated environment throuth TEML (Turbo Editor Macro Language), not the venerable TINST.EXE (TINST is now gone). TEML is a macro language with an external compiler. Unlike many high-level programmer's editors such as Brief or EMACS, there's no internal language interpreter. Instead, you add extensions via a separately compiled macro language. While this means that you have to learn a new (but simple) language and compiler to customize your environment, TEML gives you access to everything the integrated environment can do--far more than simply assigning actions to keystrokes. You can trigger any menu item, read from the Clipboard, quit the compiler, mark text, and dozens of other commands.

The vast number of new functions means that performance of the IDE is slightly less spectacular than it used to be, since there's fair amount of disk swapping going on. However, the swapping is so well tuned that I never found it to be a problem on my 12-MHz AT; in fact, it's barely noticeable. My 386 is slightly faster, but the swap algorithms are so good the difference isn't pronounced. To put it another way, performance has dropped from great to very good.

This is Demo Code?

Borland has taken the concept of demo code to new heights by providing some outrageously good examples--easily good enough to be from its own library. My favorites are probably the EDITORS unit and the HELPFILE unit.

EDITORS has everything you need to add text editors to your own applications, the main limitations being that file sizes are limited to 64K, maximum file size must be determined when the editor is initialized, and there's no word-wrap.

On the plus side, EDITORS can save and load files, has full cursor motion, does search and replace operations, and dynamically resizes the edit window. It mouses, too. The command processor is separate from the user interface, so you can give your editor the modest look of a WordStar-type screen or a flashier Windows look. Or both at once.

One demo program called TV-EDIT sports multiple resizable windows, a pull-down menu interface, and shelling to DOS. If you've ever tried to write an eidtor--to say nothing of a mouse-driven editor with a separate command processor and multiple windows--you'll recognize that this can save months of work.


Now that you have a free text editor for your own projects, what can you do to document all those snazzy new features for the user? Well, you can use the help system written in Turbo Vision--that's what. The HELPFILE unit is a badly documented but priceless 800 lines of code that gives you everything you need to add hypertext help to your applications.

Just write the help material in any text editor, add a few dot commands, and presto--help just like the pros. You can show related topics in another color and jump to highlighted topics by clicking with the mouse or pressing Enter (or choosing some other command and implementing it yourself, since the source to the help system comes with Turbo Pascal).

Here's the Beef

All this is very nice, says the hard-core programmer in you, but what about enhancement to the language? Where's the beef? In Turbo Vision, for one place. Turbo Vision, to put it simply, is an object-oriented user interface library with mouse support, easy creation of windows and dialog boxes, menus, scroll bars, check and radio buttons, and an event-driven programming paradigm.

The good news is that Turbo Vision is a brilliantly conceived and designed, completely debugged toolkit that comes with a 400-page manual and could easily be a separate commercial product. The bad news is that if you haven't learned objects yet, you must learn them to use Turbo Vision. And the implications of an event-driven environment--that the user has full control over all actions, that any action should be revocable, that the user interface of your program should look very similar to the user interfaces of other programs using Turbo Vision--mean that you may well have to change your way of thinking and programming.

Chances are good that you won't be able simply to plug your old applications into this new framework. If you've programmed Mac or Windows. Turbo Vision will be a cake-walk. Otherwise, plan on spending at least a few weeks becoming familiar with a lot of new concepts.

Another gigantic addition is the inline assembler. A complete symbolic assembler with simplified segment directives lets you write assembly code without ever leaving the Turbo Pascal environment. The inline assembler itself is reasonably well documented, but look elsewhere for tutorials or even a reference for PC assembly language. Still, it competes quite effectively with Microsoft's QuickC with QuickAssembler.

The awkward {$F} directive for forcing near or far calls can now be overriden with the more conventional near and far directives, new keywords that act just like their counterparts in C. This lets you alter the standard subroutine calling convention Turbo provides so that you can speed up your code or use Turbo to call code written in other languages (such as the inline assembler).

I have always appreciated Borland's documentation for its unique respect for the user. Some amazing nuggets can be found in the supplementary documentation on disk, and it's the kind of information that you'll realize you need only when you're deep into a project and need nuts-and-bolts advie from someone who's been there.

For example, one of the DOC files for Turbo Vision explains such eminently useful issues as which parts of it can be overlaid (everything except for one small unit that manipulates interrupts), how much EMS can speed things up, how to set up the overlay pool, and how Turbo Vision objects are inherited (so you can best override them when writing new objects). Borland's documentation abounds with details like that, and, while they may seem extraneous, they can mean the difference between making or breaking a deadline.

Is it Worth the Upgrade Price?

The bottom line is always this: Does the new product offer you enough new features to merit its upgrade price? In the case of the new Turbo Pascal, the answer is an unequivocal Yes. Reviewers almost always get their software free, so you should always factor that into your evaluation of their work. But I paid for my upgrade and didn't even think twice about it.

I would cheerfully have paid just for the new development environment and Turbo Vision. But it also came with better object orientation through encapsulation, better code generation, the inline assembler, a gigantic new help system for the compiler itself, help code for your own applications, a new heap manager, the OBJECTS unit, and even more goodies that I haven't mentioned yet.

If you're shopping around for a Pascal, shop no more. QuickPascal is a dynamite product and less expensive, but it doesn't hold a candle to Turbo 6.0. Microsoft Pascal is a fine ISO standard Pascal and your only choice if portability to mainframes and use of older, pre-Turbo code is paramount. But if you want to develop state-of-the-art Pascal development tools, look no further.