You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
I thought of that, but the last capitalized word in the statement isn't always followed by a comma, as in this example:
DIALOG SET ICON hDlg, newicon$
What you say can still be true, but I was hoping there was some visual/cerebral way to know without having to simply memorize which statement uses them, and which don't.
Features created on different days and/or by different people and neither the beta testers nor the PB quality control people noticed this inconsistency.
That, or a burning desire to send all users to the help file as often as possible.
Maybe some day the BASIC compiler will treat 'comma' the way COBOL does: as white space, just like space or tab. That is, in COBOL, all commas are documentary-only. I think there are most a handful of PB statements which would require revision to support this, none of which occur to me off my head, except the couple which support "null/none" parameters and require commas as 'placeholders' , eg... MSGBOX
Memorize? You mean we're supposed to know this stuff that well?
Personally, with the number of languages I work with on a daily basis, I'm lucky to remember that the particular language I'm working with will do something, and remember how to locate the information on the syntax.
For those, you could remember it as:
DIALOG -> I'm telling the dialog to do something.
SET -> it needs to set something to the main dialog internal logic.
ICON -> I want it to have a new icon.
hDlg -> which dialog.
, newicon$ -> this icon.
Furcadia, an interesting online MMORPG in which you can create and program your own content.
The irregularity of the comma is pretty sloppy design and wouldn't be remarkable in most Basics. I suspect it stands out in PB because there's so much very careful design and so very little sloppiness.
I'm a beta tester and this question did come up early in the development of DDT. As I remember it... there is a logical reason, I just can't... remember it. I know that's not very helpful but maybe it will ring a bell with another tester.
Remarks
All executable code must reside in a Sub (Function. Method, or Property) block. You cannot define a procedure inside another procedure.
SUB and END SUB define a subroutine-like block of statements called a procedure (or subprogram), which is invoked with the CALL statement, and may be passed parameters by value or by reference.
A Sub may also be invoked without the use of the CALL statement. If the CALL statement is omitted, the parentheses around the arguments list must also be omitted.
The DDT statements, as well as the XPRINT, GRAPHICS and etc., statements are similar to the SUB/END SUB statements without the CALL. That is, the parentheses are omitted and the arguments are separated with commas. The problem with these statements is in determining what the statement is and what are the first and subsequent arguments, especially where the statement has multiple words. Consider the following statement:
CONTROL ADD BUTTON, hDlg, id&, txt$, x, y, xx, yy [, [style&] [, [exstyle&]]] [[,] CALL callback]
If "BUTTON" were an argument, it would be preceded with a comma. Instead, it is followed by a comma since hDlg is the first argument.
So, the statements in the help pages are shown in all capital letters, followed by a comma, followed by the list of arguments, separated by commas. This helps to understand which words constitute the statement, and which are arguments. For this reason, it may be useful to set your editor's option to capitalize the keywords. You don't have to memorize statement's format, but frequent use of the help manual will eventually set it in your mind.
Last edited by Robert DeBolt; 17 Jan 2009, 02:21 AM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment