BBjAPI Classes Need No USE

Rule

Built in: no USE needed. USE is only for Java classes (USE java.util.HashMap) and classes from BBj source files (USE ::file.bbj::ClassName).

Why

BBjAPI classes (BBjWindow, BBjButton, BBjAPI itself and the rest of the BBj object family) are built into BBj and resolve by their short name, so DECLARE BBjWindow win! needs no USE line above it. A USE line written for such a class invites an invented package name, and the compiler's plain syntax check does not reject one.

Edge

USE BBjWindow does not compile: USE takes a complete Java class name, never a short BBj name. A full proxy path such as com.basis.bbj.proxies.sysgui.BBjWindow does compile, but it is unnecessary. An invented package such as org.invented.pkg.NoSuchClass passes bbjcpl -N, which checks syntax only, and is caught only by the type check (bbjcpl -t), which reports that it cannot find the class.

A USE statement must be the only statement on its line; the one exception is a trailing ; REM comment.

Evidence

USE Verb -- what USE takes: a Java class with its full package name, or a BBj Custom Object class from a file.

BBjAPI -- the entry point for creating and using BBj objects, which are built in.

Compiler result (BBj 26.03): bbjcpl -N rejects USE BBjWindow and accepts DECLARE BBjWindow win!, DECLARE BBjButton btn! and DECLARE BBjAPI api! with no USE at all, and it accepts USE java.util.HashMap with DECLARE HashMap map!. It also accepts the invented package, which only bbjcpl -t rejects.

Example

BBjAPI classes are declared with no USE; a Java class needs its USE line with the full package name:

use java.util.HashMap
rem 'BBjAPI classes need no USE; the Java class above does
declare BBjWindow win!
declare BBjButton btn!
declare HashMap map!
map! = new HashMap()
map!.put("key","value")
print map!.get("key")