[alicebot-archcomm] Predefine predicates/properties

Jonathan Roewen alicebot-archcomm@list.alicebot.org
Wed, 30 Jul 2003 09:17:06 +1200


> > [snip] IE:  <get name="name">user</get> would produce "user" iff the
predicate
> > results in "" (empty string), otherwise it would be the value of the
> > predicate (eg "bob").
> >
> This is exactly, what the predefinition does:
>     <predicate name="name" default="user" set-return="value"/>
>
> I find it confusing having a get-element *with* content.
>
> It's extremely helpful to have a strict variable handling, even in
> weakly typed languages - that's why I prefer Perl over PHP.

So if I'm going to add this predefinition thing to my AIML sets, where I
have some very complex sets that use <set> and <get>, and ensure that they
all have predefined values is crazy .. it may be realistic for very simple
sets, but the more complex you get, the more unmangageable it becomes, as 1)
they're all in once place, and 2) could have lots and lots of files to sort
through .. or startup the interpreter thousands of times until found all the
undefined predicates.

> But your argument about declaring variables on-the-fly has to be
> considered - so let's refine the proposal.

Well your redefinition is just plain crazy .. locally scoped predicates
aren't really that useful.

I think you're just trying to protect the AIML writer from themselves,
resulting in obfuscating AIML. If you _really_ want to be able to protect an
AIML writer from all the possibly stupid things they could do, then the way
to do this is to create a meta language variant of AIML, create an editor to
edit these 'master' files.  When you're ready to add them to your bot, use
XSLT to transform them to proper AIML, and then you're all good.  Adding
checks/warning messages about undeclared variables wouldn't be too difficult
to add to your editor.

The majority of the things you want can probably be achieved via XSLT and a
meta-language variant.

Also, making undefined predicates a *fatal error* is just plain bad. It
should issue warnings, and have options in the interpreter to disable these
warnings. Also, there is no way I'm going to screw up J-Alice by adding this
sort of thing. It's fine for your ProgramV, where all the knowledge is
precompiled .. J-Alice loads everything on the fly, making it quite flexible
in what it can/will be able to do, and having to add even more overhead is
too much.  Template content is never processed until it is used .. the most
that will happen is syntax errors from the XML parser.

> In respect to the standard using of variables in programming languages -
> aka a variable is only visible in the block it is declared in - we could
> state:

This has all sorts of implications.  What if the user doesn't realise
they've spelt the predicate wrong? Opens up a can of worms with lots more
problems, then reducing them, which I thought is what you want to do (though
going too far for me).

> I think, one part of the pragma "Keep AIML simple" is to provide
> mechanisms helping AIML writers to avoid faults.

I disagree.  My idea of keep AIML simple is to create a lean and mean
language that is very powerful, yet easy and elegant to use. Keeping it
simple would be reducing number of special cases, number of tags that need
to be implemented, etc. Most of your proposals achieve neither of these.

Jon