Page 2 of 4

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Fri Aug 02, 2013 3:15 am
by T-Bone
The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Fri Aug 02, 2013 3:26 am
by Xgoff
T-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
uh... there's no reason they can't (lua's parser has no problem doing it). they just don't for some reason

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Fri Aug 02, 2013 9:44 am
by mickeyjm
T-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
Notpad++ does it for me, I've never had to worry about that

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Fri Aug 02, 2013 4:16 pm
by T-Bone
mickeyjm wrote:
T-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
Notpad++ does it for me, I've never had to worry about that
Really? Notepad++ has never done that for me. Did you use some add-on or something?

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Sat Aug 03, 2013 10:19 am
by mickeyjm
T-Bone wrote:
mickeyjm wrote:
T-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
Notpad++ does it for me, I've never had to worry about that
Really? Notepad++ has never done that for me. Did you use some add-on or something?
Nope, just set the language to Lua

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Sun Aug 04, 2013 7:29 am
by T-Bone
I realize now that it marks blocks on the left with those blue and red lines, which is definitely good enough. What I was talking about was what it does with parentheses, where if you click on one parenthesis it will highlight the matching one. Highlighting an "if" will not highlight the corresponding "end", which is a pity, but not something you can't live without.

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Mon Aug 05, 2013 9:10 am
by Lafolie
Python has always fascinated me with it's syntax, and I generally prefer its methods of code blocking. On-topic though, it has to be brackets. Lua is fantastic in that it's so readable and user-friendly, but the lazy brogrammer in me feels somewhat belittled by having to use "then" and things like lack of "+=". Bartbes wrote a script that almost pre-pre-compiles your files to add "+=" functionality, I suppose in theory you could do the same and more (Moonscript for example, though I'm too lazy to go and see how this was implemented right now).

As hinted at previously, I do feel that "then/do/end" have a rightful place in Lua, because they are appropriate, simple and help with readability.

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Mon Aug 05, 2013 1:04 pm
by Mikaboshi
I'd probably go with the style guide for Ruby:
  • do, end for multi-line blocks
  • { } for single-line blocks
For example, you might have something like

Code: Select all

(1..10).select {|num| num.even?}
=> [2, 4, 6, 8, 10]
Which isn't really more hard to understand than

Code: Select all

(1..10).select do |num|
  num.even?
end
=> [2, 4, 6, 8, 10]

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Mon Aug 05, 2013 6:40 pm
by SeducingOrange
I like pythons aproache to this the best though. It's really good for beginners because it forces you to use good coding standards (you would format your code like that anyway, right?) and it's functional by not having to have an extra keyword or {}.

Re: [POLL] Do you like "then,do,end" or "{ }"?

Posted: Mon Aug 05, 2013 6:42 pm
by SeducingOrange
Lafolie wrote:Python has always fascinated me with it's syntax, and I generally prefer its methods of code blocking. On-topic though, it has to be brackets. Lua is fantastic in that it's so readable and user-friendly, but the lazy brogrammer in me feels somewhat belittled by having to use "then" and things like lack of "+=". Bartbes wrote a script that almost pre-pre-compiles your files to add "+=" functionality, I suppose in theory you could do the same and more (Moonscript for example, though I'm too lazy to go and see how this was implemented right now).

As hinted at previously, I do feel that "then/do/end" have a rightful place in Lua, because they are appropriate, simple and help with readability.
I agree with everything you said