lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Somehow I prefer old Lua way of table/dict.

You can still wrap your table literals in { }, if you do then
whitespace is ignored for the entries in the table. This works
perfectly fine:

    collection = {
      height: 32434
      hats: {
        "tophat",
        "bball",
        "bowler"
      }
    }

Just note that = is no longer used to define key-value pairs in table
literals, it's : instead.
Also you had a typo in your example, you left off a comma after one of
the key value pairs. That's not a problem in moonscript because either
commas or newlines can be used to delimit entries.

On Fri, Aug 12, 2011 at 9:28 AM, Gopalakrishnan Subramani
<gopalakrishnan.subramani@gmail.com> wrote:
> Somehow I prefer old Lua way of table/dict.
>
> local collection = {
>   height = 32434
>   hats = {
>     "tophat",
>     "bball",
>     "bowler"
>   }
> }
>
> Over this below
>
> collection =
>   height: 32434
>   hats: {"tophat", "bball", "bowler"}
>
> No assumption with indentation please. I am already dying programmer with
> Python. Make them enclosed with  '{' & '}'
>
> Others stuffs I liked. I will play around this weekend.
>
>
> We have 100 MBs of configuration in XML. When I open the tag, I would only
> see more of tags than the data. I am thinking over moving them to Lua.
>
> Now when moonscript is made right, it would still simplify the readability.
>
> You have great inspiration and you are original leader Leaf. I appreciat the
> effort very much.
> I wish, moonscript to be general purpose DSL language for the clean syntax,
> easy configuration.
>
> --
>
> Gopalakrishnan
>
>
>
> On Fri, Aug 12, 2011 at 9:12 AM, leaf corcoran <leafot@gmail.com> wrote:
>>
>> http://moonscript.org/reference/#conditionals
>>
>> On Thu, Aug 11, 2011 at 8:42 PM, HyperHacker <hyperhacker@gmail.com>
>> wrote:
>> > On Thu, Aug 11, 2011 at 21:14, oliver <oliver.schoenborn@gmail.com>
>> > wrote:
>> >> On Thu, Aug 11, 2011 at 9:57 PM, Miles Bader <miles@gnu.org> wrote:
>> >>>
>> >>> Steve Litt <slitt@troubleshooters.com> writes:
>> >>> > I'm a Lua guy, but I prefer locals by default and grouping by
>> >>> > indentation, if I had my druthers (which of course I never will).
>> >>> > Here's why I prefer grouping by indentation:
>> >>> >
>> >>> > http://www.troubleshooters.com/tpromag/199908/index.htm#_readability
>> >>>
>> >>> Indeed, those features are perfect for trivially tiny example programs
>> >>> ... :]
>> >>
>> >> Actually, trivially tiny example programs are the only place that
>> >> unindented
>> >> code makes sense. Any real code relies on indentation to help coder
>> >> visualize its block structure.  So to make indentation a requirement
>> >> for
>> >> code is "forcing" you to do something you already have to do for
>> >> anything
>> >> more than trivial programs.
>> >> Good unit testing, naming convensions, logical structure,
>> >> encapsulation, and
>> >> language tools (syntax highlighting, lint, code formatter, etc) matter
>> >> way
>> >> more than white space.
>> >>>
>> >>> Gotta wait until all the python programmers are dead I suppose...
>> >>>
>> >>>
>> >>>
>> >>> -miles
>> >>
>> >> This kind of comment is unacceptable on a public forum. Many
>> >> programmers
>> >> know more than one programming language. Think of that next time you
>> >> post.
>> >> Oliver
>> >>
>> >
>> > Except it forces indentation and structure in cases where it's not
>> > entirely necessary. I like being able to write:
>> > if x then doThings(x) else doThings(y) end
>> > instead of:
>> > if x then
>> >    doThings(x)
>> > else
>> >    doThings(y)
>> >
>> > --
>> > Sent from my toaster.
>> >
>> >
>>
>
>