Reflective Wiki

Spawned from Wiki Placename Problem by this comment:

Actually, a "reflective" Wiki which could be used to alter its own source code would be a very worthwhile thing. On the other hand, it is also most definitely and absolutely certainly a stupid idea and one that couldn't possibly work, ever ever. On the gripping hand an Object Oriented Wiki could certainly work. Combine that with Mana Mana and one might have a Tar Baby. Hmm. -- Peter Merel

Hence the Reflective Wiki is an idea or suggestion for yet another Wiki Engine.

Which technology? How would it work?

Well, it seems obvious that you would need a strong sandbox.

You would probably need some automatic version control, such that the system could automatically roll back changes which cause it to malfunction.

Supposing each "page" had a Unit Test, you then have a hook for your version control - if the change you are making will break the Reflective Wiki, then you must commit to a branch.

Of course, that would be Version Control Applied To Wiki gone mad.

I don't think such a thing is necessary. Just provide some rudimentary scripts (eg show and edit) that cannot be altered, but usually use other (reflective) interfaces to the wiki. Make an exception handler that points the user directly to the non-alterable edit script on the right file.

Likely side effects

I can see that this system is not going to be popular with the casual Wiki Zen.

Self Modifying Code is often Considered Harmful, so I can see that the average contributor is likely to be a hacker with a twisted mind. Hence the Reflective Wiki would have some amazing features, but few will be able to understand or use them.

In case there was still some doubt, it would nicely underline the fact that Code Is Speech (in the Protected By American Constitution sense. See also Digital Millennium Copyright Act).

There could be problems with ensuring that the code compiles. OK, you could check that at submission time, unless "do" or "use" are allowed to include other pages - you don't want to have to "perl -wc" the whole site each time.

Then there is the Halting Problem. Solve that and you're on to a winner! 8->

Examples

(Haven't actually looked at it yet but) Hyper Perl sounds interesting.


I started the page thinking the idea must be bonkers, but I'm not so sure now. -- Matthew Astley



Well, you don't actually need to build all that much. Start with a plain vanilla Wiki. You could just add some special Text Formatting Rules to mark those areas that are Reflective Wiki code. Then a small script can be run whenever "save" is pressed to strip out all lines of Reflective Wiki text into a file.

A User Mode Linux sandbox can run the actual Reflective Wiki.

Of course that leaves one wondering about a Meta Reflective Wiki...


A Reflective Wiki could also just have one layer that users could edit for instance using Prolog Language to assert facts and rules, and query them, and another underlying layer (in perl, java or whatever) that would not be user modifyable. Perhaps with import/export from/to RDF. Most Semantic Web/Semantic Wiki/Rdf Wiki sites seem just about storing facts a Reflective Wiki could allow inference on the facts. So even if the knowledge/rulebase got deleted or mangled it could be repaired by users from recent edits the basic functionality to allow viewing, adding, editing would not be affected.

For instance easytopicmaps.com describes an ontology for Beer and www.ontopia.net even has breakdowns by country but nowhere does it let a user type for instance beer(seasonals,'by event',X) to query what another user(s) has entered.

An online example showing what is possible can be tried by going to logic.csci.unt.edu copy and paste the following (derived from the .txt above)-

Paste in "Query Interpreter":

beer(seasonals,'by event',X)

Paste in "Quick Online Editor":

beer(seasonals,'by season', ['christmas beers', 'easter beers', 'winter beers (belgian)', 'summer beers', 'saison (belgian, french)']). beer(seasonals,'by month', ['m�rzen', 'maibock', 'oktoberfest']). beer(seasonals,'by event', ['festbier']).

Then click the submit button the result is a bit hard to see but in the bottom frame scroll down a bit it should say

X=[festbier];

You could vary parameters and it would return results accordingly. In a Reflective Wiki with a prolog or other interpretive top layer one set of users could enter knowledge and rules and others query it to arbitrary levels of detail. See also an online prolog RDF parser demo at www.swi.psy.uva.nl With that kind of interface users could combine queries to outside the wiki from RDF/RSS feeds See bitsko.slc.ut.us . By using Use Mod Wiki and swi prolog (free with both unix and windows source) it should not be hard to do.


See original on c2.com