Re: Nested Relations / RVAs / NFNF

From: Neo <neo55592_at_hotmail.com>
Date: 5 Nov 2004 11:13:13 -0800
Message-ID: <4b45d3ad.0411051113.192e7f1_at_posting.google.com>


> > // One method of representing fido's mass is 2kg with XDb2
> > CREATE2 *qty.cls=thing; CREATE2 *unit.cls=thing; CREATE2 *mass.cls=thing;
> > CREATE2 *; CREATE2 it.cls=mass; CREATE2 it.qty= +2; CREATE2 it.unit= +kg;
> > CREATE2 *dog.cls=thing; CREATE2 *fido.cls=dog; CREATE2 *fido.mass=2kg;
>
> At this point, my type system of choice is the Milner system

Can you give a brief description of the Milner system?

> first implemented in languages like HOPE, Standard ML, Miranda and more
> recently Haskell... but it's a heck of a lot better than the XDb2

In what way is Haskell's code a lot better then XDb2's? Could you (or anybody else) show how to represent 2kg in Haskell?

> For info, please check http://haskell.org.

It appears Haskell is a "functional programming language" where as XDb2 is "database". In general, a language can optionally use a database to represent/persist things. How does Haskell represent/persist 2kg? Would the kg in 2kg and 5kg be normalized as in XDb2? How does Haskell set a ball and a dog's mass to 2kg? How does Haskell find all things whose mass is 2kg? According to Haskell, in a functional language, user simply specifies what he wants, not how to do it. For example, with XDb2, to find all things whose mass is 2kg, one queries "SELECT2 %.mass=2kg;". How does Haskell do the equivalent and how is Haskell more "functional" in this case?

It seems to me that you are comparing C with Haskell (not XDb2 with Haskell). One can represent 2kg in almost any programming language. I demonstrated how a programming language like C can represent/persist a thing (ie 2kg) with XDb2 instead of the program itself. Below is another way a C program can represent 2kg with XDb2. NLI_create2 is a function provided by XDb2's API.

main ()
{

  NLI_create2 ("*qty.cls = thing");
  NLI_create2 ("*unit.cls = thing");
  NLI_create2 ("*mass.cls = thing");
  NLI_create2 ("*");
  NLI_create2 ("it.cls = mass");
  NLI_create2 ("it.qty = +2");
  NLI_create2 ("it.unit = +kg");
  NLI_create2 ("*dog.cls = thing");
  NLI_create2 ("*fido.cls = dog");
  NLI_create2 ("*fido.mass = 2kg");

} Received on Fri Nov 05 2004 - 20:13:13 CET

Original text of this message