Boost logo

Boost :

Subject: Re: [boost] [castor] Interest in Logic Paradigm for C++ ?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-05-06 23:12:52


On Tue, May 4, 2010 at 2:21 PM, Roshan <roshan_naik_at_[hidden]> wrote:
> On Tue, 04 May 2010 16:02:39 -0600, Robert Ramey <ramey_at_[hidden]> wrote:
>>
>> If you really believe this, then you'll have to conclude that no one will
>> want to use your library either.
>>
>
> No, I am just saying its a important to think twice before replacing a 100
> lines of invisible internals with several  thousand lines from another
> library. The issue is not as simple as "don't ever use another library".

However these libraries are not used lightly, they are well tested,
very functional, etc....

On many other points in this thread
===================================

As for Iterators, they can easily return a tuple of values, not just a single.

Why not a Range concept?

Many of the issues people and you have pointed out could be solved in
a Boost.Phoenix style interface instead. As an example, in pure
pseudo-code, this should be quite possible:

  auto f = arg1=="Sam" && arg2=="Mary" //fact 1
         || arg1=="Denise") && arg2=="Mary" //fact 2
         || arg1=="Sam") && arg2=="Frank" //fact 3
         || arg1=="Denise") && arg2=="Frank" //fact 4
         || arg1=="Frank") && arg2=="Gary" //fact 5
         ;

  // Loop over all
  for(auto r = f(any,any); r; ++r)
  {
    cout << r.get<0>() << ":" << r.get<1>() << endl;
  }
  /* Prints:
Sam:Mary
Denise:Mary
Sam:Frank
Denis:Frank
Frank:Gary
  */

  // Loop over all of Sam's parents:
  for(auto r = f("Sam",any); r; ++r)
  {
    cout << r.get<0>() << ":" << r.get<1>() << endl;
  }
  /* Prints:
Sam:Mary
Sam:Frank
  */

  // Test if Sam is child of Mary
  auto r = f("Sam", "Mary");
  cout << r.get<0>() << " is child of " << r.get<1>() << " is " <<
boolalpha << r << endl;
  /* Prints:
Sam is child of Mary is true
  */

Other things to discuss too, but I have to go, perhaps later. What do
you think of that style interface though, and you could easily build
upon and combine them and many other things.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk