----- Original Message ----
> From: Brad Bowman <[EMAIL PROTECTED]>
 >
> "let" variables and "hypothetical" assignments within rules may be a
> good starting point.

Hi Brad,

Caveat:  I'm also tremendously underqualified to to make serious proposals here.

Interesting idea.  As I understand hypothetical variables, they are similar in 
concept to variables in Prolog, but they still have the problem that they 
really are variables which can be assigned to.  Thus, if you have a "logical" 
iterator binding values to variables and someone else assigns a value, what 
then?  You can break everything in very mysterious ways.  That's why Luke 
Palmer (I think it was Luke) suggested a "twigil" for the variables:

  let $`x = 3;

That could be a logic variable which could only be assigned to hypothetically.  
Any initial assignment to a logical variable would effectively be declaring a 
constant.

> > There's also the question of non-logical behavior in logic
> > programming. What happens if you try to use math in Perl6 logic
> > programming? Generally speaking, math is "non-logical" in the sense
> > that it's used in Prolog (see the aforementioned article). Opening
> > and reading from a file is also non-logical (you can't backtrack over
> > it). How are those issues to be handled?
> 
> Closures may have an "undo" trait which should be written to revert
> the side-effects of the closure when it receives an UNDO control
> exception (the block fails, see Definition of Success above).

Hmm, the only real problem, as you noted, is having to explicitly code the UNDO 
behavior, but for non-logical behaviors, maybe that's not too bad?  Still, what 
would happen with deleting a file?  It's very likely that you can't easily UNDO 
that, so certain behaviors can't be backtracked over.  I wonder how Mercury and 
Haskell handle issue like this?  (I realize Haskell is functional and not 
logical, but I still don't know how their monads work or if they would be 
applicable :)

> There's some information about this in S05, with more info promised:

> http://dev.perl.org/perl6/doc/design/syn/S05.html#Matching_against_non-strings

Ooh, looks promising.  In that scenario, is a hash viewed as an array of pairs? 
 If so, we could potentially have logic programming matching just about any 
abitrary data structure.

Cheers,
Ovid
-- If this message is a response to a question on a mailing list, please send 
follow up questions to the list.
 
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/



Reply via email to