New MPI Functions?

From Redwall MUCK Wiki

This page was imported from a forum post dated May 07, 2009 in the category World Building and Coding by Riverdale. Its content is likely to be out of date!

This post had 5 replies.

Thu, 05/07/2009 - 18:29


What changes would coders like to see made to MPI? This can include new functions, new features, new methods of deployment, etc.

Planned changes already include bringing MPI’s functionality into parity with MUF, so that you’ll be able to dig rooms, link exits, and so on using just MPI (no more {force}). Because the implementation of MPI is going to change, it’s likely that we’ll also lose some of the artificially low limits on recursion and nesting. And, finally, support for styling text is already something we want to do, so no need to propose ANSI color (although please do suggest how you’d like the functions to look).

My first suggestion is an unusual one. Inspired by some other languages, I thought it would be interesting to have an {immediate} function. It would act as a compiler directive. Code inside would be compiled and evaluated immediately, then compiled again (but not evaluated), rather than simply being compiled once for later evaluation.

Here’s an example:

@desc me=I wrote this desc when I was in {immediate:{name:{loc:this}}}. Now I'm in {name:{loc:this}}.

As I imagine it, this would compile to MUF like this:

"I wrote this desc when I was in Riverdale's Tent. Now I'm in " trig location name strcat "." strcat

A key assumption here is that compilation happens when the property is set. It remains to be seen whether or not that’s reasonable behavior. Let’s say for now that it is. How can {immediate} be used?

It could be used to construct complex macros, for one thing. It could also mean that scripts might be written more portably. If _msgmacs/ expansions were given some extra power, it could be possible to implement certain control flow functions as macros that are expanded at compile time ({switch} comes to mind; it’s just a bunch of {if}s and {eq}s).

What do you think? Is it desirable? Is it interesting? Is it little more than a technical curiosity?

Anyway, as I said, this topic is primarily to get a sense of the things MPI coders want to be able to do, so that the upcoming redesign can take them into account.

Top