From darren at darrenduncan.net Wed May 19 01:17:25 2010 From: darren at darrenduncan.net (Darren Duncan) Date: Wed, 19 May 2010 01:17:25 -0700 Subject: [VPM] ANNOUNCE - Muldis D version 0.129.1 Message-ID: <4BF39E95.30703@darrenduncan.net> Greetings, I am pleased to announce that version 0.129.1 of the specification of the Muldis D language, for object-relational databases, has been released on CPAN. This release marks a milestone for Muldis D in that the /language specification/ is now fundamentally complete, with all of the important details now formally specified. Prior to this milestone, some important details were missing, and so it would have been difficult to demonstrate what actual Muldis D code looks like, whereas now it is feasible to write and understand code for any given task. Some code examples follow. However, no Muldis D implementation actually exists yet, so you can't actually /run/ any code. The next Muldis D milestone will be the creation of a substantially complete self-contained reference implementation, which I expect to have done sometime in the next few months. Until that next milestone is reached, the Muldis D language spec is officially of pre-alpha quality; as of that milestone, it will officially be alpha quality. Here is the specification: http://search.cpan.org/dist/Muldis-D/ For those of you who are not familiar, Muldis D is an industrial-strength computationally complete high-level programming language with fully integrated database functionality; you can use it to define, query, and update "object-relational" databases. The language's paradigm is a mixture of declarative, homoiconic, functional, imperative, and object-oriented. The syntax of Muldis D is like that of a general purpose programming language, with Perl 6 being a strong influence (and multiple other languages contributing too), but it also greatly resembles SQL as well, and so shouldn't be too difficult to learn. For all intents and purposes you can consider Muldis D to be what SQL should have been; it can express anything useful that SQL can, but in a much improved manner. So it should be easier to write more expressive and less kludgy code in Muldis D than in SQL. The simple code comparisons further below should demonstrate this. In order to get a more thorough introduction to Muldis D, please go to: http://muldis.com/Muldis_D.html This document gives some side-by-side code comparisons with SQL, ideas for what you can use Muldis D for /right now/ (in existing database tools), a list of its features, and more. See http://search.cpan.org/dist/Muldis-D-Manual/lib/Muldis/D/Manual/CD.pod for a complete database schema plus test application example. Browse through http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Dialect/PTMD_STD.pod for the concrete grammar plus a lot more code examples. Here's the canonical way in Muldis D to do a common kind of query that searches simply using value equality tests: $tab1 matching Relation:{ col1 => 'hello', col2 => 5, col1 => 'world', col2 => 7 } ... and here are 2 ways to do the same query in SQL: SELECT * FROM tab1 WHERE (col1, col2) IN ( SELECT 'hello' AS col1, 5 AS col2 UNION SELECT 'world' AS col1, 7 AS col2 ) SELECT * FROM tab1 WHERE col1 = 'hello' AND col2 = 5 OR col1 = 'world' AND col2 = 7 Given the example relvar/table "tab" that has the 8 attributes/columns (col1,col2,col3,bigcol4,col5,col6,col7,col8), here's how you select all but one in Muldis D: $tab@{!bigcol4} ... and in SQL: SELECT col1, col2, col3, col5, col6, col7, col8 FROM tab Here's the canonical Muldis D for a summary per named attributes giving the count: $people@{#@count_per_age_ctry <- !age,ctry} ... and the SQL: SELECT age, ctry, COUNT(*) AS count_per_age_ctry FROM people GROUP BY age, ctry These are equivalent: 'x' ... versus: (SELECT 'x') (SELECT 'x' FROM dual) ... and: $tab1 ... versus: SELECT * FROM tab1 This code in an atomic statement will swap the values of 2 variables: $x := $y $y := $x Here's an example of an atomic stored procedure that performs and returns the result of a query; it uses a higher-order function: recipe count_heads (&$count : NNInt, $search : Text, $people ::= $fed.data.db1.people) { with value-filter filt (Bool <-- $topic : Tuple, $search : Text) { $.name like ('%' ~ $search ~ '%') } $count := r# ($people where ( $>search )) } Here's an atomic stored procedure example that demonstrates self-recursion: updater make_coprime (&$a : NNInt, &$b : NNInt) { with function gcd (NNInt <-- $a : NNInt, $b : NNInt) { $b = 0 ?? $a !! rtn( a => $b, b => $a mod $b round Down ) } $gcd ::= nlx.lib.gcd( $>a, $>b ) $a := $a div $gcd round Down $b := $b div $gcd round Down } See also http://mm.darrenduncan.net/mailman/listinfo for the 3 official public email lists that are specific to Muldis D and its implementations: "-announce", "-devel", and "-users"; just the latter 2 are for discussions. If you want a "homepage" url to link to, you can use http://www.muldis.com/ concerning this project or particularly its commercial support. And http://github.com/muldis/ is its main public GIT version control repository. Thank you in advance for any interest in or support for this project that you can give. Any kind of support is welcome, from trying to update your own projects to use Muldis D, or from contributing your time and expertise to improving Muldis D or its implementations or ancillary projects, or promoting this project in various media and forums. Support is welcome in providing significant financial sponsorship towards my further work, in which case you have more of a say in its direction and priorities. But mainly I want to see it get used to enrich projects and their users and developers. This project and ancillary projects are a serious endeavor that I intend to commercially support over the long term, and others can do likewise. Good day. -- Darren Duncan