KCML7 features

Features

Better diagnostics

When a program or library is edited in the KCML workbench it is immediately compiled with an incremental compiler and any errors are immediately available.

Differences

Stricter scope rules

LOCAL variables are only visible in the function that declares them. Traditionally KCML6 exposed LOCAL variables to the functions that were called in that function.

Nested functions are supported.

These stricter rules were introduced for libraries in KCML 6.60 but they also apply for programs in KCML7.

Stricter compliance

Code must be at $COMPLIANCE level 2 or more. All variables must be declared explicitly. All DEFSUBs must have matching END SUB statements. DEFFN should be replaced by DEFSUB.

There are some new compliance rules:

No immediate mode

KCML7 is a compiled environment and there is no concept of an immediate mode. The console window is still available in the workbench but it executes KCML6 bytecode and does not have access to the symbols or code of the running KCML7 program environment.

Explicit library dependencies

KCML7 programs and libraries are both compiled with kc, usually invoked by kmake. When compiling a set of KCML7 programs all the dependent libraries must be declared so that kc can load them to check for consistency.

Dependent libraries do not need to be loaded explicitly with LIBRARY ADD as the KCML7 runtime will know what is required and load them on demand.

No overlays

The LOAD statement in KCML7 replaces the whole program and the facility to overlay only a restricted range of program lines is not supported.

No COM variables

There is no concept of a common chain so that DIM and COM behave identically in a foreground program. Common variables are not preserved across a LOAD. Use of COM CLEAR will be reported as a compilation warning and will have no effect at runtime.

COM variables can be replaced by PUBLIC DIM statements in libraries. These can be initialized on library load using a library constructor function.

IDE requires source

Because the new bytecode cannot be uncompiled, the workbench editor must work from the source files.

String variable names don't require $

KCML7 is introducing a stricter type system with richer types declared with DIM AS. The old tradition of declaring a variable to be a fixed size string by appending a $ is still supported but the $ is now a hint and not part of the name. Consequently a and a$ both refer to a and the following code will raise an error on the second line at compile time.

Declaring a string with no length is now a warning.

	LOCAL DIM a, b
	LOCAL DIM a$16
	LOCAL DIM x$
ERROR 181:Duplicate identifier a (test.src,10,2)
INFO 216:DIM of string without declared length: x$ (test.src,10,3)

Functionality not supported

Older features of 2200 Basic have not been implemented in KCML7. These include platter access, DATA LOAD and DATA SAVE, $GIO.

Features that are unstructured such as RETURN CLEAR, RESTORE, ON ERROR GOTO are not supported.