General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

Comment (revision)


A "command" that appears frequently in this programmer's run files is one that got omitted from the command index.


It was deliberately designed to be as quick as possible to enter, and, in fact, it is mathematically provable that no command can have fewer characters.

Purists will insist that ` is not a command in its own right but only the beginning of a comment. No doubt some GHS users who use this command all the time don't consider it to be a command.

Setting that philosophical issue aside, the technical fact that our "comment" command consists of only one character means that it's only able to represent one line of comment text.

The "bookend" type of comment syntax found in other programming languages can accommodate any number of lines. But that advantage comes with the heavy penalty that four characters are required since the beginning and ending delineations must be different, and to avoid tying up a character needed for other purposes, a goofy-looking two-character combination must be resorted to.

So in GHS we use the elegant left-hand single-quote mark usually found outboard on the port side of the keyboard. If it weren't for GHS, that legacy key would seldom if ever get used, since modern word processors slant quotes automatically. Hopefully it still exists on your keyboard. But if not, we have introduced {* ... *}, a goofy-looking character combination as an alternate way of doing a comment.

Admittedly this "heavy penalty" is well worth the price if you need to "comment out" several lines. Also, it allows blocks of clean comment text which are easy to edit. For example,

{* This run file was written by me (John Bonn) before I knew about the bookend-type comment syntax available in late versions of GHS. Now it is a pleasure to write explanatory notes where it was a pain before. Speaking of goofy, blocks of comments with the old-style comment mark are what looked goofy. *}

A common use of the "comment" command is to "comment out" a line of code. There are lots of reasons for doing this as you well know if you've done much programming.

For example:
GHS 1, 2, ..., 12 `Drafts every foot from 1 to 12
`GHS 1, 1.5, ..., 12 `6-inch intervals

Note: The single left quote graphic shown above was made with GHS Part Maker. It's actually a tank.
enter pm
create LHQ.C
sph (48) 0,0,0, 10
comp tail
cyl (48) 2,0,0, -8,-2,-14, 6,2
fit (ext) LHQ
/
display `tab to iso view then Visualize
quit pm

Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs