lua-users home
lua-l archive

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


I personally think that having optional syntax is a Bad Thing (tm). While it may sometimes save a few characters it increases the risk of getting valid code in spite of making simple typos. That is already possible today with

a,b=1,foo(2) and a,b=1 foo(b)

which are both valid but do different things. A mandatory ';' would "cure" many things like this.

Unfortunately those hardest hit are those who least able to protect themselves. Clarity and consistency easily outweigh saving a few characters.

Robert

----- Original Message -----
> As a counterweight to your DSL example, I recall CMake
> disliking/rejecting Lua because commas would suddenly be required.
> 
> 
> 
> On 3/6/12, Lorenzo Donati <lorenzodonatibz@tiscali.it> wrote:
> > On 04/03/2012 0.59, Greg wrote:
> >>> Feel free to create a patch and use it yourself, but don't expect
> >>> a lot
> >>> of people to support losing such a core feature. Even if you
> >>> never say:
> >>>
> >>> foo "bar"
> >>>
> >>> or
> >>>
> >>> foo{ bar=1 }
> >>
> >>
> >> I agree that this is pretty nice.  It don't use it nearly as often
> >> as I
> >> use
> >> commas.  My average Lua file has over 200 commas and not many
> >> instances of
> >> foo{
> >> bar=1}.   I usually only this with require statements.  Ex:
> >> require
> >> "utils"
> >>
> >> - Greg
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> > I've almost got lost in the thread, but it seems no one has
> > mentioned
> > DSLs (Domain Specific Languages).
> >
> > Lua is awesome in this respect. Without being able to omit
> > parentheses
> > in the case of a single string/table, any Lua-based DSL would look
> > much
> > clumsier. Compare:
> >
> >
> > BeginSection [[news]]
> >    Link "C-programming" {href = "etc.", title = "a book on C"}
> >    Link "I love Lua" {href = "etc.", title = "an essay"}
> > EndSection()
> >
> > which is legal Lua syntax now, would become fairly ugly with
> > mandatory
> > parentheses!
> >
> > I wouldn't really forfeit this ability in exchange for the
> > "optional
> > comma": too big a loss for little reward IMO.
> >
> > Cheers.
> > -- Lorenzo
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> --
> Beginning iPhone Games Development
> http://playcontrol.net/iphonegamebook/
> 
>