4 ms·
I still think there are brilliant aspects to Inform 7, in particular its rule system and the way it handles predicate dispatch through the S-V-O structure of (c
by GorgeRonde 8y ago
I still think there are brilliant aspects to Inform 7, in particular its rule system and the way it handles predicate dispatch through the S-V-O structure of (controlled) english. Add to that the fact you can define your own adjectives (adverbs?), use prepositional phrases and rely on verb tenses to some extent really gives a twist to the way one usually think about programming. Being able to state something like "Rule to SOME_ACTION for someone who has never ANOTHER_ACTION" just deals at the language level with a lot of stuff that are tediously dealt with by hand, variable declaration after variable declaration just to achieve the same effect.
This S-V-O+adjoints structure is also what deals with one of rule systems biggest hurdle; namely the ordering of these rules. Most of the time I7 works by selecting the most specific rule for the subject/verb/object at hand and execute only that one. Surprisingly (but also because it's tightly coupled to the specific domain of inform (interactive fictions)) it works exceedingly well and only very rarely gets the order wrong.
Since Inform 7 also structures rules/functions through Actions and Activities, in sequential stages (which either work in "execute the most specific rule" mode or "execute all the rules that match" mode), you basically get a finer form of aspect oriented programming in that Inform7 does not rely on methods from some subterraneous object oriented world, it's pure declarative decoration all the way down. In the end this gives a very different feel about the way functions or procedures or rules, namely basic blocks of computation can be thought of. What's very special to Inform 7 is that functions are not conceptual atoms nor black boxes. They are composed of smaller, public elements called rules. And they are agnostic to any polymorphism, dispatch or type system functions are usually tied to: Inform 7 delegates these matters to their constituting rules.
And this is a dream when it comes to modelling business logic, because it gives a common "mental space" so to speak to code that would have been spread throughout the codebase otherwise.
There is a lot to be said about those conceptual aspects of Inform7, but presenting it as a looks-like-english language is not enough. It's also a think-like-english language at the syntaxic level of what a language is : our friend Chomsky would argue that it's the kind of syntax for which we have dedicated hardware (gpu accelerated so to speak). Without it, Inform7 would probably be incredibly hard to grasp.
In short: Inform7 and its rule system is one of the best programming encounter I ever had at the conceptual level (and I'm a lisper), but frankly, writing it, getting english to be just like Inform's version of english is nightmarish.
- WorldMaker 8y ago> And this is a dream when it comes to modelling business logic, because it gives a common "mental space" so to speak to code that would have been spread throughout the codebase otherwise. To wander down further tangential space, I did briefly wonder at a past job if I7 would have been a good fit for the basis of a business rule engine. At the time the answer was "absolutely not" because there was no way to embed the language, or a subset of it, in another platform and bend some of the IF domain assumptions. Some of the work in modularizing the tools in the last couple of years seems to head in the direction that it is close to getting technically possible. There's still the problem that I7 is still not "perfect" for non-technical users (rules list oddities like indents and semicolon punctuation) and more importantly that performance guarantees with the I7 rule engine are hard. I7 itself can work around the performance issues because it typically has complete knowledge of the domain world model at compile time and can memoize a lot of things at compile time and/or shortcut them at run time. If you were to try to build a business rules engine based on I7 you'd have a lot of fun trying to remove all the potential footguns that start to resemble the classic "paradox rules" to take down the system just like every other Shatner-era Star Trek episode.