Gated Lists (update)

I’ve changed my mind about the Gated List syntax. (These mind-changes are a key reason BOOL design is endless!) The idea of binding a label to the first statement in a List to indicate a Gated List just didn’t make good sense to me.

The problem is two-fold: Firstly, a key reason for Gated Lists in the first place is their use as named Action clauses. When the label is buried in the List (because it now belongs to the first List member), there’s no sensible way to migrate the label to the List. Secondly, a label on the gate expression really makes no sense and has no value.

So I’ve come up with something new!

I’ve been reserving the question mark (“?”) symbol for just the right thing. For most of BOOL’s multi-decade life, its only appearance was as a special Message character (it was an alias for the Q: Message). In BOOL2013 those Message aliases, especially ones using symbols, were removed.

The question mark obviously suggests a query, and as such seems a perfect match for the new List syntax. Which is this:

{=} [ {?} expression ]
.   list-statement
.   list-statement
.   etc

I haven’t decided if whitespace is allowed between the equals sign and question mark, but the BOOL Style Guide specifies none. Here’s an example of a Gated List:

=? lt: 0 angle;
.   set:x mul:radius cos:angle ;;;
.   set:y mul:radius sin:angle ;;;

Which in another language might look like this:

if (angle < 0) {
    x = radius * cos(angle);
    y = radius * sin(angle);

This change finally makes Gated Lists seem fairly rational, and I think this brings a very long-standing design issue to a full stop.

The @if example would now look like this:

>>  *()  if-expression
>>  *()  if-statements
<<  *bool  swx
=   set:swx  t:if-expression ;;
.   =? swx
.   .   if-statements

Note another change: Actions no longer allow anonymous Lists as the first clause if there is also a labeled clause for the Action name (see next post). A single anonymous List is allowed as the first Action execute List, and if so acts as if labeled with the Action name.

In the example above, there is only one clause, which binds to the Action name (“if”). The explicit label is optional and in single-clause Actions is always left off.

%d bloggers like this: