Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Which programming language did you choose and why?

GarrisonFjord

Guest
Catacombs
Sorry if I was a bit abrupt (well, I am).

It's just an abstract wish. There can't be such a thing.
To have large collection of libs, it must have widespread use.
If it's widespread, many people want to add features to it.
=> core language gets bigger & bigger (see C++).

Large collection of libraries:
C, C++, Python, JavaScript, Java platform, .NET framework
Small core language:
Python initially. C because it is not really evolving along with CS.
All new and/or small languages, as long as they don't see much use.
(^ This last category is interesting, but largely useless (Go is closer to that).)

Not even Python will fit the bill: so popular => so many feature proposals.
 

Silly Germans

Guest
Python is also fairly popular in chemistry and physics for "small tasks", like converting file formats, changing units and stuff like that. You can also see many plots in publications that were made with the matplotlib package. There are also some quantum chemistry packages that use python, although most of the heavy lifting is typically done by wrapped fortan, c or c++ code. But I think the utility vs time-to-learn ratio is very good for python, especially if programming isn't your main profession.
 

Silly Germans

Guest
Python is also fairly popular in chemistry and physics for "small tasks", like converting file formats, changing units and stuff like that.
Bash scripts also accomplish these small tasks, fwiw.
With small tasks i also mean simple numerical manipulations, not just trivial text processing. Say a Fourier transform of a temporal data set or transforming coordinates via matrix multiplication. Or fitting data, calculating averages and so on. Many of these things are very easy to do with python in a readable manner. And with modern desktop machines you are barely limited by hardware when it comes to these tasks. The low-level abilities of c++ to manage resources are barely needed in these cases. The simpler syntax and the availability of good packages for python eases the workflow by a lot and picking it up is fairly easy.
I would even say that it is easier to learn python than to learn bash, unless you are already an experienced linux user.
 

GarrisonFjord

Guest
I would even say that it is easier to learn python than to learn bash, unless you are already an experienced linux user.
Definitely agree. As far as I'm concerned, shell scripts are illegible.
+ Python is cross-platform.
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,229
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.
+ Python is cross-platform.

FWIW Bash is also cross platform, i use it all the time on Windows ever since the original MSYS days (now i'm using MSYS2 which has ported a ton of useful command-line utilities from Linux, essentially giving you a Windows-native Unix-like environment). If anything i never bothered with PowerShell because of Bash :-P.
 

GarrisonFjord

Guest
+ Python is cross-platform.

FWIW Bash is also cross platform, i use it all the time on Windows ever since the original MSYS days (now i'm using MSYS2 which has ported a ton of useful command-line utilities from Linux, essentially giving you a Windows-native Unix-like environment). If anything i never bothered with PowerShell because of Bash :-P.
Can't disagree.
I've used MinGW/MSYS and Cygwin in the past.
I hear there is also a Windows Subsystem for Linux now.
But still consider them as overhead* and would not use myself anymore.
(*vs an interpreted language like Python (which may already be installed)).

But yes, whatever works for each person. These are just my preferences.
 
Joined
May 19, 2018
Messages
415
Python is also fairly popular in chemistry and physics for "small tasks", like converting file formats, changing units and stuff like that. You can also see many plots in publications that were made with the matplotlib package. There are also some quantum chemistry packages that use python, although most of the heavy lifting is typically done by wrapped fortan, c or c++ code. But I think the utility vs time-to-learn ratio is very good for python, especially if programming isn't your main profession.

Learning this stuff is just hobby horse for it, but python was a lot of fun to learn. No actual use for it, but creating Civ iv mods from scratch was neat.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,331
In my mind most multi-paradigm languages are the same. You know, C++, C# and others with classes and ability to also write procedural and even functional stuff. The differences are not really that big and the language itself isn't really the important thing if it's possible to write fast enough code for some game. C# is "better" in the sense that it doesn't allow you to write bad code (in some ways) like C++ does. The reason why some people dislike C++ is their own inability to write good code and C++ does nothing to prevent them doing silly things like template metaprogramming which is totally unnecessary in game programming at least.
 

Silly Germans

Guest
What do you mean with bad code ? I thought Rust is the go-to language nowadays if you want stable and safe code.
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,240
Location
Poland
Strap Yourselves In Codex Year of the Donut
I thought Rust is the go-to language nowadays if you want stable and safe code.

Rust borrow checker still has soundness and quality of life problems. I'd program in Rust if it allowed me to disable borrows and deal with stuff normally. Additionally, in C++ I can express GADTs and HKTs even if the spec author didn't think of it. In Rust i can't. GADTs aren't useful but HKTs are.

All I'm missing in C++ is pattern matching with completeness checking.

Lately I'm thinking of using clang+msvc runtime+libc++ cross-compiling to Windows. Is it as insane as it sounds?
 

Catacombs

Arcane
Patron
Joined
Aug 10, 2017
Messages
5,955
I thought Rust is the go-to language nowadays if you want stable and safe code.
Yes, but there aren't many enterprise jobs that use Rust as its primary language. However, that can change as time progresses and if -- a big if -- Mozilla gets its shit together with the language. In the meantime, C++ is still the standard.
 

Silly Germans

Guest
I thought Rust is the go-to language nowadays if you want stable and safe code.
Yes, but there aren't many enterprise jobs that use Rust as its primary language. However, that can change as time progresses and if -- a big if -- Mozilla gets its shit together with the language. In the meantime, C++ is still the standard.
I see how my statement sounds fairly general, i meant that Rust is a good choice when safety and stability have a higher priority, especially memory safety. I also don't think that it has anywhere the relevancy close to C++ or that it will replace it anytime soon. I have no experience with it myself but a colleague is rewriting/translating/transferring(whatever the proper CS term is) alot of his code from Python to Rust for better memory management. In the beginning he bitched about getting his code compiled but now he is glad that the Rust compiler forces him how to do it properly.
 

Silly Germans

Guest
I have no experience with it myself but a colleague is rewriting/translating/transferring(whatever the proper CS term is) alot of his code from Python to Rust for better memory management.
Does he do systems programming?
Ha, no. He's in theoretical chemistry like me. We use a SLURM cluster for our calculations and his python scripts regularly had memory leaks until they reached the reserved memory limit and thus were killed by the queue. The only choice for him was to reserve ridiculously high amounts of ram which is a no-go since that blocked resources that the rest of us could use properly. The other alternative was to restart jobs successively, which is a pain in the ass and introduces unnecessary overhead.
 

Catacombs

Arcane
Patron
Joined
Aug 10, 2017
Messages
5,955
I have no experience with it myself but a colleague is rewriting/translating/transferring(whatever the proper CS term is) alot of his code from Python to Rust for better memory management.
Does he do systems programming?
Ha, no. He's in theoretical chemistry like me. We use a SLURM cluster for our calculations and his python scripts regularly had memory leaks until they reached the reserved memory limit and thus were killed by the queue. The only choice for him was to reserve ridiculously high amounts of ram which is a no-go since that blocked resources that the rest of us could use properly. The other alternative was to restart jobs successively, which is a pain in the ass and introduces unnecessary overhead.
Oh, yeah. This definitely sounds like something Rust can do better than Python.
 

GarrisonFjord

Guest
In case anyone is interested:

I read Programming Language Pragmatics (by Michael L. Scott)
long ago (the 2nd edition (latest I know is 4th)).
Liked it a lot. I remember it as not very theoretical,
with more actual examples of features, in various languages.

At some point bought the 4th edition from Elsevier online.
Iirc the .pdf did not even have a table of contents.
And now I've lost it (close to 2 years after, but not yet),
& cannot download it again (and haven't gotten a reply why).
Generally disappointed by Elsevier.

Not available in Safari books online unfortunately.

What can you do. If you have similar suggestions, do share.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,331
What do you mean with bad code ? I thought Rust is the go-to language nowadays if you want stable and safe code.

Bad as in lack of quality, consistent logic and structure. I don't know Rust, it's one of the few languages I haven't yet tried out. But I think it's safe to say that most so called modern languages are in some ways better (than C++) at things like memory management and simply not letting the programmer code funny things.
 
Unwanted

Horvatii

Unwanted
Joined
Dec 15, 2019
Messages
563
code opinions on the dex are the funnies shit since rpg opinions

python doesnt leak, if you load your shit into ram, it just stays there
use generators and iterators, they are there for a reason

buying pdfs from elsevier online <- retard
https://b-ok.cc/book/2841133/8d8b54

if a game is written in a language with a gc -> it has no chance to be interesting techwise (show counterexmpales pl0x)
hence, write """c""" in cpp for the hottest memory corruption bugs, pray for header compat if you try to marry em

you are actually writing an engine (with everything that this entails) so maaaybe just maaybe you should save you some work
and go for a readymade engine...

OOOOOHH I KONW
JAVASCRIPT! BEST
CHROME *TM* IS AN OS
USE IT PADAWAN
 

GarrisonFjord

Guest
Horvatii
I'll try to be polite, this once, instead of ignoring you
(just in case you are young/inexperienced, & not trolling).

You don't know what the other person is doing.
E.g.: see the scientist (not coder) above, in this thread.
Personally I've never said what it is I'm doing with code.

Believe it or not (it's your neck), there are laws.
Consequences of breaking them, depend on many factors
(e.g. where your current residence is).
You should be more careful when talking to strangers.
 

Tramboi

Prophet
Patron
Joined
May 4, 2009
Messages
1,226
Location
Paris by night
Rust borrow checker still has soundness and quality of life problems. I'd program in Rust if it allowed me to disable borrows and deal with stuff normally. Additionally, in C++ I can express GADTs and HKTs even if the spec author didn't think of it. In Rust i can't. GADTs aren't useful but HKTs are.

Rust definitely has issues, but with "unsafe" blocks you just revert to anything you can write in C.
It's even a problem for me because you need discipline not to go unsafe too often :)
Out of curiosity, what would you do with Haskell (for instance) HKT that you wouldn't with Rust traits system ?
(bearing in mind that Rust is a system language so it has constraints :) )


All I'm missing in C++ is pattern matching with completeness checking.
First, it would need a proper sum type.
 

PrettyDeadman

Guest
So far ive chosen c, c++, c#, elisp, python and javascript.
 

Catacombs

Arcane
Patron
Joined
Aug 10, 2017
Messages
5,955
Believe it or not (it's your neck), there are laws.
Consequences of breaking them, depend on many factors
(e.g. where your current residence is).
You should be more careful when talking to strangers.
What does laws have to do with discussing code?
 

GarrisonFjord

Guest
Update on Elsevier:
They did respond, and I was able to download the e-book.
So all is fine. (Still no table of contents though.)

First, it would need a proper sum type.
I suppose std::tuple/variant are not adequate product/sum types for your use cases?
 

Eisen

Learned
Joined
Apr 21, 2020
Messages
641
Horvatii
I'll try to be polite, this once, instead of ignoring you
(just in case you are young/inexperienced, & not trolling).

You don't know what the other person is doing.
E.g.: see the scientist (not coder) above, in this thread.
Personally I've never said what it is I'm doing with code.

Believe it or not (it's your neck), there are laws.
Consequences of breaking them, depend on many factors
(e.g. where your current residence is).
You should be more careful when talking to strangers.
What are you expecting from people of the Codex? :lol:
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom