Idea for a unified framework for handling hyperlinks in Inform 7

FYI I’ve updated Inline Hyperlinks to use the registry as well now, plus fleshed out the registry itself with a bit more documentation and sanity checking.

I think it’s pretty decent now (barring the unfortunate incompatibility with the Windows IDE), though it’s all still on a test branch so that we can mess around with it some more if you want before unleashing it.

(One possible downside of not keeping an actual list is that there isn’t any central way to ask which tags are assigned to which extensions – but other than for debugging purposes nobody should ever actually need to know that, and when debugging a single extension you can just print its specific tag variable with some suitable label as needed. So it’s not a big loss.)

I did wonder if I should add a “not for release” debugging command similar to rules that prints data about hyperlinks being clicked or lets you trace the hyperlink processing rules (currently even when rules itself is on, that is suppressed, for very good reasons). But on the other hand again it’s pretty easy to add your own specific to your extension if you really need it. The core link processing rules are simple enough that unless you’re hit with some weird platform issue (like the 16-bit truncation) it all Just Works™.

Interestingly, through a random spelunk through I7’s I6 layer I came across the “combination” kind, which is described as a small list of differing kinds – i.e. a tuple. This would be perfect for rules that want to use multiple values as parameters or results.

Sadly, I’m not aware of any way to actually access these from I7 itself. Perhaps not yet fully implemented?

1 Like

Usually you can use parentheses to disambiguate an invocation. I don’t know about a definition, but I think it would work?

The hyperlink extension registry is a list of (number based rulebooks producing text) that varies.

Weird. I swear I tried that and it didn’t work at the time, but now it seems to, at least in isolation. Perhaps I goofed elsewhere.

Oh well, I think I’m sufficiently happy with how the extension works now instead anyway.

FYI I’ve merged this (and the corresponding updates to Inline Hyperlinks) to the main branch now; it’s probably spent long enough languishing in an experimental branch.

Great, thanks.

I am still thinking that I’d like to make my own implementation of this idea, but I don’t know when I’ll get around to it.

You can of course do that (it was based on your idea to start with), but I still think it’d be better to collaborate on one definitive extension rather than dividing the waters. The idea of a registry does assume that everyone is using the same one, otherwise you just get conflicts again.

That is true. So I might not end up making my own!