Lua

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Lua

Post by Gez »

Graf Zahl wrote:Lua has a strong resemblance to Pascal. Which, by sheer coincidence also has a syntax I don't like. C's braces are really neat. They are just symbols. Structuring code with English language keywords just adds one more step the brain has to process before understanding the code.
Plus, it's easier for the parsers used by syntax highlighters to detect corresponding and/or mismatching parens (as a generic terms: (parentheses), [brackets], {braces}) than code words.

Some editors can also be configured to automatically insert the closing paren after the cursor when you type the opening one. I remember I got quickly used to this behavior when I used KWrite on Linux.
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

Re: Lua

Post by bagheadspidey »

Graf Zahl wrote:Structuring code with English language keywords just adds one more step the brain has to process before understanding the code.
Hmm, we could always translate keywords into german ;)
Spoiler:
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Lua

Post by randi »

I can't believe you guys are still discussing the Lua syntax. Since we're not using Lua ( :( ), it doesn't much matter, but: The structure isn't that much different from C except they opted to use English-like keywords instead of symbols. If you have no prior programming experience, which is going to be easier to learn: Symbols or words that probably already have some meaning to you?
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

Re: Lua

Post by bagheadspidey »

randy wrote:If you have no prior programming experience, which is going to be easier to learn: Symbols or words that probably already have some meaning to you?
I thought the same thing that I assume you mean here (words having more meaning than symbols for less experienced users), but judging from the response to this thread this may not be the case. And with that, I'll resign myself from the syntax discussion ;)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Lua

Post by Graf Zahl »

randy wrote:If you have no prior programming experience, which is going to be easier to learn: Symbols or words that probably already have some meaning to you?

Clearly symbols. The braces are universal and implicitly declare structure. This is something you can teach a child in 5 minutes and they will get it.

Words only declare something through their meaning. For non-English speakers this can be quite bothersome when learning to program. This can be particularly annoying with programming languages that have several different structuring elements which all use different keywords. But even if you understand the language the words are in well, you still have to process them, adding a completely unnecessary layer of comprehension to your programming work.

This ignores the uglier aspects of C-like syntax though which often negate this aspect of the language and lead to the conclusion that a language that is structured with keywords is easier to read.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Lua

Post by Gez »

randy wrote:If you have no prior programming experience, which is going to be easier to learn: Symbols or words that probably already have some meaning to you?
You may think words, but symbols, actually. Ever wonder why we have all these icons on our applications? Ever wonder why signs similarly use icons much more often than words?

Also, the code itself is words and numbers. Having parens rather than more words to structure it make the structures easier to see at a glance. Compare:

Code: Select all

if (blah)
blablabla=getblah();
blahblah++;
endif
blableblibloblu(blahblah);
with

Code: Select all

if (blah)
{
blablabla=getblah();
blahblah++;
}
blableblibloblu(blahblah);
And I won't even speak of how words are less reliable than symbols. You don't have to know the language to guess that a { will be closed by a }. But an if may be closed by an endif or by a fi, depending on the language.

I've done a fair amount of Morrowind scripting, which uses keywords, and I would have gladly traded all these EndIfs for pairs of curly braces. Easier to see, faster to type, and friendlier to syntax checkers.
User avatar
Cutmanmike
Posts: 11354
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Re: Lua

Post by Cutmanmike »

Not quite sure what you're talking about here because I have almost nil pogramming experience, but I prefer the second option you posted there.
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Re: Lua

Post by TheDarkArchon »

Symbols. Having worked with both BASIC and C(++), I can attest to the reading nightmare that is a BASIC program that even merely resembles complexity I.E the sort of thing I can do with my current level of C knowledge.
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: Lua

Post by DoomRater »

I dunno, I found the first example a bit easier to read. Had the symbols been used on the same line as the command (which, it seems, EVERYONE ELSE thinks is poor programming technique) I would have read it a bit more easily.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Lua

Post by Graf Zahl »

I think that was the point. The first example you have to consciously read each line to process its content. But in the second one the 2 braces immediately stand out, indentation or not.
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: Lua

Post by DoomRater »

No, I prefer grouping similar commands... these process much more easily for me. o_o
User avatar
Shadelight
Posts: 5113
Joined: Fri May 20, 2005 11:16 am
Location: Labrynna

Re: Lua

Post by Shadelight »

I'm going to go with symbols.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: Lua

Post by Kate »

I'm used to indentation as a guide, so I can do either as long as it's done correctly. =P I read words more quickly though, the symbols I just wind up filtering out so I wind up having to re-read the same few lines to notice braces, most especially if they're not on their own line (which is very common, even in my own code). A combination of this can make it a nightmare to find a mismatched set of braces.
User avatar
Necromage
Posts: 484
Joined: Thu Feb 10, 2005 3:13 pm
Location: NJ
Contact:

Re: Lua

Post by Necromage »

I am in the middle with this one. Having spent my productive high school math classes doing nothing but messing around with the basic on the ti-83 I am pretty used to processing words. However, working with c/c++ I like using the braces. One thing I can't stand though, is the java indentation of:

Code: Select all

if(true) { //the open brace is here
    callsomefunction();
}//close brace
It just drives me insane.

The problem for with lua isn't the use of english words, its how the language is constructed all together. It just looks like a horrible mix of spaghetti code that I cannot follow.
User avatar
Nash
 
 
Posts: 17505
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Lua

Post by Nash »

Randy's already said that he's not going to implement Lua into the script (complete with a :( emoticon) so I think the discussion is pretty much over already...
Locked

Return to “Editing (Archive)”