Bubbling Beaker Awards (Award #36, Apr 24 2026)

I was alerted to this one by Zed, who called it “some of the maddest science I have ever seen.”

Dannii posted a code snippet in a discussion about trying to adapt the Dynamic Objects extension to the current version of Inform, mentioning it as a possible technique for dynamically determining whether the compiler was replacing a macro-like declaration with either a constant value or a routine. Although the code snippet only demonstrates the general technique and not a specific solution, it is a very clever hack.

The code makes use of the Glulx @catch opcode to obtain a “reference point” within a routine that prints text and then identifies a particular string address appearing shortly thereafter. It passes this string reference to another function. The reference is to an I6 string that would not normally have its own separate identity (at least, not one that could be referenced by name), since it represents only a part of the string that the author wrote at the I7 level.

The beauty of code is that it’s attached to a new to say... definition that allows the author to very elegantly declare link declarations within say statements without requiring any separate data structure (e.g. table or special-purpose object). According to Zed, this code fragment comes from an update of the Inline Hyperlinks extension, and the complete functionality is intended to allow authors to write statements along the lines of:

say "You can [link]<URL>[as]open the door[end link].";

(Note that the [end link] substitution not demonstrated in the code fragment posted by Dannii.) When using Inline Hyperlinks as in the preceding example statement, the portion of the text would not be printed to the screen; it is instead passed to a routine to create a new hyperlink.

Because the @catch opcode is embedded in the to say... phrase, any use of the phrase causes the it to call the interpreting function from the rule that includes the say statement, which means that the reference point created is local to that rule and will let the interpreting routine find the corresponding string near that reference point.

This abuse of @catch is a technique with wider potential application, and it practically begs for additional experimentation along the same lines. For this remarkable contribution to the mad science equivalent of basic research, I am pleased to present this week’s prize, Bubbling Beaker Award(R) #36 to @Dannii. In addition, due to its particularly devious inventiveness, this award is being granted the coveted Peer Revue™ distinction by unanimous vote of the I7 Mad Scientists. Congratulations!

This is Dannii’s second BBA, and it probably won’t be the last. @Dannii: Would you like to say a few words about your invention?

6 Likes