[Dbix-class] fyi, official terse Muldis D dialect for daily work

Matt S Trout dbix-class at trout.me.uk
Mon Jan 14 07:49:56 GMT 2008


On Sun, Jan 13, 2008 at 06:40:21PM -0800, Darren Duncan wrote:
> I still have to work out the details of the new dialect, but here's 
> an example of how Muldis D code in the terse dialect could look; 
> compare this 'square' function with the other email:
> 
>     [ 'function', 'square', '', [
>         [ 'inner_function', '', {
>             'result_type' => 'UInt',
>             'params' => {
>                 'topic' => 'Int',
>             },
>             'root_expr' => '',
>             'exprs' => {
>                 '' => [ 'sys_func', 'Int.power', {
>                     'radix' => [ 'param', 'topic' ],
>                     'exponent' => [ 'Int', 'perl_int', 2 ],
>                 } ],
>             },
>         } ],
>     ] ]

Uint function square (Int topic) {
  Int.power (topic, Int 2);
}

That's terse. Yours is not. So far as I can tell mine is pretty much
equivalent. With a bit of perl optree parsing (and Devel::Declare) you
could perl-host this as

Uint function square (Int $topic) {
  Int->power($topic, Int 2);
};

which isn't quite as elegant but is definitely parseable :)

Food for thought, anyway.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list