Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

   a { ... }
and

   i "next"
are not table elements, they are function applications.

All of your examples use more magic characters than the Lua example I gave.



The HTML::AsSubs example uses functions and works exactly (see [1]) the same way your Lua code does.

The first set of examples are just to show that you can model HTML data within common Hash/Array literals available in most languages.

re: magic characters - The perl6 example does use some extra shortcut niceties :) However the perl5 example will actually work unchanged in perl6. The Ruby example is only slightly different to perl5 because it uses symbol sigil (Perl like Lua allows barewords on LHS of a table/hash key assignment).

[1] - The only difference is the Lua a() function receives all its content via a single Table. Whereas HTML::AsSubs a() is a variadic function and uses the Hash literal {} for assigning HTML attributes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: