• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

I'm really enjoying in-line functions

CobraA1

Member
I'm really enjoying in-line functions in the 2.3 beta. Being able to do something like controller.endTurn(); is great!

It baffles me how long it took for this to happen; it always seemed like a good inclusion, and it reflects how other languages work. Same with structs, which I expect I'll be using as well when I need something more lightweight than objects.

GameMaker is a joy to use now, and it really feels as if this alone makes the language feel a lot less like a "quirky" game development engine where you need to work around strange limitations. Granted, it still has its quirks, but this really allows me to structure my code so much better.
 

Rob

Member
I'm really enjoying in-line functions in the 2.3 beta. Being able to do something like controller.endTurn(); is great!

It baffles me how long it took for this to happen; it always seemed like a good inclusion, and it reflects how other languages work. Same with structs, which I expect I'll be using as well when I need something more lightweight than objects.

GameMaker is a joy to use now, and it really feels as if this alone makes the language feel a lot less like a "quirky" game development engine where you need to work around strange limitations. Granted, it still has its quirks, but this really allows me to structure my code so much better.
I haven't used 2.3 yet - is that a struct that calls a script?
 

kburkhart84

Firehammer Games
I'm really enjoying in-line functions in the 2.3 beta. Being able to do something like controller.endTurn(); is great!
I also like the new features....but just FYI....an "in-line" function is not what you think it is. You are referring to functions that are declared as referenced by variables in objects. An "in-line" function is one that you can use a gml_pragma line and (only for the YYC AFAIK) the compiler will take the code and put it in place of the function call, very similar to a macro.
 

ZeDuval

Member
I also like the new features....but just FYI....an "in-line" function is not what you think it is. You are referring to functions that are declared as referenced by variables in objects. An "in-line" function is one that you can use a gml_pragma line and (only for the YYC AFAIK) the compiler will take the code and put it in place of the function call, very similar to a macro.
Inline function can mean different thing. In a JS context for example, it's a function, that get's created at runtime and is being saved to a variable. An anonymous inline function doesn't even get saved at all, but gets provided as argument to another function, being created and used there on the fly.

I guess that's more or less what @CobraA1 meant.
 

kburkhart84

Firehammer Games
Inline function can mean different thing. In a JS context for example, it's a function, that get's created at runtime and is being saved to a variable. An anonymous inline function doesn't even get saved at all, but gets provided as argument to another function, being created and used there on the fly.

I guess that's more or less what @CobraA1 meant.
I've actually heard of that definition...but I wanted to clarify because gml_pragma("forceinline"); forces a script to be in-lined, the way I'm referring to. That said...I wonder how that will work in 2.3, with multiple functions being declared in a single script. I'll have to look into that.
 
Top