My Official "More Programming Languages" Suggestion Thread

I know I’ve mentioned adding Python into GMod enough times around the block, but I never got around to actually making a suggestion thread, far as I can recall. So, I’m going to mention a couple of languages that shouldn’t (keyword: shouldn’t) be too much harder than Lua to implement. (Keep Lua too, for the sake of not losing every addon we have)

[ Python ]
Pros:

  • Ridiculously easy to read
  • Can do a lot of things
  • Interpreted, not compiled (like Lua)
  • OpenSource
    Cons:
  • For loops are a bit weird
    Other Notes:
    This is my first programming language of choice, so if it seems biased in Python’s favor, you might know why :stuck_out_tongue:

[ C/C++ ]
Pros:

  • Native Language of the Source Engine (iirc)
  • Probably easier to hook the GMod related crap into it
    Cons:
  • Compiled
  • Ridiculously hard to read
    Other Notes:
    I’m not sure how far “too far” is for C/C++, what with Source engine not being opensource, etc so forth. Also, we may have to be creative with the files, and if this were GMod’s third week ever or something, I’d doubt Garry’s creativity. But hey, we got Fretta, with it’s buttload of gamemodes, I’d think he’s creative enough.

Python is already implemented via gm_python. Oh, and Lua gets compiled.

Theres no point in adding C/C++ support really, as it will need compiling, and almost all extension modules we have are made in C or a variation of it.

It would be a waste of time adding support for it really. Though Python could work as an alternate language to Lua.

I thought it was interpreted. You sure about that?

Also compiled languages are bad for scripting because you can’t look at how people did something and make your own tweaks if you like. Much nicer to be able to look at the source code.

Lua gets precompiled into bitcode on initialise.

So if Garry were to say, switch to Python, we could have a faster loading time once all scripts have been loaded into memory? Instead of having to wait for it to be compiled (which seems to take no time at all anyway)

Faster loading time, more lag ingame.

Thought that would be the main downside.

You’d hardly notice it. It would be similar to calling the garbage collector manually every few milliseconds - you get 2 or 3 less FPS per frame, but no section of massive lag (Down to 5 FPS) when it gets called by the current system.

Oh, thats not as bad as I thought it would be actually. Problem with changing now is that we have so much done with Lua, and it would require that much more effort to integrate it with Source again.

It would be much easier just to use gm_python

That’s pretty interesting.

But what’s the difference between precompiling and compiling?

Lua is fine.

I think Java took the right approach compared with .NET - 1 language on many platforms rather than many languages on 1 platform (since all the .NET languages do the same thing).

Think of Lua as glue which lets you fiddle the C++ code almost directly, but is still pretty fast.

It is compiled into bytecode instructions before you enter the game, much like Java or .NET

How long has THAT been there?

It doesn’t have much by way of GMod functions, though. I suppose that’d be easy enough to fix (Python functions that act as wrappers for the Lua equivalents) though…

Java and .NET are one and the same. .NET is a framework which all it’s languages require (many (similar) languages on many platforms) while Java is just a runtime environment (one language on many platforms).

As far as I know, compiling saves the bytecode in executable format, whereas precompiling keeps the bytecode in RAM.

Thought it would be something like that.