[alicebot-archcomm] <set> tag, and clearing predicates
Jonathan Roewen
alicebot-archcomm@list.alicebot.org
Wed, 11 Dec 2002 13:40:33 +1300
> > You only need exists. In AIML, anything that exists has a value,
> > everything
> > that doesn't exist has no value (the empty string). In my interpreter,
> > whenever there is AIML which attempts to retrieve a value of
> > something that
> > doesn't exist (an out-of-bounds <star/> index, <get/> for something that
> > isn't <set/>), it returns an empty string. So I think exists in
> > <condition>
> > would be only natural to represent the empty string.
>
> You could write exists like
>
> <condition name="x" value="*">x exists</condition>
> <condition name="x" value="">x doesn't exist</condition>
Of which you can't have value="". J-Alice uses the contains, beginswith,
endswith, etc, and I've actually discovered that value="" doesn't work in
J-Alice either, which I think is why exists would be useful, provided only
that you don't have GM style patterns in value, else it's not needed.
Your example should be:
<condition name="x">
<li value="*">x exists</li>
<li>x doesn't exist</li>
</condition>
Personally, I don't like the pattern-like option in value. I much prefer
having the more explicit variants (value, contains, beginswith, and
endswith). For the matching like effect, if it was to be available at all,
I'd much rather call it matches, as that is what it is doing .. it's not
saying it has the value "* something", but rather matches the pattern "*
something".
> Which saves us the hassle of introducing a new attribute :-)
>
> >
> > Perhaps for the <predicates> section, and the likes.
> >
>
> Yes, but do we agree on this? Program P supports D-style startup.xml (and
> the accompanying files) but what about the other interpreters?
The startup.xml doesn't work with J-Alice. Right now, we've changed to a
.ini file, as most of it is specific to J-Alice (IRC Config, Web Server
config, etc). Other stuff that affect the core engine is the patterns (if
any) to attempt to match when infinite loops and no matches are found, the
maximum recursive depth before flagging an infinite loop, and stuff like
that.
>
> > > False. I think that having this "default" value that is returned every
> > time
> > > a variable is empty is a bad idea. Having a way to initialize
> > variables is
> > > OK.
> >
> > Perhaps so, but isn't that the whole point of it being a default
> > value? It's
> > like how ProgramD returns "undefined" for most predicates when you use
> > <get/>.
>
> Yes, and this is exactly what I don't like. There's no way to
differentiate
> between the "true" default value, and a value that is just the same as the
> default value. But, since the global 'default' value is set separately
from
> the categories (and in D's case separately from the AIML startup files as
> well, it's configured in the D-specific server.properties file), how can I
> reliably test it? I mean, someone uses "undefined", someone else might use
> "undefiniert", "N/A" and the whole notion of the global default becomes
> pointless.
I don't like default values either, and they don't work with J-Alice anyway.
I much prefer the content of <get/> to be the default if the value is an
empty string, like you have below.
> If I personally had to specify a default value, it would be an empty
string
> and I'd use a more flexible mechanism, like <get
> name="name"><random><li>user</li><li>master</li></random></get> - this
calls
> the user either by his name (if it's known) or user or master. You could
> also check the users gender (if known) and alternate between master and
> mistress. Of course, you can write this with a condition as well, but for
> simple cases, <get name="name">user</get> is much more convenient than
> <condition name="name">
> <li value="*><get name="name"/></li>
> <li>user</li>
> </condition
>
> or
>
> <condition name="name">
> <li exists=""><get name="name"/></li>
> <li>user</li>
> </condition>
>
> (BTW, is this how you'd use the exists attribute?)
No no. Exists is either true or false.
<li exists="false">the predicate doesn't exist (ie: no value)</li>
or
<li exists="true">the predicate does exist (has a value that isn't the empty
string)</li>
> Kim