• Gwilty's Programming Assignments #1
    355 replies, posted
[QUOTE=NorthernGate;33012780]I didn't quote that post, I quoted [url=http://www.facepunch.com/showthread.php?p=33009729#post33009729]this one[/url][/QUOTE] Well yeah, but that was after Garry insulted him. They're both grownups and I doubt they care at this point.
[B]Stop making a big deal out of nothing.[/B]
[QUOTE=Lexic;33011332]wuh? I said Lua supports not putting brackets around your ifs, but that doesn't mean you have to not put brackets around them.[/QUOTE] I really don't get what you're moaning about? [editline]28th October 2011[/editline] [QUOTE=subenji99;33011709]It's not syntactically perfect Lua, but that was never the objective.[/QUOTE] But it is :/
[QUOTE=gparent;33012810]Well yeah, but that was after Garry insulted him. They're both grownups and I doubt they care at this point.[/QUOTE] [quote=me]jA_cOp wasn't exactly being pleasant in his remarks. I just didn't think it was necessary to talk like that [b]no matter what the other person was saying[/b][/quote] But I digress.
Seriously? You guys are arguing over if parenthesis? ..Why?
[QUOTE=DeadKiller987;33013550]Seriously? You guys are arguing over if parenthesis? ..Why?[/QUOTE] Didn't you know? You win a prize if you can prove me wrong!
[QUOTE=garry;33013358]I really don't get what you're moaning about?[/QUOTE] I think he was agreeing with you
[QUOTE=garry;33013358]I really don't get what you're moaning about?[/QUOTE] In fact I was agreeing with you and defending your teaching methods since I use them myself but hey, you're welcome to automatically assume I'm being a twat. It is your forum after all.
I can't post within the proximity of Garry without the fear of getting banned, so maybe this is all some kind of 'I disagree with Garry, look at my e-peen size!'
I think people are just getting restless because they don't have a new assignment yet. :P
Make a new assignment, just pretend today is sunday.
I think the point people are trying to make is that yes, Lua supports some things from other languages and semicolons after statements and all that crap but that doesn't mean you NEED to use them. [lua]local x = ( x + 1 ); local x = x+1[/lua] It literally does not matter how you write it, both methods work. What it comes down to is personal preference (something that you really shouldn't bother teaching - people will eventually form their own opinions of what looks and works best). I personally hate when people use redundant brackets in lua since something as simple as x + 1 doesn't need brackets. Same goes for excessive use of other brackets and semicolons. If it's your habit to do that then so be it, but just because Lua doesn't flip out when it sees a semicolon doesn't mean that you should be using semicolons. If you're trying to make Gwilty proficient with multiple languages then teaching him practices like appending semicolons and proper use of brackets is fine, if you're teaching him the ins and outs of Lua then you should at least be explaining what aspects of programming are important in Lua. Semicolons and redundant brackets aren't really important.
Why you think I told Gwilty that you have to use brackets? Because I drew them on the paper?
[QUOTE=garry;33013649]Didn't you know? You win a prize if you can prove me wrong![/QUOTE] Is the prize a ban? (note that this isn't a request)
[QUOTE=chimitos;33016177]Is the prize a ban?[/QUOTE] I thought it was a motor boat.
[QUOTE=garry;33015329]Why you think I told Gwilty that you have to use brackets? Because I drew them on the paper?[/QUOTE] Not sure exactly what you told him, just giving my angle on the matter. I had a lot of professors who were 'programming style zealots' and it made me appreciate the ones that didn't go into sperg-rants over why using more/less whitespace is good etc.
[QUOTE=garry;33015329]Why you think I told Gwilty that you have to use brackets? Because I drew them on the paper?[/QUOTE] Yes.
[QUOTE=jA_cOp;33009729]I guess a somewhat rational response was too much to ask from your massive ego? I'm pretty sure you kinda are teaching him to be a "Lua syntax asshole" by teaching him cargo cult programming Lua syntax because of your own nonsensical, redundant syntax habits. It's not that the habit is particularly destructive, it's just terribly unfortunate that you're [I]teaching[/I] it.[/QUOTE] Sorry I keep reading your posts and I just have to. ja_cOp, [b]shut the fuck up[/b]. Get fucking laid dude. I get your point and its valid (although Garry's reason was also completely logical as well), but you expressed it in such an offensive, anti-social, and hostile way that being hostile back is the only rational reaction. This applies to pretty much every one of your posts. [QUOTE=gparent;33011199]You're basically preaching A and doing B. Or rather, preaching A, but when someone else calls you out on a different aspect of A, he's an asshole to be ignored. Just feels odd to me, and a superiority attitude like that is detrimental to your final goal (teaching Gwilty how to program). Really, that's the most important part. Maybe it's just me but as a student, details mattered. Being consistent in their teachings was my favorite aspect of my best teachers. As for the argument, jA_cOp is entirely correct, but I feel he is capable of arguing for himself. Who went into full attack mode? He made an innocuous comment and got called an asshole for it. It still is, I feel we're being civil. If that's not the case then Garry can just tell us to shut up and we'll move on. Using the syntax of the language you're using without accidentally (or purposely) using another language's practices is a very useful skill that will be part of his career too.[/QUOTE] He's preparing him for C. Your argument is invalid. But lets dive into this trivial crap anyway: I've always put () around my conditions because it separates the expression from the if and then. Another huge reason is because A) it doesn't matter and B) C/C++/Java use this style and there's no point in changing from it. [highlight](User was banned for this post ("Flaming" - Hexxeh))[/highlight]
[QUOTE=Slight;33017391] ja_cOp, [B]shut the fuck up[/B]. Get fucking laid dude. [/QUOTE] Haha oh god are we in sixth grade again? It sure feels like it.
[QUOTE=Mr. Smartass;33018186]Haha oh god are we in sixth grade again? It sure feels like it.[/QUOTE] No, this is a Black Ops lobby. (i.e. 4th grade.)
Sorry to continue but I just don't get this argument of trying to shoehorn in 1 really minor c style syntax because you might be moving on to it next, not least because if you're learning lua you should learn lua, and if you want to learn c then learn c. Really the fact that those parantheses don't do anything mean it really doesn't matter whether you use them or not, but regardless of how you write lua in your own time, this is really basic common sense stuff that we should all be able to agree on as programmers.
I don't know if Garry actually told Gwilty to use parentheses around conditional statements or not, but its actually a good idea for the final goal (teaching him to program). Using Lua script as an educational stepping stone is, in my opinion, a smart move. But Lua isn't programming, its scripting... and down the road when Gwilty steps into a language that isn't as free-form as Lua, he'll be confused as to "why did these conditional statements work before and now they error?". His goal is to program, not write Lua script. And let me add that everyone arguing about Garry marking parentheses on the paper are idiots. Are you some sort of scripter hippies? Trying to prove some point about letting the code be free and not blocked in by some sort of fascistic parentheses government? Seriously, do you ever look back and read what you're arguing about?
I'll round some questions up here first since a lot of people repeated the same things: [quote]You didn't have to be an asshole about it.[/quote] Yeah, sorry about that. I wish Garry hadn't been an asshole about it first. [quote]Why are you arguing about some extra parentheses?[/quote] If it's not important to you, feel free to ignore the conversation. [quote]But C style languages use parentheses, and he's being prepared for a C style language in the future![/quote] This is the argument I don't like and the reason this is an issue. Lua is not a C style language. The only reason putting the redundant (both for the machine and the reader) pair of parentheses works is that they're part of the expression syntax, not the if statement syntax, which it is in most C-style languages. It's exactly like marking down someone for not writing if([highlight]([/highlight]condition[highlight])[/highlight]) in C. I touched upon it only slightly in my initial post, but the reason I don't think this should be encouraged is that you should concentrate on writing idiomatic code in your current language and think in that language's terms and syntax when dealing with that language. I remember one Gmod Lua coder who thought the "then" keyword was stupid and redundant because he always put parentheses anyway... There are no disadvantages to not putting the redundant parentheses. In C, the if statement starts with the if keyword followed by an open parenthesis, and the contained statement starts immediately after the closing parenthesis for the condition. In Lua, the if statement, completely incidentally, starts with the if keyword, but the contained block starts immediately after the closing then keyword. This difference is immediately apparent if you start using C with a Lua background, and if you forget to put the parentheses in C you'll simply get a compile error. Lua was designed to be readily usable by non-programmers, which explains a lot of their design choices. The language was designed to use as few "magic" symbols as possible - the logical "and", "or" and "not" operators are simply called "and", "or" and "not" etc. The syntax is a lot more uniform if you stick to this inherent style. [QUOTE=HeroicPillow;33009867]What i've gathered from all of this, is that garry physically sat down and explained pretty much all portions of the code that qwilty wrote. In doing so explaining things to look out for when he eventually steps into the wide world of different languages and the various syntaxes that most modern languages adhere to. So he only used the markings on the paper as a visual aid to what he explained to gwilty, and his actual explanation could have been (it most likely was) far more useful.[/QUOTE] This argument would have more weight if it wasn't for the fact that Garry replied before you and didn't confirm it, and the fact that Garry has used the extraneous parentheses in his Garry's Mod Lua code since forever. He also modded Lua to include the alternative tokens "&&", "||" and "!=" instead of "and", "or" and "~=", making Gmod Lua more C-like than standard Lua. [QUOTE=HeroicPillow;33009867]For example, he could have said, "While not having parenthesis around your if statement is still able to compile under Lua, you will have problems with it down the road when you eventually go on to learn C based languages or Java."[/QUOTE] Firstly, this is a distorted view of it - "still able to compile" indicates that this is some kind of special case. In fact, it's due to the simple fact that the Lua if statement syntax [I]does not have parentheses at all[/I], it just happens to work because like in C style languages, you can use parentheses to create a "parenthesis expression". Secondly, what problems, exactly? C syntax is different from Lua syntax. You won't get far at all without recognizing this difference when learning C. [QUOTE=HeroicPillow;33009867]The final goal is to make Gwilty a good programmer with the means to learn and adapt to most languages, as well as hold his own.[/QUOTE] Putting extraneous symbols in your Lua code does not help you learn C. It's just a bad habit programmers from a C-style language have when learning Lua - and thus propagate it by the effects of cargo cult programming. [editline]29th October 2011[/editline] [QUOTE=foszor;33020461] Using Lua script as an educational stepping stone is, in my opinion, a smart move. But Lua isn't programming, its scripting... and down the road when Gwilty steps into a language that isn't as free-form as Lua, he'll be confused as to "why did these conditional statements work before and now they error?".[/QUOTE] Scripting is just a special kind of programming. And even then, you're not scripting when using LÖVE, because LÖVE is just a framework. It's like saying you're not really programming, just scripting, when using C#/XNA. [QUOTE=foszor;33020461]And let me add that everyone arguing about Garry marking parentheses on the paper are idiots. Are you some sort of scripter hippies? Trying to prove some point about letting the code be free and not blocked in by some sort of fascistic parentheses government? Seriously, do you ever look back and read what you're arguing about?[/QUOTE] No, I'm trying to prove a point that [I]teaching[/I] a bad programming habit is absurd. [editline]29th October 2011[/editline] [QUOTE=garry;33011242]Why does it support them if they're not to be used?[/QUOTE] You can write all your C-style code using if(((condition))) as well. C "supports" it just fine.
Yeah fuck this, you fucking nerds.
Sorry, you need to Log In to post a reply to this thread.