CLEAR 语句是否有第一个参数?

Was there ever a first parameter for the CLEAR statement?

在 GW-BASIC 和 QuickBASIC 中,语句都是传递参数,其中一些参数是可选的,可以根据语句省略:

REM Move the text cursor to the specified column and row.
LOCATE row%, column%

REM Move the text cursor to the specified column without changing the row.
LOCATE , column%

在 GW-BASIC 中,CLEAR 语句很不寻常,因为它的第一个 "argument" 总是被省略:

CLEAR , basicMem
CLEAR , basicMem, basicStack
CLEAR , , basicStack

在 QuickBASIC 中,由于 interpreter/runtime 管理自己的内存,basicMem 参数成为可选参数:

CLEAR , , basicStack

我想知道第一个 "argument" 是否曾经用于 GW-BASIC 之前的任何东西,即像这样的东西实际上有用:

CLEAR missingArg, basicMem, basicStack
REM   ^^^^^^^^^^
REM      here

也就是说,在第一个逗号之前是否有一个有目的的非空参数?

如果有人有任何想法,我很想知道!

What I'm wondering is whether that first "argument" ever used for anything prior to GW-BASIC, i.e. something like this was actually useful:

CLEAR missingArg, basicMem, basicStack
REM   ^^^^^^^^^^
REM      here

That is, was there ever an purposeful non-empty argument before the first comma?

是的,有第一个参数,但从来没有真正使用它的三参数形式。

Microsoft(原 Micro-Soft)创建了 Altair BASIC。它的特点是 CLEAR 命令没有参数,将所有程序变量设置为零。 4K版没有字符串,所以不需要管理字符串space。但是,8K、扩展和磁盘版本有一个 CLEAR 命令,该命令也接受 CLEAR x 形式的单个参数。值 x 指定了字符串的最大数量 space 以字节为单位,BASIC 加载时的默认值在 8K 版本中为 50 字节,在扩展和磁盘版本中为 200 字节,直到它被更改[source]。这就是缺少的第一个参数的来源以及它最初的用途。然而,当时只有一个论点是有效的。

Microsoft 继续为多个系统开发名为 "BASIC-80" 的衍生产品,特别是 Intel ISIS-II、CP/M 和 TEKDOS 操作系统。还创建了一个 "Standalone Disk BASIC" 版本的 BASIC-80,可以在 "almost any 8080 or Z80 based disk hardware without an operating system." 上 运行 没有 4K 版本的 BASIC-80,所以这是合理的假设 BASIC-80 的所有版本都像 Altair BASIC 的 8K 版本一样提供可用的字符串。因此,该字符串 space 需要管理。但是,在 BASIC-80 中 a second argument was added:

CLEAR [expression![,address]]

expression! 是一个指定字符串数量的表达式 space,就像在 8K (Altair) BASIC 中一样,而 address 是 BASIC 可用的最大地址,即数量BASIC 可用的内存数量,例如 GW-BASIC 中第一个逗号后的参数。

最终,BASIC-80,5.0 版发布,it featured the odd syntax instead:

CLEAR [,[expression1][,expression2]]

expression1 是 BASIC 可用的最大内存,expression2 是堆栈数量 space。 Appendix A: New Features in BASIC-80, Release 5.0 解释第一个参数被删除的原因:

  1. String space is allocated dynamically, and the first argument in a two-argument CLEAR statement will be ignored.

换句话说,CLEAR strSpace!,maxMem 将忽略 BASIC-80 5.0 版中的 strSpace! 参数,因此语法变为 CLEAR [,[maxMem][,maxStack]].

QuickBASIC 最终将语法进一步更改为 CLEAR [,,stack]。 令人困惑的是,QuickBASIC 4.5 的联机帮助系统声明如下:

 Note: Two commas are used before stack to keep QuickBASIC compatible
       with BASICA. BASICA included an additional argument that set the
       size of the data segment. Because QuickBASIC automatically manages
       the data segment, the first parameter is no longer required.

"The first parameter" 提到的是 maxMem,因为 BASICA(和 GW-BASIC)使用了 BASIC-80 5.0 版可用的语法,而不是同样缺失的 strSpace! 参数BASIC-80 的 5.0 之前版本。