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

General discussion about LÖVE, Lua, game development, puns, and unicorns.

Do you like "then,do,end" or "{ }"?

"then,do,end" is just fine
36
82%
"{ }" would be better
8
18%
 
Total votes: 44

User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

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

Post 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.
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

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

Post 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
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

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

Post 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
Your screen is very zoomed in...
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

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

Post 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?
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

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

Post 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
Your screen is very zoomed in...
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

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

Post 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.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

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

Post 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.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Mikaboshi
Prole
Posts: 12
Joined: Mon Jul 22, 2013 8:55 pm

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

Post 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]
SeducingOrange
Prole
Posts: 30
Joined: Tue Feb 12, 2013 7:45 pm

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

Post 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 {}.
SeducingOrange
Prole
Posts: 30
Joined: Tue Feb 12, 2013 7:45 pm

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

Post 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
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests