Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411658 Posts in 69395 Topics- by 58451 Members - Latest Member: Monkey Nuts

May 15, 2024, 09:48:59 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Why did I ever use game maker? Oh... Why?
Pages: 1 [2]
Print
Author Topic: Why did I ever use game maker? Oh... Why?  (Read 6871 times)
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #20 on: April 07, 2010, 02:28:32 PM »

well, gml is more in the delphi tradition than the c++ tradition; it's not as if every single programming language uses scopes the same way, and i don't see any particular reason to follow what's most common just because it's most common. in delphi, you use 'var' to define local variables, like in game maker.

also remember that gml (and game maker) is about 15 years old. expecting it to work like modern programming languages do doesn't make that much sense in that context.
Logged

PGGB
Level 8
***



View Profile
« Reply #21 on: April 07, 2010, 03:02:06 PM »

also remember that gml (and game maker) is about 15 years old. expecting it to work like modern programming languages do doesn't make that much sense in that context.
15 years isn't really old for a programming language. Ruby is that old. Python even older.
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #22 on: April 07, 2010, 03:06:49 PM »

of course, but those are just examples of how different languages handle scope differently. in ruby for instance, i believe using a $ to begin a variable name makes it global, otherwise it's local.
Logged

Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #23 on: April 08, 2010, 12:15:15 AM »

of course, but those are just examples of how different languages handle scope differently. in ruby for instance, i believe using a $ to begin a variable name makes it global, otherwise it's local.

I added some emphasis to illustrate that that makes the Ruby way a conscious, consistent and expected design decision, as opposed to a horrible wart full of gotcha.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #24 on: April 08, 2010, 12:50:06 AM »

gml is consistent too -- there are three scopes: global, instance, and script. variables are instance unless otherwise defined: var for script, and globalvar for global. this is all in the manual. i think the reason he got caught with this problem is that he didn't read the manual and expected it to work like the c family of languages instead of the delphi family.
Logged

muku
Level 10
*****


View Profile
« Reply #25 on: April 08, 2010, 10:00:30 AM »

If I understand the discussion right, what GML does is basically dynamic scoping, which used to be popular in very early programming languages but fell out of grace shortly after ALGOL introduced lexical scoping in, oh, the mid-1950s or so. In Common Lisp you can still have it if you want, but you have to explicitly ask for it. Apart from that, not many languages support that nowadays because it's generally agreed that the "other" way (lexical scope) is way better.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #26 on: April 08, 2010, 01:00:07 PM »

So if you define a variable in a function in gml, it is still the same variables as another one from the same script? Appalling. Your apologist stance to gml gets me quite Angry sometimes. Aside from gaping differences between gml and delphi, it's hardly a plus to say it is in the delphi (pascal) family - that seems pretty dead, and it's not spawned many variations.

Javascript recently gave up on function level scoping, semi-deprecating the var keyword in favour of let. C's scoping rules are popular because they are good - I do believe in a trade off of complexity & power vs ease of use, but that doesn't mean there aren't decisions that are just plain bad.
Logged
bateleur
Level 10
*****



View Profile
« Reply #27 on: April 08, 2010, 11:30:41 PM »

In some cases it's more a question of what one considers good programming style.

I quite like the function level scoping in Actionscript (which is essentially Javascript) because it lets me write code like this:

Code:
 function calculateSomething(input:SomeType):AnswerType {
  if (...) {
   while (...) {
    if (...) {
     var result:AnswerType = <some expression we now know is safe to evaluate>;
    }
   }
  }
  return(result);
 }

...which I know from experience causes some people to throw up their hands in horror, but is actually cleaner and (arguably) more comprehensible than a separate local declaration at the top of the function.

It doesn't cause any real harm except some stupid compiler errors when you forget and declare the same temporary loop variable twice in the same function.

It also stops the kind of stupidity one occasionally sees in C/C++ where some enthusiastic programmer has "cleverly" reused the same local variable names dozens of times resulting in code which is impossible to read because you can't work out which of the many incarnations of 'tmp' you're actually looking at without scrolling up and down to discover your context.
Logged

Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #28 on: April 09, 2010, 12:38:45 AM »

Code:
 function calculateSomething(input:SomeType):AnswerType {
  if (...) {
   while (...) {
    if (...) {
     var result:AnswerType = <some expression we now know is safe to evaluate>;
    }
   }
  }
  return(result);
 }

Is result placed on the global namespace, or is it placed in something like a "local global namespace" with global visibility in the current function only? What is returned if the conditional fails and result is never initialised? Crash? Undefined? Or a default-initialised object returned? Is THAT placed in the the global namespace? If result is placed in the global namespace, why is it returned rather than just accessed from outside? And doesn't this mean that we have several conflicting scoping and persistence rules at the same time (global, local, procedure)? This too seems more like a stew of horror than any kind of (non-macabre) elegance to me.
« Last Edit: April 09, 2010, 12:41:48 AM by Mikademus » Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
bateleur
Level 10
*****



View Profile
« Reply #29 on: April 09, 2010, 12:44:35 AM »

This too seems more like a stew of horror than any kind of (non-macabre) elegance to me.

Well no, not at all, because every single question you asked is not something an AS3 programmer would ever need to ask.

In case you're curious, the value of the variable is null until set otherwise and its scope is the containing function.

(There is a legitimate argument against languages that allow null as a typed value, but since that's virtually every modern language I don't imagine anyone cares much.)
Logged

Kadoba
Level 3
***



View Profile
« Reply #30 on: April 09, 2010, 06:18:25 AM »

So much hate for GML from people who don't use it.  Beg Game Maker was designed as a learning tool before anything else so GML was intended to be as simple as possible. Things like rigid scoping and typing help in a lot in complicated languages to keep things clean and streamlined but it has no place in GML. Most of the advanced stuff that is a nightmare when it breaks is automatically handled for you. GML is like a sandbox. You can plug and snap anything into anything else with a high probability that it will be a complete mess but it's so easy and painless to clean up. Things like refactoring entire object systems takes minutes and not hours or days.

All of this goes against disciplined programming but GML wasn't made for programmers; It was made to be intuitive. I'm not saying GML is perfect but it works very well within the context of game maker.
Logged
muku
Level 10
*****


View Profile
« Reply #31 on: April 09, 2010, 06:49:22 AM »

So much hate for GML from people who don't use it.  Beg Game Maker was designed as a learning tool before anything else so GML was intended to be as simple as possible. Things like rigid scoping and typing help in a lot in complicated languages to keep things clean and streamlined but it has no place in GML.

Eh? This very thread exists because a GM user was utterly surprised by GML's quirky scoping rules. There is something called the "principle of least surprise" which should, if anything, apply even more strongly to languages created for non-professional programmers, not less.
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #32 on: April 09, 2010, 07:02:57 AM »

but he was only surprised because he was pretty good at programming before starting to use gm, and found things counter-intuitive compared to his programming experience. gm is not intended to be a beginner's tool if you already know programming, it was intended to be a tool for non-programmers. the stuff he was confused about would *never* confuse someone who wasn't already familiar with programming. a non-programmer wouldn't expect gml to act in the way that he expected it to act, because he'd have no preconceptions as to what particular way a programming language "should" do something.
Logged

BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #33 on: April 09, 2010, 09:28:53 AM »

The funny thing is that I used GM for 3 years before I moved on to real programming.  Durr...?
Logged

Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #34 on: April 09, 2010, 10:04:05 AM »

Eh? This very thread exists because a GM user was utterly surprised by GML's quirky scoping rules. There is something called the "principle of least surprise" which should, if anything, apply even more strongly to languages created for non-professional programmers, not less.

but he was only surprised because he was pretty good at programming before starting to use gm, and found things counter-intuitive compared to his programming experience. gm is not intended to be a beginner's tool if you already know programming, it was intended to be a tool for non-programmers. the stuff he was confused about would *never* confuse someone who wasn't already familiar with programming. a non-programmer wouldn't expect gml to act in the way that he expected it to act, because he'd have no preconceptions as to what particular way a programming language "should" do something.

First, for the sake of argument, let's accept your argument as a possible truth. Then the GML design is disingenuous if not outright nefarious because it will instil bad and dangerous habits and create false expectations of programming, and you must be malicious for defending or promoting it (if that's what you do). Now, let's instead see your argument as flawed. Because any time you design something in such a way that it will only be sensible for people without any prior experience (or "sense" as we can also understand it), or put in another way, designed so that you have to lay aside or redefine the term "sense" for the design to be "sensible", then you have become a charlatan, since you're trying to pass off something senseless as sensible to those gullible through ignorance, and by sophistry masquerading as profound trying to confound those experienced. Do you really want to peddle snake oil?

The principle of least surprise is bigger than this. A person that has never owned a home may accept that his house keys also unlocks the caravan and car at the same time. A house owner might not accept that his caravan keys unlocks his house when he opens the caravan door. The principle of least surprise is also about responsibility, and every time we make something someone else will or must use, we should take responsibility. That is why I agree with Muku that anything intended for beginners have to take even more responsibility. Pascal was for some time the first language of choice in education, and it taught good programming habits and created very little confusion or surprise for the beginners. From what I've seen GML is a much more unfortunate first language.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic