Article appearing in March, 1993 issue of Basic Code Cache (formerly QB News) Product Name: PowerBASIC 3 Available from: PowerBASIC Inc. 316 Mid Valley Center Carmel, CA 93923 (408) 659-8000 Price: $149.00 + Shipping Available: Immediately (shipping now). PowerBASIC represents a clearly-defined and demonstrably better alternative in the BASIC compiler market. It concedes nothing to other compilers, and extends the range of BASIC in ways that any other compiler vendors might envy. The envy ought to extend to the former leader, Microsoft. That largest of all software businesses started as a vendor of BASIC, and for years has prided itself on having the best BASIC available. For all those years, that pride has been justified, but no more; the new king is a product called PowerBASIC. To see why this is so, we need to ask just two questions: What do BASIC programmers want? What makes PowerBASIC so good? The answer to both questions is the same: power. Microsoft BASIC has five numeric data types: integer, long integer, currency, and single and double precision floating-point. PowerBASIC adds single byte integer, unsigned word and long integer, 8-byte (quad-word) integer, BCD fixed and BCD floating-point (instead of just one currency type), and extended-precision real (80-bit real). While BASIC isn't made good or bad solely because of the number of numeric data types supported, more types are a definite help -- and these types have been on most BASIC programmers' wish lists for years. Further, the BCD types in PowerBASIC are not limited to a single number of decimal places; the programmer can specify (at run-time) how many places are desired. Rather than be limited to four decimal places for all calculations (as with the currency data type), PowerBASIC allows you to set BCD to two decimal places for exact (to the penny) calculations with no need for rounding, or to any number of places from zero to eighteen for any particular need. The result is decreased overhead in each program (no need for rounding), and increased flexibility. PowerBASIC also implements BCD as scaled integers, rather than the two-digits-per-byte "natural" method. By using scaled integers, PowerBASIC's approach gives increased speed -- ordinary BCD math has a deserved reputation for sluggishness. PowerBASIC also supports flex strings -- strings with a fixed length, except that the length can be changed under program control -- and fundamental changes in the way programs can be created. Consider the usual way any program is created. There are several steps; design, code, test, debug, and retest. In practice, the debug and retest steps are repeated indefinitely. No one seems to want to mention the reason for the extended debugging and testing phases, perhaps because the reason is so fundamental: the number of expressions and branches in the code. In other words, code complexity leads directly to coding errors. From that standpoint, it is clear that the fewer expressions and the fewer branches, the more likely a program will work correctly the first time, and the easier it will be to enhance. This is the big reason for the popularity of toolkits, modular programming, and object orientation. Sure, there are other reasons for each of those things, but reduced complexity is the biggest and certainly easy to defend. So, how does this apply to PowerBASIC? Simple: PowerBASIC adds functions that would ordinarily be found in a toolkit or written as needed. PowerBASIC adds types to make it easier and more natural to express more programming requirements in fewer statements, fewer lines, and fewer branches. The more power in the language, the better for the programmer -- and the person using the applications. Reliability helps everyone! Some specific examples are in order. Let's start with some of the array commands and functions. The Array Sort command allows the programmer to sort any type of array in ascending or descending order, in whole or in part. The sort can simultaneously rearrange the elements in another array (a tag array). It's not so much that the sort command is useful; it's certainly that. It's even more important that it exists; it's such a generally useful command that it's hard to imagine going without it once you've used it. Even a low-level language like C includes a sort command in its standard library. No Microsoft BASIC has a sort command, however. Equivalently useful are commands like Array Scan (search any array for any value), Array Insert (insert a new element in an array), and Array Delete. Without PowerBASIC, the programmer either must write an equivalent for each, or buy one. It's not as if these commands are terribly complex, so there's not a lot of work involved -- but there is some work, and it is repeated in every program written, and those programs are thus larger and more likely to contain errors, and slower than the PowerBASIC equivalent besides. In every part of PowerBASIC, the same pattern is repeated. Even mundane matters like compiling are addressed; PowerBASIC supports conditional compilation (making it easier to maintain separate versions of the same program in one source module). PowerBASIC also supports metacommands that eliminates both long and complex command lines and lengthy and error-prone selections from cascading dialog boxes. To force the compiler to create a program that will require an 80386 processor, you would insert the metacommand $cpu 80386 at the start of the program, for example. All executables can be compiled to stand-alone files that need nothing more than MSDOS to run. The other metacommands are also named in easily-remembered ways, making Power BASIC programs almost entirely self-documenting (at least potentially)! Other notable advances include an in-line assembler with a full knowledge of the environment (use MOV AX,X% to move the value of the BASIC variable X% to the AX register), TSR creation, string memory (in any single array or any number of arrays) up to the full amount of available memory -- not just 64K -- and things like block memory moves, MAX and MIN functions, bit functions (test, set, shift, and rotate), pointers, library support for arbitrary OBJ files, and minor niceties almost everywhere you look. Consider the INSTR function. In any standard BASIC, INSTR returns the first matching position of one string within another; INSTR("ABC","C") will return the result 3. PowerBASIC adds the ANY keyword for even more power, so the function INSTR("GFDSALK",ANY "QWERTAS") will return the result 4 (S is found before A). The ANY keyword can also be used in commands like LTRIM, RTRIM, REPLACE, and others. Communications capability extends to 115K baud and to other COM ports (to COM4, even all at once). There is a MAP command which allows you to subdivide a flex string into separate parts, similar to a FIELD statement; in effect, you can define a type at run-time! All this isn't just "neat" -- it's good, solid, and genuinely useful stuff. If you'd like to write TSR programs, PowerBASIC makes it easy; a complete TSR can take as little as five lines, and you don't need a third-party library -- the capability is built into PowerBASIC. In sum, PowerBASIC was designed from the ground up with a very different agenda than the other BASIC products. PowerBASIC was written in response to BASIC users; nearly every feature that appeared on very many wish lists was included in PowerBASIC. Some products have hidden agendas -- use them and you're buying a vision of the future of programming or computing that may or may not match what you'd like. PowerBASIC is pragmatic; it's what you always wanted in a computer language, and may be far more than you ever expected to get. That strikes me as especially significant. After all, don't you want to encourage a company that actually listens to its customers? I do. I'm now moving all my BASIC software from the former leader to the new one, and that's not a step I take lightly. After all, I've been using products from the other vendor since 1976, and there's a lot to move. It's nice to discover that my EXE files are smaller and run faster, besides my source files being an average of 25% smaller! Bruce W. Tonkin President - T.N.T. Software 34069 Hainesville Road Round Lake, IL 60073 (708) 223-8595