Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 11, NO. 5 / MAY 1985 / PAGE 46

Microsoft Basic 2.0 for the Mac. (evaluation) Glenn A. Hart.

A major obstacle to serious use of Apple's Macintosh computer has been the lack of adequate programming tools. While the "rest of us" for whom Apple tells us the machine is intended may not want to program the Mac, sophisticated Mac owners have been eager to experiment with the wonderful tools hidden inside the enigmatic little computer.

Programmers and systems houses wishing to develop software for the Mac have had to make expensive commitments to this process. The only way to produce Mac products has been to buy a Lisa computer, and costly software, and participate in the Apple development program. Apple has tantalized serious programmers with glimpses of exciting new Basic and Pascal systems, but has not yet released these products.

The only programming language available has been the Version 1 release of a Basic interpreter by Microsoft. Microsoft has written the de facto standard Basic for almost every available microcomputer, including the IBM PC, and Radio Shack, Commodore and other Apple computers, and their involvement with the Macintosh development process has been widely publicized. It was, therefore, reasonable to expect that their Mac Basic would be a worth product.

Unfortunately, Microsoft's initial Basic was met with more negative reactions than hosannahs. While the language made some use of the special aspects of the Mac user interface, especially a multiple window approach to program entry, editing and executive, it offered only teasing and limited access to the legendary ROM routines that are advertised to make programming the Macintosh a joy. Microsoft Mac Basic Version 1 was far from a bad implementation, but it seemed much too much like a quick rehash of the same Basic produced by Microsoft for a slew of other machines. Perhaps it was a case of too great expectations, but the first Microsoft Basic for the Mac simply fell short of what was both expected and hoped for.

Now, many months after the initial release, and with the supposedly innovative Apple Basic still not available, Microsoft has release Version 2.0 of their Mac Basic. While cut from the same cloth as the initial release, Version 2 has been very significantly enhanced. Access to the Mac ROM routines is tremendously improved and, equally important, the very nature of Basic has been extended in exciting new directions. In many ways, Microsoft's $160 Mac Basic is now among the most advanced Basic interpreters available on any microcomputer.

Mac Basic 2.0 uses multiple windows for program entry and execution. A small Command Window at the bottom of the screen is used to enter commands and immediate mode statements. Program output is displayed in an Output Window, and up to two List Windows can be activated to show program listings. The sizes of the windows, like all normal Mac windows, can be changed.

The Menu Bar choices are greatly expanded over Version 1. The File menu to open, close, save and otherwise manipulate files; Edit menu to cut, paste and copy in the normal Mac fashion; and Control Menu to run, stop, continue, suspend, and list programs and toggle Trace mode are retained from Version 1. But new options like single stepping through a program (executing one Basic statement at a time and halting between each) and printing a file in a special enhanced mode have been added.

Two new Menu choices are available. A comprehensive search/replaced mechanism allows finding and, optionally, replacing strings of text, including keywords. This can be a very significant productivity enhancement; some programmers have traditionally used word processors to prepare Microsoft Basic programs just to have searching provisions available. The othe rnew Menu option is Windows, which allows manipulation of the Command, List, and Output windows.

Two versions of the language are provided. One uses BCD (binary coded decimal) math, while the other uses the more common binary floating point math system. BCD offers complete accuracy without the rounding errors endemic to floating point binary math, and is thus much more suitable for business programs where a penny or two rounding error isn't acceptable. BCD math is much slower, however, and the accuracy of floating point is acceptable for many scientific used, so floating point math is the norm in engineering and like disciplines. The new Basic automatically discerns which interpreter to use when loading a previously saved program. Microsoft is to be commended for providing both alternatives.

The first sample program encountered in the documentation is a shocker--not because of what it does, but because it reveals that something different and new is at hand. The program doesn't have any line numbers, and there are alphanumeric line labels here and there. Microsoft Mac Basic 2.0 has finally done away with the slavish adherence to line numbering so scorned by users of other high level languages. The new version will accept programs with line numbers for compatibility, but it obviously prefers programs without them.

The language now useds the standard Geneva typeface rather than the horrible font used in the earlier release. To improve readability further, Basic keywords are now displayed in boldface to make them stand out from user variables and strings.

Programs are entered in a list window. The editor works very much like MacWrite, with all the normal mouse methods--cut, paste and copy, etc. Experienced Mac users will feel right at home and be able to enter and edit program text at high speed. Microsoft encourages line indentation to clarify program flow (a good practice with free-from languages like Pascal, C, and now, Mac Basic), and aids this method by having the editor retain any active indentation when RETURN is hit at the end of a line. Users of UCSD and Turbo Pascal will recognize what a convenience this can be.

Language Syntax

Mac Basic 2.0 is a direct descendant of the Microsoft Basics that have come before. The good points, like flexible string manipulation, as well as the bad aspects, like the convoluted random access disk file methodology, have been retained. Table 1 (page 48) details the changes from the earlier version.

There are obviously too many changes to discuss in detail, but a few broad trends can be discerned easily. Version 2 adds almost complete control of Macintosh interface features like pull-down menus, windows with size bars, use of the mouse, various buttons and dialog boxes, and field editing. About the only things missing are scroll bars on program-created windows. The various commands to control interface-type events are reasonably straightforward, and several excellent examples are provided in the manual and on disk in the form of sample programs.

Programming purists may think the most important aspect of the new language is the subprogram mechanism. Subprograms are not like subroutines; they are, rather, much more like procedures or functions in languages like Pascal and C. Parameters passed to the subprogram can be either reference or vale, and variables can be local or global. The subprogram scheme is far superior to multi-line functions and adds a new dimenson to the ability to produce and maintain structured code in Basic.

Other significant additions include manipulation of graphic images within Basic, improved control of the Mac sound generating hardware, and a function to convert strings to uppercase. There have, however, been some deletions as well. The language allows programs with line numbers, but the numbers aren't used as they are in other Basics. Line numbers are merely labels; adding a line with a line number does not insert the new line. Since line numbers are discouraged, the AUTO and RENUM commands have been eliminated. EDIT has been removed too, because the new method windowing eliminates the need for an explicit command to edit a line.

Performance

Using Version 2 is simple and straightforward. Microsoft has improved the program entry and editing process tremendously in terms of both ease of use and appearance. Making the Basic editor act like MacWrite makes the entire product much more intuitive and friendly.

Working without line numbers will seem strange to those whose only language is Basic, but it removes a major annoyance for Pascal and C programmers. Microsoft did not go quite all the way with the anti-line number movement, however. The error trapping and handling routines are still line number oriented. For example, ON ERROR ERL reports only line numbers, not labels. Another example of the halfway implementation is that no error trapping is possible in subprograms.

Putting this minor problem aside, the subprogram mechanism is a tremendous advance. Devoted fans of structured programming techniques now have a Basic with much improved control facilities. Perhaps Microsoft could have gone even further (REPEAT UNTIL clauses, for example), but Version 2 is a giant step in the right direction.

Performance was tested with the Creative Computing benchmark and the standard 10 iterations of the Byte Sieve of Eratosthenes test. Results are shown in Table 2.

None of these benchmarks is particularly fast. The tradeoff between the speed and accuracy of binary and BCD math is readily apparent in the simple Creative benchmark. The Sieve test useds integer math, which is obviously essentially the same in the various versions. Overall, the interpreter doesn't match a compiler, which is no surprise, but the Microsoft products perform reasonably well.

Documentation is generally rather good, as in most of Microsoft's Macintosh products. Since their manuals for products for other computers are generally mediocre to horrible, the Mac manuals are a real advance. However, there are some problems. A couple of the example programs don't run, and the are a few real clinker mistakes like reversing the order of a statement phrase. Where a statement serves dual purposes, an example is provided for only one usage. Many more examples could be provided for WINDOW, MOUSE, MENU, DIALOG, BUTTON, and the other new statements (see tutorial elsewhere in this issue), and there is practically no discussion of the characteristics of the Mac ROM routines and how to use them effectively.

Given how different Version 2 looks, compatibility with Version 1 is surprisingly good. Assuming that a Version 1 program is saved in straight ASCII text mode (not in compressed binary form), the chances are that it will run with few or no changes under Version 2. Of course, the reverse isn't true; use of any of the advanced features of Version 2 will restrict use to owners of the new release.

This bring up some partially realistic and partially philosophic questions. Microsoft Mac Basic provides excellent access to Macintosh capabilities which were not previously available to the average Mac owner, but what is the purpose? Is this mythical "average Mac owner" a programmer? If so, the new Basic is great, but what is the likelihood of commercial programs that would require the purchaser to have MS Basic 2.0 being distributed? There have been examples of decent software distributed in Basic source form (or in the low security "protected" mode), but what is really needed is a true compiler if MS Mac Basic is to become a true development language. With the new subprogrms and other advanced features, the language could actually be a viable choice for commercial program development--especially if the compiler offered the speed increases seen in Microsoft's other interpreter/compiler families. We can only hold our breath for the compiler version. In the meantime, Version 2 is a valuable addition to the Macintosh software arsenal.

Microsoft, 10700 Northrup Way, Bellevue, WA 98004, (206) 828-8080.

Products: Microsoft Mac Basic 2.0 (computer program language)