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

Comment


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. And we suspect that quite a few GHS users have never heard of it.

Setting those philosophical issues 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.

Some programmers think their scripts are so beautiful that no comments are needed. It is true that comments which attempt to describe what the code is doing are like tattoos on a woman's arm, and they may become just as irrelevant if not maintained. One thing computers excel at is refusing to obey nonsense, but comments easily become outdated, or were misleading in the first place, and the computer unfortunately is okay with that -- as we all are about tattoos these days.

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