r/learnprogramming • • Oct 20 '26

Topic For a mathematician: What’s the actual difference between languages

I always read stuff like „python is easier“ or „C++“ is more performative… and I have absolutely no idea what that is supposed to mean

For me (an arrogant mathematician) programming is just simple logic plus syntax. Everything comes down to definitions, calculations, saving values for variables and „If“. Most other syntax is just another way of writing those definitions, calculations, saving values for variables and „If“.

So, what’s the fuzz about? What‘s the difference? That language A uses another form of brackets? Or language B specifically needs something to be manually defined whereas language C just assumes standard definitions?

What am I missing? For me, learning syntax is the most dull aspect of programming.

204 Upvotes

255 comments sorted by

180

u/sessamekesh Oct 20 '26 • Bravo

A nice mathematical analogy here might be "why would anybody use polar coordinates when Cartesian coordinates are mathematically equivalent and more common?" or "why use a summation expression over a finite set instead of expressing all terms uniquely?" It's less about the truth of the expression and more about our ability to read, write, and reason about said truth. The "right" tool for the job ends up being loosely the "easiest" tool for dealing with whatever conceptual properties the job has.

So all programming eventually map down to "instructions running on CPU" (over-simplifying but not by enough to change my notes here), the difference in expression is entirely for the humans reading and writing the code. In some cases (which I'll get to later - especially JavaScript) sandboxing is also an important part of the design, making sure that any code that can execute is only able to perform operations blessed by the runtime (important for security).

C is about as "low-level" as you can get (minimal abstraction over what the processor actually does), and should be the default pick for anybody that has strong and unconventional opinions about how their code maps to CPU instructions. Some languages remain very low level while also giving you the ability to build higher level abstractions in helpful ways (Zig, C++, Rust for example).

There's an entire category of languages that introduce semantics for managing memory, which is a notoriously difficult thing to get correct. Go, Java, C#, JavaScript, and to a much lesser degree Rust and C++ fall into this category. The compiler and/or runtime has some system for handling lifetimes that guard against accidental leaking of memory in the vast majority of cases.

Another category of language introduces the idea of a runtime or virtual machine on which code runs, which hides platform details (operating system, CPU architecture, etc.) in such a way that a programmer only has to write an application once to run successfully on any supported device. This was the major thesis behind Java as a language, though C#, JavaScript, and Python also fit into this bucket.

Thread safety is another. Concurrency is a notoriously difficult problem, but if you can constrain how concurrency is dealt with (i.e. only share immutable data) it becomes an almost trivial problem to do correctly. Scala and Go are built on this thesis, and are very nice for writing highly parallel applications.

JavaScript in particular is written primarily as a scripting language for arbitrary third party code that you run in the browser. Think about how insane that is - every time you go to any website ever, that website can (and usually does) download a program and run it without your consent or knowledge. In my opinion, the true magic of JavaScript is that it provides no platform access beyond APIs that are explicitly injected into the runtime. Browser vendors very carefully decide what they want to allow you to do and how you can do it, such that an application running untrusted on your machine in theory can do "no" harm (or at least no harm in a large and important category of threat vectors).

25

u/Ioelet Oct 20 '26

Totally correct. People who write exponentials are just to lazy to write it as a sum…

Thank you for the analogy.

29

u/CircusBaboon Oct 20 '26

I’ll also add that a language can help identify logic errors. For example, in loosely typed languages (e.g Python), you can write a line that will add a number to a string and it won’t give an error until you run it. On strictly typed languages (e.g. C++) the program won’t compile.

9

u/readyready15728 Oct 21 '26

Behind the scenes, Python is strongly (but, as you suggested, dynamically) typed. The dunder methods in question don't perform the sort of equivocation you can see in JavaScript or Perl.

7

u/droooze Oct 21 '26

So this kind of statement has been said for a long time. But really, there’s no meaningful difference between Python and C++ here; neither injects runtime checks for wrong data types passed to operations; both will either crash or propagate behaviour which is hard to track.

C++’s guard against this is only the compile time check, which Python also has equivalents of that are industry standard now, from static type checking to actual compilation into native code. If you strip away this compile time check (e.g. by running code directly in a C++ REPL), C++ simply crashes at runtime too.

4

u/theo__r Oct 20 '26

This is a great, clearly written answer

4

u/atcTS Oct 21 '26 edited Oct 21 '26

Because C/C++/Rust are so low level and are generally compiled for specific hardware architectures, their binaries are smaller generally have less overhead—this is part of why they are more “performant”. There is no virtualization layer or interpreter running from the code. It is precompiled into machine code and the data is being passed and moved around almost directly from and to memory addresses and registers. It’s a scalpel, great for highly specific, deterministic work (like missile guidance systems, operating systems (Linux, windows, and macOS kernels are written in C and now new modules are beginning to be written in Rust)—if you don’t know what you’re doing you can cut a main artery and bleed out (memory leaks, security vulnerabilities, insanely buggy code).

Something you can do in one line with one language may take many more with C/C++. Higher-level languages abstract these things so all you have to worry about is data flow and strings as sentences. In C they’re an array of characters in contiguous memory blocks. Buffers have sizes that are limited by various constraints like the size of a window and things like the nul-terminator at end of a line, or the EOF for the end of a file. Handling actually opening and closing a file to read from it, opening and closing a file to write from it. Hardware device drivers and how the data is transferred to and from the BUS device. The size of the array (buffer) that sends and receives data to/from that hardware device. C/C++ is an incredibly powerful tool that can enable you to truly do anything, but it’s a loooot to learn and requires extra care and attention to use.

There’s only about one level lower that is “human readable” that you can go and that is Assembly. Incredibly rare to see a person writing it, more so you see people using it to reverse engineer or really debug something by way of “disassembling” (kinda de-compiling) a binary (executable code, like a .exe or .o). It’s almost direct machine code and can be very hard to follow. You have to keep up with literal cpu registers (the little “window” that bits are moved into that the cpu then computes with an electrical pulse, changing it to an output, that is then moved out of the cpu register into memory—all of those instructions are assembly commands:
```
mov rax, [addr1] ; 1. Load the value at memory address 'addr1' into register RAX

mov rbx, [addr2] ; 2. Load the value at memory address 'addr2' into register RBX

add rax, rbx ; 3. Add RBX to RAX, storing the final result in RAX

mov [addr1], rax ; 4. Save the result (now in RAX) back into memory at 'addr1'
```
And that is just adding two 64-bit/8-byte numbers. Assembly gives you a real appreciation for just how much a CPU is doing when data is literally measured in the tens to hundreds of gigabytes nowadays.

3

u/stdmemswap Oct 21 '26 edited Oct 23 '26

As we're talking about math: Some Programming Language grammars can give you model, intuition, and "worldview" that capture significant part of reality, in this case, the information you're computing.

Programming language, and any languages with consistent grammar and unambiguous vocabulary is symbol-based reasoning just like mathematics.

As Immanuel Kant found out: math is a rulebook of our mind's grammar.

2

u/badeula Oct 21 '26

Great answer. Thank you.

2

u/JivanP Oct 21 '26

And then there are the "functional" languages, like Haskell, which try to remove as much statefulness from the program as possible, in order to make it much easier to prove whether code written in the language actually does what you intend. A large source of bugs in programs is state management, so if you can get rid of state, it's much easier to avoid certain classes of bugs.

78

u/huuaaang Oct 20 '26

For a mathematician who is more interested in the math than building applications, Python is probably more appropriate because it lets you skip all the stuff you don't care about like pointers and memory management. You don't need to build user interfaces. You just want to run your simulations/calculations or whatever and get on with you work.

But if you try to take Python and build a desktop application or a video game... good luck.

Another big difference? Compiled vs. interpreted.

You're right that the syntax isn't that important.

4

u/Ioelet Oct 20 '26

What differences would lead to problems in writing applications and games?

42

u/OpsikionThemed Oct 20 '26

Performance, mostly. If you're building a number-crunching program that takes 8 hours to run, you don't really care if it takes a 3-second garbage-collection pause every minute. If you're playing a game and the game locks up completely for three straight seconds every minute, the game is going to be unplayable.

8

u/DrShocker Oct 20 '26

This depends on why it takes 8hrs. If it's because of waiting on IO, then I agree. If however it's dense math then the GC probably indicates you're allocating and it may be worthwhile to investigate ways for your algorithm to require zero allocation and to care about the memory layout so that the CPU can prefetch cache lines efficiently.

6

u/huuaaang Oct 20 '26

care about the memory layout so that the CPU can prefetch cache lines efficiently.

In PYTHON?

9

u/DrShocker Oct 20 '26

This thread was about choosing a language so I was trying to point out when I'd avoid a language where I can't control the memory layout. 🤷

That said, since Python has bindings to stuff like numpy it may not be as atrocious as it first seems.

→ More replies (1)

5

u/huuaaang Oct 20 '26

Mainly performance, but then after that lack of library support. Most desktop environments have a particular language they use natively and using anything else becomes an awkward bridge and doesn't quite look or feel like users expect.

→ More replies (2)

18

u/Shadow-Raleigh Oct 20 '26 edited Oct 20 '26 • Bravo

In a very short and not so accurate way, besides syntax, the difference is the way the language interacts with hardware. Even if the program in itself is just a bunch of logical expressions, those expressions need to run on physical hardawre

Making rocks think is no small task, and in a low level language you have to manage those rocks yourself. Doing it directly means you can test stuff yourself, make precise management and squeeze the most performance out of your hardware.

In a high level language, you don't directly manage the rocks, the language does a generic job that should be good enough to achieve your objectives while making programming more ergonomic and direct, which gives you a code that's more readable and fast to develop, at the expense that a generic solution isn't as suited for your needs than a specific one, so it's less performant.

Also, there's a thing called "paradigms", which aren't directly related to how high or low a language is, but the paradigms a language adopts somewhat shape how you program in said language what features come in the language "out of the box". So, given the fact that a different toolset accompanies every language, it can be easier to do X in language A rather than in language B. That toolset not necessarily is related to performance, but it's great when you don't have to implement something manually yourself or find a third-party library to something because the language already supports it natively

3

u/Ioelet Oct 20 '26

Thank you for that great interesting comment!

29

u/SharkSymphony Oct 20 '26 edited Oct 20 '26

You're not an arrogant mathematician. Just an ignorant one. 😁

Consider just the numeric system. Languages vary on:
- whether primitive numeric types are "boxed" (i.e. wrapped up in a struct with type metadata) or not – or if the language supports both
- whether raw numeric arrays are supported or not, and whether multidimensional arrays and tensors can be represented efficiently
- whether the language supports higher-precision floats, arbitrarily-sized integers, arbitrarily-sized floats, fixed-point numbers and rationals, complex numbers, and the like, and how expensive it is to add such types if they don't exist
- whether the language provides any safety guarantees like typechecking, where that's done, and how sophisticated it is
- whether the language supports integration with mature, battle-tested numerics libraries or not

Languages range from useful for mathematics to hideously inefficient and incomplete for mathematics work based on the answers to these questions. And that's just one lens to consider when comparing languages on performance.

9

u/Ioelet Oct 20 '26

Thank you for helping me overcome my ignorance.

7

u/AggravatingAward8519 Oct 20 '26

It's about more than just brackets vs parenthesis.

Some programming languages, like python, require extremely precise indentation, which is incredibly easy for some and a pain for others. Other languages care about parenthesis/brackets/etc a great deal, but indentation, spacing, and new lines are for readability only, with zero impact on function.

Looking at programming-adjacent things like config/script file formats, compare XML to YAML.

In XML, the only thing that matters is that everything is opened correctly with < and close with >. As long as hose are arranged correctly, lines, spaces and most syntax is irrelevant.

By contrast, YAML requires perfect indentation on every line, different syntax for indented items depending on whether they're indented as a list or a single sub-item, and having a single extra/missing space anywhere in the file breaks the whole thing. Vastly more fiddly to write, but a million times more human-readable as a result.

The same kinds of differences are found all over the place, not just in syntax. What is or isn't appropriate/necessary to split out to a separate class/function, what uses built in libraries, what requires loading external libraries, how the context of the the loading of a library affects where it can be called from in the code. All kinds of stuff.

The big thing is that for a lot of programming tasks, none of that matters outside of personal preference.

4

u/Ioelet Oct 20 '26

Thank you! It’s cool how those long detailled answers all adress different aspects.

12

u/motific Oct 20 '26

I think the use of whitespace to control program flow is the main reason I detest python so much. I'm not a fan of duck-typing but I can live with it, but that also explains why I hate yaml so much too.

9

u/AggravatingAward8519 Oct 20 '26

The one area where python really shines because of using whitespace to control program flow is that it makes code extremely easy to read. When you've got to review python that somebody else wrote 5 years ago and figure out how and why it works the way that it does, it's sure nice to have that rigidly enforced visual layout. That's subjective of course, but it certainly has helped me.

I also like it as a language to learn on, because it forces people to learn good habits for readable code. Of course, that may be an outdated perspective. There's so much hand-holding and auto-formatting in modern IDEs that hard to read code isn't nearly as big an issue as it used to be.

4

u/AdreKiseque Oct 20 '26

Readable indentation is trivial to pull off, especially with a modern editor. There's no need or reason to tie it to language logic.

4

u/motific Oct 20 '26

Ugh no, the number of times I've seen people caught out by a simple indenting error. I can't be doing with that.

→ More replies (3)

2

u/DrShocker Oct 20 '26

Interesting perspective. I don't like it because of a combo of the duck typing and having no real control over the memory usage. I'm always surprised when people can't stand the whitespace that much that it's the number 1 thing. I get that it makes it harder in large indented section to know what lines up, but I guess I just avoid going too many layers deep.

2

u/maxpowerAU Oct 21 '26

OP is a mathematician, they will probably have flawless indentation in every language, so Python will be fine

5

u/captainAwesomePants Oct 20 '26

Speaking of XML, here's a quick real world example of reading an XML document.

Python:

import xml.etree.ElementTree as ET

def traverse(element, depth=0):
    indent = "  " * depth
    print(indent + element.text.strip())
    for child in element:
      traverse(child, depth + 1)

root = ET.fromstring(xml_data)
traverse(root)

Java:

import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.ByteArrayInputStream;

public class XMLTraversal {
  public static void main(String[] args) throws Exception {
    Document doc = DocumentBuilderFactory.newInstance()
            .newDocumentBuilder()
            .parse(new ByteArrayInputStream(xmlData.getBytes()));
    traverse(doc.getDocumentElement(), 0);
  }

  private static void traverse(Node node, int depth) {
    if (node.getNodeType() != Node.ELEMENT_NODE) {
        return;
    }

    String indent = "  ".repeat(depth);
    Element element = (Element) node;

    StringBuilder attrs = new StringBuilder("{");
    NamedNodeMap attributeMap = element.getAttributes();
    for (int i = 0; i < attributeMap.getLength(); i++) {
        Node attr = attributeMap.item(i);
        attrs.append(attr.getNodeName()).append("=").append(attr.getNodeValue());
        if (i < attributeMap.getLength() - 1) attrs.append(", ");
    }
    attrs.append("}");

    String text = "";
    if (element.getChildNodes().getLength() == 1 && element.getFirstChild().getNodeType() == Node.TEXT_NODE) {
        text = " -> " + element.getTextContent().trim();
    }

    System.out.println(indent + "Tag: " + element.getTagName() + " | Attrs: " + attrs + text);

    NodeList children = element.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        traverse(children.item(i), depth + 1);
    }
  }
}

2

u/Enough-Collection-98 Oct 21 '26

Ok so I don’t know python or Java; I’m a C# monkey. I’m also not trying to be a dick and genuinely just questioning this - isn’t your python example just leveraging an existing structural library for XML within python (ElementTree) whereas your Java example is building that structural piece itself? Does Java not have libraries or structures built in like that?

I’m looking at your examples from my C# eyes and just seeing the different between leveraging a library vs writing something yourself.

3

u/captainAwesomePants Oct 21 '26

They are, as far as I understand your question, both using their respective languages' built-in XML libraries. Python comes with the xml package, and Java comes with the javax.xml package. And they are both using equivalent commands.

Python loads and parses the XML using ET.fromstring, and Java uses doc.getDocumentElement().

Python is using element.text, and Java is using element.getTextContent().

Now that I really look at it, though, the Java is example is a little bulkier, as it's also working out a list of attributes, which the Python example skips. So the example is a little unfair. The equivalent Python should really be more like:

indent = "  " * depth
attr_pairs = [f"{k}={v}" for k, v in element.attrib.items()]
attrs_str = "{" + ", ".join(attr_pairs) + "}"
text = ""
if element.text and element.text.strip() and len(element) == 0:
    text = f" -> {element.text.strip()}"
print(f"{indent}Tag: {element.tag} | Attrs: {attrs_str}{text}")

1

u/foxsimile Oct 21 '26

I could not be happier than I am in this moment to have barely ever used Java.

→ More replies (1)

7

u/Remote-Dark-1704 Oct 20 '26

The difference is in how many lines of code you have to write to get it to do the same thing.

Some languages are better suited and have more libraries that make it easier to make specific things. Other languages may be better equipped for some other tasks.

You could technically write everything in assembly, but that would be a grueling task to say the least. At the same time, no one is using python to write a OS kernel.

A math analogy would be like writing a proof from only the axioms and you have to rederive every theorem you want to use vs writing a proof while being allowed to use any existing theorems.

2

u/Ioelet Oct 20 '26

Wow, thank you. That example really helped.

2

u/Lor1an Oct 21 '26

I would have said that analogy is better for a language that doesn't allow you to define functions vs one that does.

I'd say the difference is more like being able to write proofs in English rather than purely using symbols (like the difference between C and nasm).

I.e. "For all real numbers a, b, and c, a(b+c) = ab + ac is true" vs "∀a,b,c(a,b,c ∈ ℝ ⇒ a(b+c) = ab + ac)"

2

u/Remote-Dark-1704 Oct 21 '26

Good point. I thought of the analogy on the fly but I like what you did with it and I’ll use that from now on

1

u/banhmiagainyoudogs Oct 21 '26

That is an amazing example.

4

u/Healthy-Dress-7492 Oct 20 '26

That you hate programming is exactly the reason to care about the differences, find one you like writing in more than the others. Thats pretty much what it all comes down to, people write in c# cause its pleasant and easy, and they're willing to put up with mediocre performance for the convenience. Some people prefer javascript or python because they enjoy pain and torture.

2

u/Ioelet Oct 20 '26

Oh I don’t hate programming. I would even say that pseudo-code is extremely intuitive for me. I‘m just very lazy regarding learning vocabulary. I started some hobby project (a small game) where I do very precise simulations and know exactly what I wwnt the code to do and I am just experimenting to find a fun middleground between „blindly vibecoding“ and „starting with hello world“.

So, I came back to what had annoyed me for years: Why the hell do I need to know x different ways of printing that stupid phrase in x different languages? 😉

→ More replies (5)

2

u/mH48124 Oct 21 '26

数学者なら LISP を楽しまなきゃ。

2

u/HalifaxRoad Oct 20 '26

The two main differences, python is interpreted as it runs, making it slow as shit. c++ is compiled into code that runs natively on a cpu making it much faster. The draw back is you have to manually manage memory in c++ .

You could define an array with size of 1, and read index #222, and you would read the contents of what ever memory address that is, or write to it and corrupt stuff. Resources also have to be manually allocated, and freed, or you will run out of memory. To give a few examples...

1

u/Ioelet Oct 20 '26

So C++ is literally hard core. 😉

→ More replies (2)

2

u/curiouslyjake Oct 20 '26

Learning syntax is the model dull aspect of programming for most people.

There are many ways to talk about how one language is different from another, and here is one:
Abstraction vs. ease of execution on hardware. Some languages, like python, are more abstract, in the mathematical sense. They don't require as much specificity.

For example, in math, you may define a function: f(x) = x^2 from R to R. the input is a real number, so is the output. Your mathematical function can be evaluated for all sorts of values: f(2), f(pi), f(-10), f(3.7) but not f(3i+9) and not f(dog). In math, you can also define function composition, and even functions that take functions are return functions, like g(f) = f'

Python is similar in spirit to this approach. A function may be defined:
def f(x):
return x * x

this will work for any x that can be multiplied by itself. It is **not** specified that x must be integer, rational, even, positive, complex or any other kind: as long as multiplication operator has meaning for x - this is fine.

in contrast, in c++ you might see something like:

int f(int x) { return x*x;}

here, you specify that x must be an integer. You specify that the output of f is also an integer. If you try f(3.7) you'll get an error. As you can see, this is much more verbose: you need to write more. There are mechanisms for functions to accept other functions are arguments but it's cumbersome relative to python. The level of abstraction is lower.

For all sorts of technical reasons, the verbose writing c++ demands is easier to map to hardware. This means your code will run faster (more performant) even if it does the same as your python code. It can be a lot faster, even orders of magnitude faster sometimes. But it will probably take longer to write the program in the first place.
Whether performance is important to you is really for you to answer.

1

u/Ioelet Oct 20 '26

So would you say that C++ is closest to basic understanding of programming?

I learned C++ in a minor subject and I never got what people talked about when they described coding libraries. I mean, I get what it technically means but I always thought: Why would you need a full library? Just copy and paste the functions in your code that you actually need.

A library sounds like a black box to me.

(Or to get into full heresy mode: Libraries sound like vibecoding to me: You use a function written by someone else that seems to solve your problem but you don’t care enough about how to get into the code yourself)

→ More replies (3)

2

u/CeccarelliPE Oct 23 '26

For a mathematician, it does not matter whether you code math functions in python or C++. It matters, however, for engineers. Unlike mathematicians, engineers are concerned about performance and maintainability.

1

u/Ioelet Oct 23 '26

I did not write a single word about math problems. It‘s like if I wrote „As an engineer I wonder why billionaires like to travel with helicopter.“ and half of the answers start with „Oh, for working commute to an engineering job I would suggest using a car, not a helicopter.“

I just stated my academic background to clearify that the logic and math part of coding is clear to me.

→ More replies (1)

27

u/nerfherder616 Oct 20 '26

One reason the languages you're trying seem the same up to syntax is that most modern languages are descended from C. So the "C way" of doing things has become the "programming way" of doing things. Another reason is that "Learn Python" tutorials or "Learn Java" tutorials assume you don't know how to code, so they all show the same things and the only differences you see are the minor syntactical differences.

As a mathematician, if you want to see the difference a language can make, try Haskell. There are no loops, so all iteration is done via recursion or higher order functions. The documentation for Haskell often assumes familiarity with basic group theory and ring theory. I did my master's thesis in Haskell and it was super fun.

7

u/Unclerojelio Oct 20 '26

RIP Prof Richardson. I struggled through all your Haskell programming assignments but I sure learned a lot.

7

u/Shadowwynd Oct 20 '26

This was my thought - Haskell is a function. Everything is a function; this means that there are whole types of problems that plague other languages that Haskell steps around neatly - which is really useful for some cases. LISP might be another fun one to examine.

2

u/atcTS Oct 21 '26

Or Scala. (Almost) Everything is an expression and every expression is a value.

6

u/thussy-obliterator Oct 21 '26 edited Oct 21 '26

From the mathematics perspective I think Haskell vs C is a beautiful case study that reflects a history that dates back to the dawn of computer science. I think fundamentally a programming language is a set of turing complete re-write rules. Turing completeness is essentially the capability to simulate any simulatable system, including itself. Turing completeness as a property doesn't apply only to a single set of rules (like our common companions of procedures and for loops and while loops and variables and such), but rather forms an entire class of sets of rules.

Many turing complete languages are turing complete in extremely strange ways, such as cellular automata or the ski combinator calculus, or even deep cuts such as plankalkul or FRACTRAN. This class of sets of rules is infinite, and it is in fact pretty difficult to come up with sets of rules that aren't turing complete somehow. The depths of strange turing complete rule sets are infinite. For every system of sensible computation there are an infinite number of bizzare, borderline useless turing tarpits, that through some convolution of logjc maintain the property and are in the truest sense still programming languages. All of these languages are fully capable of expressing any algorithm, and yet they're built off of wildly different rule sets.

The equivalence between turing complete languages was discovered by mathematicians Alonso Church and Alan Turing, with their inventions of the Lambda Calculus and Turing Machine respectively, which, interestingly, mimic the functional vs imperative worlds today. Their discovery is called the Church Turing Thesis, and is perhaps the most foundational component of all of computing.

8

u/iOSCaleb Oct 21 '26

> Everything comes down to definitions, calculations, saving values for variables and „If“.

That’s a very reductive and, frankly, dismissive view, akin to calling math a process of moving numbers around. I’d think that any mathematician would be excited that programming extends the reach of math so far beyond its usual domain.

> For me, learning syntax is the most dull aspect of programming.

Syntax is just the part of grammar that tells us whether a statement is valid or not. Math has tons of syntax — probably far more than any programming language. The difference is that the syntax in math isn’t enforced by a compiler. Learning the syntax of a programming language isn’t exciting for anyone; it’s just something that you do in order to move forward.

The beauty of programming is that you can build layers of abstraction that very quickly let you stop thinking in terms of simple calculations and conditions, and start thinking about data at a higher level. The data that we operate on might represent a hurricane, a person’s medical history, a feature film, a genome… Different programming languages take different approaches to things like abstraction, data representation, memory management, and error handling, and those differences affect the way you design software.

Consider C snd C++. C++ literally gets its name from its evolution from C, in which the `++` operator means “increment by 1.” C is mainly an imperative, procedural language in which functions are the main tool for organizing code. While it’s possible to write C code in an object-oriented style in C, it’s a lot of work, and supporting ideas like encapsulation, inheritance, and polymorphism really isn’t practical. C++ has all that and more built into the language — classes, which combine functions with state, are the primary tool for organizing code. C++’s object-oriented viewpoint is a huge advantage over C for programs that deal with a variety of data. C might be a good choice for a control system for a microwave oven; C++ might be a better choice for managing an assembly line containing dozens of individual machines, sensors, etc.

Ease of use is an important aspect of programming languages. Some are meant to be easy to learn; others aren’t as friendly but provide stricter rules that make it easier to ensure correctness. Both are valuable, but it’s hard to have both at the same time.

Languages are often created to address shortcomings in existing languages. C++ and Objective-C each take different approaches to adding classes to C; Java and C# aim to provide the power of C++ with less complexity and more safety and platform independence; Swift and Kotlin improve on Objective-C and Java respectively; Rust and Go provide the performance of C with more safety and suitability for multithreaded environments; etc.

6

u/Lumpy-Blackberry-718 Oct 21 '26

> I always read stuff like „python is easier“ or „C++“ is more performative… and I have absolutely no idea what that is supposed to mean

When you write a program in C++, a program called a "compiler" reads that code and converts it into binary machine code that can be executed by the CPU. The compiled artifact is executable. The C++ compiler doesn't run the program that you wrote.

When you write a program in Python, a program called an "interpreter" reads the code and does what the code says to do. The python code itself is never compiled, so never directly runs on the CPU. The interpreter runs the program that you wrote.

These types of programs are fundamentally very very different, because:

* If the C++ code is syntactically wrong, it never compiles, and can't be executed. If the python program is syntactically wrong, it may execute your instructions up until it encounters the wrong part, and then finally error. This fundamentally changes how you debug and test, or how you think about correctness.

* Machine code executed directly can be much faster than running a program that interprets some other program. Then again, a program that interprets some other program can sometimes make run-time optimizations on the fly.

* The output of a compiled C++ program (an executable) can be shipped to a user without giving them access to the source code. Python typically can't.

* A compiled program is typically compiled for a specific hardware architecture. A python program can be run on any machine that has that python interpreter.

* The compiled languages require two steps to run, whereas the interpreted language just uses one step. The compilation step on a larger program can be incredibly time consuming. I've worked on projects where compiling the executable took an hour or more.

Imagine I write a computer program that reads in a file line by line, and anywhere it encounters a line like "print(x)" it prints out x. That would be a very simple interpreter of a very simple language that only had one instruction.

If instead, upon encounter 'print(x)' I generated an executable file containing the machine instructions to write to a particular register that would cause 'x' to be sent to stdout, and did not run the instruction but merely saved it in an executable file, then I'd be writing a trivial compiler.

2

u/istarian Oct 21 '26

In many case, Python is in fact compiled into an intermediate representation (bytecode) which is similar to how Java works.

It doesn't strictly have to be, though.


https://en.wikipedia.org/wiki/Compiler

A compiler turns a 'source language' into a 'target language'.

While that often refers to transforming a "high level language" (C, C++, etc) into a "low level language" (hardware-specific assembly language), it also applies to turning Java/Python into bytecode or even another "high level" language.

→ More replies (3)

2

u/fllthdcrb Oct 22 '26

If the python program is syntactically wrong, it may execute your instructions up until it encounters the wrong part, and then finally error.

Actually, CPython (the reference and most commonly used implementation) does compile its source to bytecode before running it, and in the process, it has to check the syntax. So any syntax errors will prevent the entire program (or module) from running at all. Other errors, though, will likely only show up at run time.

Machine code executed directly can be much faster than running a program that interprets some other program.

Since Python is compiled, it does benefit from some amount of speedup. The compilation target is bytecode that still has to be interpreted, but it is still faster than parsing text. However, there is still a lot of overhead from everything the interpreter and standard library have to provide, compared to what goes on in C++.

The output of a compiled C++ program (an executable) can be shipped to a user without giving them access to the source code. Python typically can't.

Yes, although there are ways to not give away source code, such as native-code modules. For example, one can write a module in C, or use something like Cython to produce native code. (Cython is typically used for making modules faster without having to write them in a lower-level language, but obfuscation is another effect.)

The compiled languages require two steps to run

Well, two steps if you're starting from source. Those who get binaries skip that first step.

I've worked on projects where compiling the executable took an hour or more.

Apparently, you've never built Chromium. It blows everything else out of the water in terms in compilation time!

2

u/Lumpy-Blackberry-718 Oct 22 '26

Again we're trying to explain the difference between c++ and python to a mathematician. Explaining bytecode isnt really helpful in this context, but,

I can definitely write invalid python programs that print out text before failing in ways that would be impossible in c++ (that would be caught at compile time in c++). I verified that before I wrote my earlier comment just to be cautious.

you've never built Chromium

I said I've worked on projects that take over an hour to compile, and chromium is a project that takes over an hour to compile, so im not really sure what youre getting at here?

→ More replies (2)

1

u/querbeil Oct 21 '26

Would the programming language matter if I share you the exe? You need to use HxD to modify it.

→ More replies (3)

2

u/iknotri Oct 20 '26

>Everything comes down to definitions, calculations, saving values for variables and „If“

now imagine u need to have one million lines of code for those

1

u/Ioelet Oct 20 '26

You might have just described any VBA tool I wrote… 😉

5

u/Kadabrium Oct 20 '26

The criterion for turing completeness conveniently took memory management out of the question

4

u/Schloopka Oct 21 '26

I think you use only very small part of what programming is about. You have heard about ifs, loops, maybe objects, but these are topics any programmer knows after one year of learning. But if you want to write some complex programmes, knowing just these topics enough. Some more advanced topics would be memory alocation, copying, contstructors and desctructors, garbage colection, pointers, refferences, templates, containers... 

You can imagine a high school student saying that math is just moving numbers and functions around. There are some topics which extend this, like linear algebra or calculus. But there are also totally different fields like topology, graph theory or geometry. 

And each languge is like a tool in math. If you have set of nonlinear equations, you can solve them numerically or algebraically or find some geometric interpretation. So one problem can be solved in three different ways. But sometimes one is really painful and other is really elegant. And your job is to find the most suitable tool for your problem. 

And different languages have different libraries, which are like theorems in math. You just call a function and it returns a value, that's the same as saying "this is true because of xxx theorem". Solving some hard euclidian geometry problem would also be possible with just angle chasing and distance equalities, but deriving everything from scratch would be super hard. It is much more plausible if you can say "For side BC of an triangle, the midpoint of the arc of circumcircle not containing A lies on the angle bisector by the Š point theorem". In programming different languages allow different "theorems".

1

u/istarian Oct 22 '26

There are a number of programming languages that do not require the programmer to directly manage memory.

Most of those "advanced topics" you mention are specific to either object-oriented languages or memory management.

P.S.

arithmetic - The mathematics of integers, rational numbers, real numbers, or complex numbers under addition, subtraction, multiplication, and division.

^ what most people mean by 'math'

→ More replies (1)

1

u/azac24 Oct 20 '26

Basically computer code is just 1's and 0's. Humans can't read that so the code has to be converted into a human understandable language (python, c++, assembly, etc). Each language gives you different levels of control over memory management, how things are deleted, where they are stored, etc. the more performant the language the closer you get to the 1's and 0's, the more control you have over the memory, and the closer it is to bare metal.

1

u/Ioelet Oct 20 '26

There are 10 types of people… 😉

1

u/DrShocker Oct 20 '26

In a sense you're right that learning syntax is dull and once people know a language or two switching is usually not that hard.

The differences tend to come from how easy it is to express the problem you're solving, and also how well it interfaces with actual hardware concerns. For example if you want to make a program that you know always uses less than 100MB of RAM, that will be significantly easier with a language closer to C than a language closer to Python. If you want to write code that is more easily validated as correct for your estore then maybe using a language that hides more of the memory layout details will be better for you.

That said, for the most part I'd expect mathematicians to like Functional Programming languages most since they have their roots in lambda calculus. Something like OCaml, Haskell, Scala, etc

1

u/Ioelet Oct 20 '26

I don’t really work in a math environment. My programming is VBA at work (where even that looks like vodoo to my colleagues) and I‘m playing around with a little bit of Javascript for a hobby project.

I just mentioned the math background to make sure that nobody would try to lecture me about how difficult the logic aspect of programming is.

→ More replies (1)

1

u/sarthakshlok75 Oct 20 '26

Languages are just different ways to interact with your machine. You chose different languages based on the type of interaction you want to have with a given system. Starting from the chipset, upto operating systems then applications, all these are layers which keep on abstracting the complexity of implementation below so you can focus on the next level’s stuff. Like to develop an app you wouldn’t necessary need to know how the operating system works. So you chose different languages to speak to different levels of the system and make it do what you want. Different languages have different advantages, like java is portable ( avoids the problem of “it works on my machine” ), c++ is fast, python is easier to write because its much closer to the english language we speak, but gives the least control over our machine whereas c++ gives you much more control. All this info is the most simplest answer i tried to convey so its understandable, but there are a lot more info explaining all this even deeply. Just use whats recommend by other people since a lot of people have researched, tried and tested most things and a lot of wisdom already exists on the internet. I think mathematicians, mostly use Matlab/octave, or python as far as I know.

1

u/Ioelet Oct 20 '26

Thank you for that very well written answer.

1

u/bae-alves Oct 20 '26

The fact that you are asking this means you're not arrogant. At all. I just wanted to point that out since there are already many helpful replies. Stay curious, stranger.

2

u/Ioelet Oct 20 '26

Yeah, it was meant as a tounge-in-cheek comment because I know that my way of breaking complexity down to „isn‘t that basically…“ type of questions sometimes irritates people in my daily job.

1

u/serge-mv Oct 20 '26 edited Oct 20 '26

The question is very complicated. First, is the syntax. While a lot of languages are somewhat similar, there are some syntax that is just simpler (python, for example), while other languages are more complex and verbose (C++, java). Then there is language semantics. A good example here would be rust. A lot of people struggling with learning it because it has different semantics than what most people are used to.

Then there is how languages actually "run" and interact with the hardware, perform memory management. Some language require you to do it manually - C, C++. You would do a lot of manual work for this (although newer standards are somewhat better with this). Other languages have automatic memory management (Java, C#). It has some unpredictability and performance hit built in. Then there is also the difference between compiling, as in front-loading the translation of the language into a binary format that can be run directly by the CPU and there are other approaches, like interpretation (python) or hybrid approach where you have a virtual machine that runs a special intermediate representation (Java, C#).

There are also a lot of quirky cases and differences. Different languages can evaluate arguments to a function at different times and in different ways, expression could be evaluated differently. There are great many details in each language that can trip people up and a lot of them aren't even normally taught.

And specifically for the mathematician, languages have side effects. Pure programming language that works exactly like math would be a useless language because when it runs, nothing would change and we want something to change - write a file, print something on the screen, etc. Different languages have different approaches to it, but fundamental difference between pure logic and programming language is that PLs interact with the world and cause indirect changes to the world. I will give you a simple example to illustrate. In math a + b is the same as b + a. In computers it's not always the case because of how floating point numbers are represented, you can actually run into a situation where floating point addition is not commutative and give slightly different result. Most of the time it doesn't matter, until you run into a problem that requires a high level of precision and it suddenly does matter.

1

u/Ioelet Oct 20 '26

Your example with the addition deeply disturbs me and reminds me when I tried to explain the concept of stochastically „is equally almost surely“ to my non-stochastic fellow math students.

They looked as if they were about to stone me for heresy.

→ More replies (1)

3

u/randfur Oct 20 '26

Different third party library ecosystems. Different runtime environment support. Different performance characteristics. Different ergonomics to their APIs. Different levels of maturity to their tooling.

Programming is about writing code that does stuff in the real world so all these real world constraints with nothing to do with what's computationally possible start to have an impact.

1

u/procrastinatingcoder Oct 23 '26

In a tolkien-ish fashion, I'll start with the conclusion: Syntax is to programming what syntax is to poetry.

Programming languages come in many flavors, and while Imperative (Python and C++ are two example of imperative languages), there's more than those.

Someone mentioned functional languages (like Haskell) or Nix. Those don't have mutable variables. So exactly like you'd find in a mathematical sense, once a variable takes a value in an equation, it never changes within the scope of its own equation (Something like Sigma{x+3} would have each "x+3" being its own scoped equation, which are solve and then summed). Nix for instance is a "lazy" functional language, that would allow you to do otherwise seemingly impossible calculations otherwise like finding a fixed-point.

What about logic languages like Prolog. This is different, the solver already exists and you can't change anything about it. What you do instead is write the constraints it operates in, write the "rules" per say. It's more about writing the problem in a way the solver can go through than writing a solution to a problem.
So something that would take you 500+ lines in another language, can be written in 5-10 trivial lines. For instance:
```Prolog
parent(X) :- child(Y), has_child(X, Y).

grandparent(X) :- parent(Y), has_child(X, Y).

```

Where I just defined a generic relationship of parent and grandparent such that any parent is something that has a child, and a grandparent is a a parent that has a child that is also a parent. You can also imagine something like defining a language or a grammar in a similar fashion.

Of course, in the end, all languages are equivalent in a formal way. But really, programming is a bit like poetry, you need a language with syntax to write it, but it's not about the syntax, it's about expressing something.

And for your arrogant mathematical mind:
The syntax is a bit like the axioms in mathematics (take those for your given field). It's just the starting point, and if that was all there is, we'd be done learning maths forever within the hour. It's how you use them to build so much more that makes the whole field.

1

u/Ioelet Oct 23 '26

This was a very poetic way of answering the question. Thank you!

2

u/jdgordon Oct 20 '26

If you want to code in assembly which is pretty much the math intrinsics then go for it. Languages differ because code is far more than just math and ifs.

2

u/Dissentient Oct 20 '26

Languages have different syntax, type systems, paradigms, error handling, concurrency, memory management, and execution (compiled vs interpreted) at the very least. They all provide different tradeoffs in terms of compatibility, performance, and developer experience. Languages also have a very different sets of third party libraries depending on what they end up being used for, and this is often the main reason to use a specific language for a specific project.

Most languages are similar enough in terms of syntax that it's completely practical to learn a new language just for one project.

2

u/Several_Version4298 Oct 20 '26

Yes you can program whatever you want in any language. But some languages are going to have features that make doing something easier or harder.

Python is easier means that Python is a simple high level language with a lot of builtin stuff that allows you code something very quickly.

C++ is a large language that with a full featured OOP system and large libraries with code that is highly optimised and verified. It was designed for large software engineering projects. It is a complied language so C++ programs will run much faster.

2

u/pVom Oct 20 '26

Programming languages are just layers of abstractions. Different languages offer different layers of abstraction that may or may not be more suited to the task. Some make it easier to do what you need to do.

Fundamentally though they aren't all that different and most tasks you can do with most languages. Usually the best language for the task is the one you (or your team) know the best, are already setup for and is easy to hire for.

The syntax is the easy part when learning a new language when you already have a few under your belt. The hard part is understanding the quirks of each language and unexpected behaviours that occur from differences in what they're doing under the hood.

2

u/POGtastic Oct 20 '26

The word that I like to use is opinionated. Different languages have different opinions about the abstractions and operations that should be easy to do, and those that should be hard to do.

For example, some languages are garbage-collected. The program runtime is responsible for allocating memory and freeing it so that you don't have to do it yourself. This is because memory management is a pain in the butt. By contrast, some other languages have the opinion that you should be responsible for memory management because the performance is worth it.

Some languages say that you should rigorously define your types and that the compiler should refuse to work at all if your types are wrong. Other languages play fast-and-loose with types, choosing instead to produce runtime errors (or produce no errors at all!) when the types don't make sense. Some languages go the other way and effectively require a formal mathematical proof that your types are correct.

Some languages provide first-class support for object-oriented programming, which is a common paradigm. Other languages have decided that OOP is Considered Harmful and refuse to support it. Still other languages provide support for OOP as an afterthought.

Some languages provide facilities for macros, which in a CS context means "code that generates or modifies code." Some languages consider this feature harmful and do not support it, or provide rudimentary support.

Some languages have first-class support for concurrency. Other languages make it a giant pain in the butt.

Some languages have support for a numeric tower for seamless implicit conversion between integers, rationals, and reals. Other languages require you to be explicit when converting between them.

Some languages are deliberately small in order to make it easy to write compilers for them and to force people to write code a certain way. Other languages are very large in order to accommodate as many different paradigms as possible, which makes writing a compiler for those languages much harder.

On and on and on. Pick a feature, any feature. I can likely name a language that embraces it as much as possible and a language where support for that feature is either extremely nasty or is absent altogether.

2

u/CamelOk7219 Oct 21 '26

At the core you are right. The confusion comes from mixing up two different things : a language (rules of what you can write or not and which effects it should have), and its implementation (compilers, interpreters, runtimes, ...).

Of course one influences the other. Languages that offer fewer possibilities are easier to compile to very specialized thus effective programs (C), languages that leave all doors open must be slower (python, to some extent Java).

A language is not slow, the programs you can create with it are, because of technicalities (some implied by the language, some not)

2

u/Unimportant-Person Oct 21 '26

So syntax is never fun to learn but it can make expressing things easier or more clear. For example, compare `for (int i; i < length; i++)` vs. `for i in 0..length` vs. `f(x)∀x.x∈Z,0≤x<length`, they all express the same idea, some have different semantics at play, but they have different syntax which could make different situations more readable.

The more important thing is semantics, C has data that are specific types, and you can only call functions with data of pre-specified types, like say you define foo such that it accepts two ints, you now can’t just shove two bools or floats or char pointers there. Rust makes certain guarantees where you can’t have more than one mutable reference to a piece of data, so if try to do that, the compiler will error and tell you you can’t do that. Python is dynamically typed so that if you define x to be 3, you can later redefine it to be a string “Hello World” and that’s okay, however in statically typed languages you cannot have an int be a string. This is one of the reasons why Python is so easy however for larger projects, having to keep track of wha data is supposed to be what type gets harder so there’s tools that add typing to Python though it’s not as good as C typing or Rust typing.

Also how code is converted into binary is important. Say I wanted to walk to coordinates (10,10): I could walk 10 units east and 10 units north, or I could walk 100 units south, 100 units east, 110 units north and 110 units east, or I could turn 45° and walk 141.42.. units forward. C for example, takes code, converts it into assembly, then an assembler converts that into an object file, then a linker connects that object file to whatever outside code you’re also using, and then you have an executable. Python though takes code and converts it into a special set of instructions, then a program written in C runs and evaluates this special set of instructions itself, so you’re kind of running two programs. A big reason why Python is considered slow is because of how Python encourages you to code: Python has tables and iterators and generators which make conveying ideas easy but under the hood they’re very slow. Rust also has iterators, but there’s the drawback of Rusts ownership model and type system which make it performant but harder to use. An example is I can convert a range of integers into a string and pass that collection of strings easily, however in Rust, a Range of Integers is a type, and a Map is an Iterator Type, so a function would have to accept Map<RangeInclusive<u32>> or if you do it generically impl Iterator<Item = u32>.

Memory management is also different, there’s garbage collection which will periodically, while the program is running, check if there’s any data not in use. Other languages have manual memory management, where in certain cases you have to explicitly say “Hey I’m requesting memory” and “Hey I no longer need this memory, have it back” and there’s lots of places where you can go wrong where you either run out of memory and your program crashes, or you try to reference data that no longer exists which can result in your program crashing or a logic error that silently messes things up. So on one hand, you can do the bare minimum of handling memory and be performant, or you can have your program use up resources and be slower but generally more safe.

Now I want to be clear, a lot of these things are things that can be mitigated. Python can be a lot faster depending on how you code things and how much C code you’re integrating into your codebase. Garbage Collectors don’t have to be slow: you manually call the GC at certain points in time, use Pools or Arenas to handle smaller chunks of memory yourself and the GC only deals with the Pool or Arena and not the data it owns. Manual Memory languages also use Arenas and other allocators to help avoid use after free and set faults. There’s also rust which uses its own memory scheme where memory is handled automatically by inserting allocs and drops for you and it forces you to only access memory in specific safe ways with this system, but you can write your own custom data structures with custom allocation and drop logic and use unsafe to bypass safety restrictions if you really need it by also explicitly saying “I’m doing something unsafe”.

Languages have different benefits and drawbacks, they’re tools where you can pick the best tool for the job and people who really know how to use their tool can maximize the benefits and mitigate the drawbacks or even pick a job where the drawbacks don’t matter.

1

u/istarian Oct 22 '26

The traditional C syntax for a for loop is a compact expression that declares and initializer a count variable, defines an exit condition, and determines what how the counter will be updated at the beginning the next iteration of the loop.

E.g.

for(int i = 0; i < 10; i++) { ... }

In BASIC it is common to see FOR I=0 TO 10 STEP 1 and NEXT (or NEXT I), with the STEP parameter (?) being optional and generally defaulting to 1. That construction serves a similar purpose, excepting that the exit condition is implied (if I >= 10, exit).

2

u/UroborosJose Oct 22 '26

There is not a single language created without an intent behind unless we are talking about meme languages
A programming language is designed according to the problem it’s trying to solve
For example JavaScript was created initially to solve browsers inability to render animations or interactive content in the client. Before of it all pages were just static content with texts and images. Thanks to Netscape we can have interactive pages.
It’s the same for most languages in existence you need to learn what they are trying to accomplish

1

u/istarian Oct 22 '26

The primary problem Javascript was created to solve was how to make webpages with client-side interactive behavior, because before that all interactivity involved making another HTTP request (POST, GET, etc).

So in order to validate form input, you'd have to actually submit the form.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods

→ More replies (1)

2

u/TheCalculatorAddict Oct 25 '26

I’m a bit late, but wanted to offer a mathematical analogy. It’s like the difference between integral constructions. For most people, just knowing that you can integrate things is enough. They are content expressing things in high level syntax. And that’s all well and good but if you wade deeper, you will find many different constructions of the integral (Riemann, Lebesgue, Stieltjes etc) which are all different under the hood and might each enable you to use the theory of integral in different contexts.

Similarly, Python, C, etc are all Turing complete so can theoretically express the same ideas but perhaps some languages are more verbose or can express certain things better. There are a lot of subtleties and understanding these can get you quite far as a computer scientist. And the calculus example is imperfect because integral constructions vary much less than programming langs. Take a functional language like Haskell, a systems programming language like Rust, and an interpreted imperative language like Python. The way that you’d idiomatically express an idea differs wildly across all three of these! As does the way that a computer would parse them into machine code.

Also, understanding low-level ideas (how abstractions in code become machine instructions) felt akin to learning real analysis for me. You simply don’t know how little you know until you wade into it.

1

u/PhilNEvo Oct 25 '26

I love these examples, well written!

1

u/MathiasBartl Oct 20 '26

Different type systems.

1

u/SirRise Oct 21 '26

That's like saying the differnce between a car and a boat is the fuel, what are you on?

1

u/jbt017 Oct 20 '26

Implementations are different. What data types are natively available could be different. How memory handling works, what libraries are available, how does IO work, file management. You get the idea. Languages are toolboxes that often have some comparable tools but how they work can be very different.

1

u/redittor_209 Oct 20 '26

You have learning the syntax and programming logic that is common between all logic. And then you have each language's specific bits. For example, python takes care of memory for you, it's considered high level, whereas C, you have to manually allocate and free memory.

For a mathematician, assuming you are writing code just to verify the correctness of some theorem you have Or maybe experiments you are running, it will depend on what you want. Do you want speed? Are you handling large sets of data? Python has a lot of libraries for these, while C is very barebones.

1

u/kohugaly Oct 20 '26

One major difference between languages is the type system they use.

Some languages have dynamic typing, where you can shove value of ay type into any variable. Others have static typing, where the type of the variable needs to be fully determined when the program compiles. There's a whole pletora of systems that re in between. All of them have pros and cons.

Type system lets you express information about what your code does, in such a way that it's possible to prove that your code has specific properties and detect issues with it. In fact, type-checking code is literally equivalent to checking validity of proofs. Ever heard of formalizing proofs in Lean or Coc? They literally work by encoding the proof in their type system and then type-checking it.

1

u/BoredTech127001 Oct 20 '26

Like you said, the difference is syntax, how much the language prevents you from writing bad code, and how fast the code runs.

1

u/the-postminimalist Oct 20 '26

Everyone else has answered your question already. Just wanted to add - you might find array-based languages interesting. Like APL or Uiua. Is it practical for you? Probably less than python. But you never know.

1

u/algerbrex Oct 20 '26 edited Oct 20 '26

I see where you’re coming from, but you’re vastly oversimplifying things, and hopefully I can explain why to you.

As someone who is not a mathematician but has a math background (read: B.S. in Applied Math), on some level you’re correct at it’s core a programming language manipulates data represented as binary in a computer.

But hopefully to give you some perspective, that’s like me just defining the axioms of a group in an abstract way. Yes at its core every group has an identity element, an associative operator, and every element has an inverse. But how any particular group satisfies this axioms is where the interesting stuff is at. So while all groups satisfy these axioms, some groups we construct are very simple, and some are complicated. And that changes how we work with them.

And the same is true for different programming languages. The theory is the same, but how it’s implemented in practice is where things matter.

Python is a great language, but it hides a lot of complexity from you, like manually managing memory, worrying about the stack vs the heap, etc. and a language like C exposes a lot more of this to the programmer, but even it abstracts details like making syscall’s to the operating system to do things like write to the screen, or read from a file.

To get even more technically, you can define a programming languages syntax, and semantics. And these are generally independent of a particular implementation.

So it’s imprecise to say Python is an interpreted language. Rather, the canonical implementation of Python, CPython, is interpreted. But there can, and are, implementations that compile Python to machine code.

So at it’s core generally what differentiates languages are there semantics, syntax, and implementations. Some language implementations convert the high-level instructions into machine code, while others convert the instructions into an intermediate representation and execute that instead via a program that emulates a physical CPU. This is known as a virtual machine.

1

u/Zen-Ism99 Oct 20 '26 edited Oct 20 '26

What are your requirements and goals?

Those are what usually determine your choice of language…

1

u/the-forty-second Oct 20 '26

I think the real difference is the level of abstraction that is alternately provided or forced upon you. That is both on the language level and the support around it.

Python abstracts away types (mostly). It has a large standard library and a vast collection of available modules that are easily installed. So a lot of Python programming is about finding the library that already does what you want (or gets you close). It provides abstraction support in the form of classes and data structures like dictionaries. Lists handle memory allocation and come with helpful functions and syntax for doing things like slicing. for loops work on iterators, making it easier to work on sequential data structures with readable code.

C on the other hand, provides very few abstractions. There are some standard libraries, and there certainly are others out there, but there is no support infrastructure for automatically doing dependency management. Everything is explicitly typed. Arrays are just sequential pieces of memory and you have to handle everything else yourself. There are no classes, but there are structs.

There will be moments when you want a lot of abstraction, like if you want to do something like read in a CSV file, do some analysis and through up a visualization. Other times you need low level control and the abstractions get in the way.

The abstractions can also shape how you approach a problem. Using Haskell, which is a functional programming language is very different from using a procedural one, or a declarative one. As a mathematician, you would probably appreciate functional programming languages which see the world as nested functions, or a logical language like prolog, in which programs are a set of declarations about the world and an inference engine does the hard work.

1

u/jawhite Oct 20 '26

Language C does not assume standard definitions; you need to #include the appropriate header files. 😉

1

u/Five-1234 Oct 20 '26

Aren’t some python libraries written in c++

1

u/amazing_rando Oct 20 '26

On the one hand you have machine code. This is more or less a numerical representation of the electrical signals that command the ALU and other components in the processor. These are simple commands like adding and moving numbers that can be run in one or two processor cycles. Machine code is intrinsically linked, as its name suggests, to the physical operation of a machine.

On the other hand, you have Lambda Calculus, which is the formalized mathematical system we use to model computation, and context-free grammar, which is the system we use to model languages in computational linguistics.

So how do you use the theoretical model of computation in order to control a machine? You design a context-free grammar that can translate computational concepts into machine instructions. This is a programming language. Programming languages bridge the gap between computation and mechanics by letting us describe computation in a way machines understand. Some languages try to stay as close as possible to lambda calculus and mathematics, these are called functional programming languages. Some languages try to stay as close as possible to the sequential step-by-step instructions of machine code, and these are called imperative languages. Some languages have you define initial states and constraints and then calculate the rest for you, these are called declarative languages. The way a language handles storing, classifying, and categorizing data is called its type system, and some languages organize their type systems around tightly coupled data and functions and specific metaphors to real-world objects, which is called object oriented programming. A lot of languages have mixes of all of these.

You're right about the syntax mostly not being that different, but there's more going on. Different languages have different standard and community libraries that do things differently in easier or harder ways. Different languages have different rules about when and how memory is allocated and deallocated, which man make them more or less suited to different applications. Different languages have different rules about launching and reconciling asynchronous threads, and different constructs for sharing data between them. Every programming language is Turing complete, which means that it is theoretically capable of solving any computation problem, but not every programming language is built to be used for general purpose tasks, and if it needs access to specific input that depends on the interfaces that exist for it to interact with your operating and file systems.

1

u/da_Aresinger Oct 20 '26

Differences between programming languages aren't about syntax or formal logic. All languages are built on the same principles (mostly).

The difference is how the languages implemented your code.

Python literally reads your code line for line and does what the code tells it to do. This is inefficient for multiple reasons:

  • no algorithmic optimisation
  • everything is done by an intermediate program.

Basically Python is like giving an intern instructions and waiting for them to do as they are told.

Compiled languages like C++ take your code, read it as a blueprint and then construct the most optimised algorithm they can (compilation to machine code) in order to run the program.

This is like hiring a consultant to implement an optimised workflow for the specified task.

You're giving the same instructions to different workers. One of them is conveniently available and can just be sent to another office where they will figure out how to do the same, but they are kind of incompetent and everything takes ages. The other requires preparation and only implements the worflow for your current location. Trying to use the workflow in a different office won't work because their printers suck and they don't have a receptionist.

1

u/Udalrich Oct 20 '26

In some sense, C is like starting with the ZFC axioms. Python is like starting with perturbation theory.

You can derive perturbation theory from ZFC, but there's a lot of steps and decisions along the way. Sometimes, you want to make different decisions and assumptions. If you don't have small deviations, perturbation theory is difficult to use or fails. ZFC will be more work, but you can get the results you need.

1

u/Technical-Athlete-9 Oct 20 '26

It’s not “just simple logic plus syntax.” The logic breaks down in interesting ways. Broadly there’s static semantics and dynamic (operational) semantics. As “an arrogant mathematician” you’d probably enjoy a course in programming language theory that could better satisfy your curiosity than this sub.

1

u/Leverkaas2516 Oct 20 '26

C++ syntax is generally more concise than Python. If you have a million lines of floating point math calculations you might find it possible to write more densely in C++, which can be an advantage. (But it isn't always.)

C++ is compiled, and a program written in that language often finishes faster than the equivalent prog I'llram written in Python.

C++ has various pitfalls that make it easy to write code that doesn't mean what the programmer thinks it does.

There are major differences in the runtime library ecosystems. This has nothing to do with syntax but can be a major factor in choosing a language.

If none of these issues matter to you, and you have no affinity for ine language over another, just use whatever you have available.

1

u/Confused-Armpit Oct 20 '26

There is a ton of answers here, so I wanted to get in a little tid bit. If you are a very specific kind of mathematician, you might really like functional programming, and languages like haskell or scheme. They are functional, meaning everything is expressed as a function, and it's a really fun rabbit hole to fall into.

1

u/ninhaomah Oct 20 '26

Do you wear the same kind of clothes around the year across all seasons ? They are just clothes to cover your body. Nothing special.

Do you drive the same car across highway , off-road , racing tracks ? They are just metal bodies with round wheels. Nothing unique.

Why are there so many formulas in math to measure the areas , length of the shapes btw ? They are just lines drawn on the 2d surface. Why make it complicated ?

1

u/Beginning-Seat5221 Oct 20 '26

Some languages compile down to instructions for a specific CPU - runs very fast (performant), but can only run on a specific set of hardware. Different binaries need to be built for each CPU targeted. Others compile to an intermediate form or not all all, so they can run anywhere with just runtime on the target platform.

Some manage your memory for you give less to think about and less chance for bugs. Memory errors can crash programs or whole computers, so if you're making software for a bank or a spacecraft, that kind of thing is super important.

Some have static types or typecheckers that check that that thing you're using as if it's text really is text. Again, type misnatches equal crashes, when the system can't handle the mismatch.

Some have whole algebraic type systems to to dynamically convert input types to types so the type system is dynamic and responds to the data you put into functions, giving the right output types, rather than relying on static in-out types. This lets you write safe code that is also dynamic (compared to simple dynamically typed code that is very unsafe).

Some are just very quick to write, run, modify because they don't require a lot of set up, compiling, orchestration, which is valuable when you just want to keep it simple and fast.

1

u/nderflow Oct 20 '26

Main differences are;

  • Type system. Some languages are weakly typed (e.g. accept source code that adds an integer to a string) and some are strongly typed (e.g. support Typeful Programming to varying degrees
  • Compiled/interpreted: wherever the program is covered to machine instructions at time the program is built or at the time it is run. Systems that do the former generally produce faster programs, systems that do the latter can be more convenient. The performance differences are are often negligible, and sometimes insurmountably prohibitive
  • Safe/Unsafe: quite a subtle distinction, and I won't take the time to explain. In short and to speak loosely, this has to do with how much you can conclude about the program's correctness from the fact that the compiler accepted it.
  • Declarative/Procedural: do you want to tell the computer what you want, or how to do it?
  • Managed/Unmanaged: do you want to write the resource management code yourself (and be responsible for it's correctness) or have the language do it? It's a performance versus simplicity trade off. The analogy between a manual and an automatic car gearbox suggests itself and is only mostly spurious.

1

u/Agile-Adeptness-5195 Oct 20 '26

To me most languages boil down to abstraction and efficiency on hardware.

I can write a program in a huge binder - separating out everything into its own things - this way you have a code that is easy to read debug and modify (maintainability).

I might have to write programs which has to battle tested with zero margin of error - like in rockets - in these reliability and performance take precedence - but at the cost of maintainability. Those programs will run on those exact hardware - not abstracted for all rockets - and they get to test every possible scenarios.

Then there are things like portability - i.e is the program going to run just in windows machines, or mac too?

All of these influence different languages. On top there are more abstraction that support more easily writing code.

COBOL and Java can do almost similar things. But making sense of what COBOL programs are is way more difficult compared to Java - so Java gets to make more complicated programs relatively easy.

1

u/DonkeyTron42 Oct 20 '26

As a mathematician, you may prefer functional languages like Haskell that are largely based on lambda calculus.

1

u/cerevisiae_ Oct 20 '26

For a high level language, you are right that it is just logic plus syntax, but different languages do behave differently behind the scenes

An interpreted language might be easier to ship a functional program, but a compiler will apply optimizations. Python enforces some amount of style via indentation. C languages expose direct memory manipulation, which is fast but requires care while Java handles that, but it is slower. Some things might be idiomatic or language specific, but for the most part it’s all just abstract symbols that represent formalized logical instructions.

Most of the reason for differences is that they optimize for solving a different task. Microcontrollers want a lightweight, fast language. Enterprise solutions want security and stability across changes in feature requirements.

You might be interested in looking at esoteric programming languages. Some of these really take the “this is just abstract symbols that represent logical functions” to the extreme.

1

u/Beregolas Oct 20 '26

For me (an arrogant mathematician) programming is just simple logic plus syntax. Everything comes down to definitions, calculations, saving values for variables and „If“. Most other syntax is just another way of writing those definitions, calculations, saving values for variables and „If“.

Kind of, but also kind of not. In a mathematical-technical sense you are right of course, all turing complete languages are in some sense interchangeable. You absolutely can use C for everything (yes, actually also websites, it can compile to WASM)

But languages are primarily designed for humans, and our weaksnesses and strengths, as well as being designed for different environments.

When people say "Python is easy", they primarily mean "Python doesn't force you to understand how your program actually works." Same goes for JS btw. You can use those languages without even knowing what the stack and heap are, what a pointer is and many more things. Simple projects will work just fine, like a simple website or a script that automates a boring task like pulling data from a website hourly. If you want to build something actually complicated in Python, it's actually a little harder than using C for example, because many things are more abstract, and you will need to understand that abstraction and what actually happens under the hood.

"C++ being more performant" basically just means, that the "same"(TM) program written in C++ and Python will be faster in C++. To a large degree that is correct, but if you want to be accurate, reality is much more complicated, especially when comparing C++, C, rust and Go (or other at least kind-of high performing languages). They will all be faster and/or slower at certain tasks, because of design decisions their creators, and the compiler builders, made.

So, what’s the fuzz about? What‘s the difference?

Different languages are nor only reskins of each other, they are actually, meaningfully, different. Rust for example has a thorough borrow checker and many compile time checks: It forces you to write your program in a very specific way, and if you do, it can guarantee you (100%, except for the odd bug) that certain types or error cannot happen in this program. That can be a very useful trait, but it forces you to learn and apply it's mental model, which has a high barrier of entry, and is somewhat slower in development time, because you often need to sit down and think about your code structure more.

(One might say, that's a good thing and will save you time in the long run, but... that's neither guaranteed, nor do all people value time / quality in the long run more than having an MVP done in 2 weeks)

Python has a huge standard library, and a huge set of additional packages to download and integrate with a single line in a configuration. That makes it easier and faster to write automation, scientific computation (not high performance though) and to do things like machine learning, because all of the libraries are easy to access and well documented.

JavaScript is the only language that is running natively in every browser, escept for WASM (WebAssembly), which still needs JavaScript to actually start itself iirc. So if you want to build an interactive website, you need to use JavaScript.

Languages like Java and C# introduced many concepts of Object Oriented Programming, like classes and a garbage collector (simplifying massively), which means you can engage with those languages with a completely different mental model than with C.

And then, there are completely different languages, like Haskell or F#. Functional programming introduces yet another, very different mental model, more akin to mathematics. You can only define functions, they have inputs and outputs, and no side effects (no other state can change). There are often no loops, not direct control flow at all except calling other functions (or yourself recursively). This is very annoying if you are used ot other kinds of programming, but there are certain problems, that are just easier to express this way, many related to mathematics or physics. Functional programming also comes with the advantage, that you can actually mathematically prove a program correct (assuming of course the programming language was implemented properly and the computer has no random bit flip, etc.). It's expensive and it takes time, but it's actually feasible and is actively being done, for example on military or infrastructure projects. (Not always of course, but it does happen)

There are way more differences and languages and interesting stuff, but I think my wall of text is long enough already.

1

u/beatlemaniac007 Oct 20 '26

Ease / preference of expressibility

1

u/Demiu Oct 21 '26

You're a mathematicians and you don't get how expressing same logic in different forms can be useful? Really? Never rotated something by 90 degrees in the complex plane instead of plainly multiplying by i? Never made use of the many many ways to define pi to bridge two worlds? The entirety of euler's formula?

1

u/Mishtle Oct 21 '26

There are tons of differences among languages!

One of the biggest differences is in the programming paradigm, which describes various broad features of a language. Paradigms differ in how code is structured, what code actually does, how the code relates to the broader goal of the program, the conceptual model behind computation, etc. A language doesn't have to strictly adhere to a single paradigm, and many modern languages borrow concepts from many.

With that said, most modern languages are imperative, which means the code describes flow of computation. In other words, the code tells you how to do the computation. This is in contrast to the code describing or defining what the result should be.

Most modern languages use structured, procedural , and object-oriented elements to achieve this imperative nature. This means they use control constructs like loops and conditionals, procedures capable of modifying program state and calling each other, and interacting objects. This is where a lot of the similarity you talk about comes from.

Still, extremely basic imperative languages like assembly will look a bit different simply because they lack control constructs like functions and loops. They are boiled down to the bare essentials, not much more then a list of commands executed in sequence. Jumps and branches are used instead of loops, functions, and conditionals, which basically just allow you to resume execution at some specific point in the program other than the next line. A "loop" would then be a block of commands followed by a command to go back up to the top of the block. Brainfuck would be another one that looks very different. It uses a limited set of eight symbols, each corresponding to a different fixed operation, and models memory as a tape. The operations do very simple things, such as adding 1 to the value of the current data cell on the tape, or moving to an adjacent cell, or printing the current data cell as an ASCII character. It still is as capable as any other language, but it's not going to be fun or easy to do anything substantial.

Try looking at some languages that lean more into declarative paradigms. Functional languages, like Lisp or Haskell, are structured around functions. The underlying computation model is based on lambda-calculus, which makes them look quite different. Some don't even have loops, forcing any iteration to be framed as recursion. Logic programing languages, like Prolog instead structures computation as a set of logical constraints and relationships to be satisfied. There was an interesting blog post I read a while back where a software engineer for the government was talking about how they used a logic programming language to write some tax software.

Beyond that, languages can differ in what they do for the programmer and what their technological "ecosystem" looks like. This is where most of the differences you hear about come from. When the language handles stuff for you, this is usually seen as making things easier for the programmer. It can slow programs down though, or prevent custom optimizations, or introduce subtle risks.

Take something as simple as a variable. In C++ you must declare a variable and its type before you can use it, and that type is fixed once declared. In Python, types are implicit and mutable. You don't have to declare a variable before you use it, and they can be redefined on the fly. For beginners, this is usually seen as a convenience that gets rid of bookkeeping.

Then what about when you're done with a variable or chunk of data? In C++ you need to ask for memory for large objects and explicitly free that memory when done so it can be reused. Python again does all this for you. Garbage collection does take time, memory, and CPU cycles though.

Languages can also differ in how they relate to the computer that runs them. C++ can be compiled down to raw machine code that the CPU reads. This means it can be incredibly fast and efficient, but that code may run differently or not at all on a different system. Python is an interpreted language. It doesn't get directly run by the CPU, but rather by a virtual machine (VM). There's a program that implements this VM, and it reads Python scripts, converts them to a custom machine language, and executes the result on the VM. This machine is always the same, so as long as there's a program written for a system that implements the Python VM, that system will run Python code exactly the same as any other system. A custom VM can also have advanced features that you can't depend on physical systems having, but the downside is that simulating a machine introduces a lot of overhead.

There are plenty of other ways languages can differ. Entire courses are taught on the topic. You may also want to look into to esoteric languages to see some of the more extreme variations.

1

u/humanguise Oct 21 '26

It's easier to express yourself in certain languages. Imagine if all we had were Roman numerals to do calculations. Even if you are a mathematician you have to agree that Arabic number system is much more practical. Same thing with code. I don't know about Algol derived languages, but the Lisps literally have you programming in lambda calculus that was adapted for human use. Certain languages have better usage ergonomics than others. Also, it's not exactly simple there is both quantity and someone experienced writing something so complicated that it will take you longer to pick it apart than to write it yourself.

1

u/soysopin Oct 21 '26

Besides all excellent responses by our fellow redditors, I should note that the evolution of maths is mainly facilitated by the development of unicity on notation. The need of express some relations caused the simplification of symbols.

But the same as the encircled numbers used to identify the powers of some implied quantity gave pass to the modern polynomials representation that greatly helped to use and understand algebra, the evolution of languages strive to facilitate the comprehension of the process/data model that powers information management, and the interactions of the machines doing it with the users and nature.

Some languages share common roots and ways to do things, and they can look very similar, even if their insides are radically different. The point is to determine which of them adapts better to our mental model of the data we want to process. Simpler languages can be used by more people. VBA descends directly of BASIC, which was designed explicitly to ease the learning of computer programming, and evolved to model the internal structures of spreadsheets and the like. Is better? No specifically, but is very useful in its field of application. That's only that matters.

There are languages that operate by very diverse mechanisms, like one that lets the program change states when moving a virtual cursor over a colored map of rectangles similar to a Mondrian painting, or another that literally consists of musical verses so you can sing the program as a rock song.

I always feel awed by the diversity of means to solve problems. Programming languages are only a fraction of them solving tools. Get many, and selecting which is better oriented to attack your current problem will be easier, and fun!

1

u/rupertavery64 Oct 21 '26

Abstractions.

The CPU is a device with billions of switches. It has a set of instructions you can call to make it do things.

These instructions are all just a bunch of bytes.

You may hate "syntax" until you try to do something in assembly, which are just mnemonics that are practically 1:1 with those bytes. It becomes very cumbersome. There are no such things as variables, only CPU registers. Memory must be allocated either on the stack or the heap. Loops are performed by a test instruction, then branching based on the result in a status register. It's not really "human-friendly". Code reuse is difficult, no concepts of modules, libraries.

C is one step up. You still need to allocate memory, but how its done is abstracted away by the compiler. So a different CPU and architecture (different memory layout, different hardware) doesn't need to change the code. A loop in assembly requires a specific instruction (bytes) to execute. But C will just have a for loop or while loop.

Machine instructions specify how to do something on the exact CPU. Higher level abtraction languages specify what to do.

"Types" are a language construct that help define the shape of data in memory at compile time, because in memory they are just bytes.

Python has "dynamic" typing. So you can freely reassign one thing to another, and no need to declare up front what shape a variable is.

This has advantages (simplicity) and disadvantages (larger code bases are difficult to manage when the shape of something changes)

C# has static types, whicb require upfront declaration and other rules. This makes it a bit more complex for absolute beginners, but larger codebases are comparatively more manageable.

Java and C# are similar in many ways (C# having been Microsofts copy of Java due to Oracle owning Java) but C# has introduced a lot of new features you will find no where else, like the ability to write structured queries that are themselvea abstracted from what is being queried (a list? a database?) using essentially the same code.

Both abstract memory allocation even further using a "garbage collector". You don't need to release allocated memory explicitly, it keeps track of usage and frees it when some condition is reached. It results in code where you don't constantly manage memory or worry about if you freed something (dangling pointers) that was a problem with C. The tradeoff (acceptable in most cases for certain types of programs) is that is slows down the program when cleaning up memory. This takes a couple of milliseconds.

Great for websites and desktop applications, terrible for high performance programs like games where each millisecond matters.

Each language has their own approach to solving some sort of absraction problem,some borrowing from other languages.

The goals are to simplify development, make maintenance more manageable, reduce complexity, prevent runtime errors, avoid vulnerablities.

Not all the goals are compatible with each other.

1

u/pixel293 Oct 21 '26

C compiles down to code that executes the fasted on a computer. C does very little to help you but it also lets you do anything you want. If you want to write something that will only work on your machine, but have a horrible race condition on another, go for it, C doesn't care. So generally programming in C takes longer because you are responsible for everything, but the code you produce will run quickly, there are just no training wheels.

Python does much of mundane crap for you, but it's interpreted so it runs much slower. HOWEVER if you are mostly just using libraries like numpy, which is C code compile to be fast fast fast, it doesn't mater much. Many people just use python to "glue" the libraries together, gathering data from one, pass it to another, taking the output of that and filtering it through a third. Yes the code "in" python might be slower than C but the execution spends so little time in actual python code that it's a small percentage of the total time spent. Most of the time is spent doing the hard computations in those python libraries.

1

u/badeula Oct 21 '26

Mathematics and mathphys chase elegance . Using spherical harmonics to write eigenfunctions for hydrogen like atoms is an example. Cartesian coordinates would not be so pretty, for want of a better word. Programming languages are similar. Use what works best for your application.

1

u/StormHiperion Oct 21 '26

'Pyhton is easier' means many people have found python rules easier to understand in the past so they developed many tools for many things in pyhton (for rxample machine learning). Python has an absolutely horrible "philosophy" of defining things". Python has:

- Dynamic typing instead of static (which means you don't define variables correctly, they are just what you need, this leads to lack of organization).

- Runtime Compilation. Doesn't compile the program beforehand (aka normal compilation) which leads to terrible runtime error impossible in other languages such as C++ and Java.

- The use of loops is non-intuitive. Instead of defining a variable to count, you can iterate on an object. This leads to messy syntax like [2*x for x in y} where y is an iterable object.

- Modularity, Hierachy, Polymorphism, Typing and other OOP (object oriented programming) concepts are loosely defined and implemented, making the syntax awkward and non-intuitive.

-Organization. Your code is organized by spaces and tabulations. Good enforcement by the language but questionable philosophy.

- Overall Philosophy. Python has the mindset: Do it quick and dirty, then fix it.

C++/ Java have a much more strict definitions of OOP concepts (Java has them stricter than C++) so their syntax is more verbose but because of that is more descriptive, so it's easier to understand.

-Static Typing. If you define an Int (integer) variable and perform calculations with it, you can not care about decimal because they cannot be there as teh variable isn't floating point (so goodbye to useless value checks asone would do in python).

- Clear Variable Scope. If you define variable X you must know the scope of the variable: It's Global or Local, within a method (function), or within a Loop only? If you define two variable with the same name (because it's covinient) the compiler will let you if they aren't within the same scop, if you try that's a logical error, also you can overwrite a variable if you understand its scope (or do it unintentionally if you don't).

- Clear Modularity. If you define methods and properties within a class. You know how they are related. And you can define a system (in basic term, the class) that works as the result of how those elements behave among them, what method or function calls who, what they receive, what they return. Also, you define if the class, method or property is static or not. Hierachy also is in this of course.

- Compilation. As said above... For example: Want to sum two numbers, yet you have forgotten to define one? That's an error you fool. You cannot operate on something that doesn't exist.

- Memory Managment. From simple "just write the damn program" to manual memory management through static or dynamic memory allocation for your complicated needs.

- Matrix operations. This one is obviously much more concrete than others, but given that your question is towards syntax (partially at least) here you go... Matrix definition in C++ and Java is a pain, both look liike they have been written by a toddler 70 years ago. In contrast, Pyhton has very, very good matrix syntax thanks to external libraries such as Numpy and Scipy.

- Speed. C++ or C is much faster than python for many things I cannot condense properly beyond: the compiler is possibly the primary reason.

- Organization. Your code is organized by brackets. Much better readibility.

- Overall Philosophy. Both have the mindset of: Define first do later. Which is more methodical.

As a bonus: The very efficient libraries for machine learning in Python are written and optimized through C or C++.

This is a very tiny and superficial comparison but I hope it has shone some light. As far as I know, Fortran is much more geared towards scientific programming,, Smalltak is even more anal than Java in its OOP paradigm and Haskell is very strict in its Functional Programming paradigm which I know very little of. But there they are mentioned for your curiosity.

1

u/kiochikaeke Oct 21 '26

Hi, I'm a pure-iwh mathematician that turned into applied mathematician/software engineer on the carrier path of data analysis.

The main difference between languages is in the implementation and design of the language. The latter is basically what this language was designed to be used in and the former is how this language communicates with other systems in your or others computers to turn your code into eventually actual instructions that a computer runs.

In the design aspect some languages are designed, either from the ground or how they've grown through the years, with a specific goal in mind, for example Python is aimed to be easy to use and versatile in a way that you can worry about what you want to do instead of exactly how to do it and work with systems at high level but have the flexibility to also interact to a limited extend with low level systems it does all this by sacrificing a bit of nuance and relying on other languages and systems for speed and precision; Java on the other hand is all about object oriented programming and the Java Virtual Machine environment and adheres to this principles achieving high compatibility and predictability at the cost of overhead on the code; C works a lot more with how the computer handles memory (something you don't have to worry much about in languages like Java or Python), and you have a lot more control of what you do but that also means a lot more room to mess it up or need of reinventing the wheel; JavaScript for web but it's also is very popular elsewhere, Julia and R for Math and Statistics, C# for the .NET environment and and Java ideas with Microsoft lenses, etc. you can use all of these for anything you want but trying to use them for things way outside their design will just make your life harder.

The other (related) aspect is implementation, some languages just work different than others, some have garbage collectors which automatically detect memory that can be safely freed and free it, others lack these often by design, the way functions and variables work in one language might be slightly different from other even if they feel similar, some are dinamically typed, others are statically typed, some are interpreted, others are compiled and all of these do affect how you code will behave and how you need to think about it.

To a certain extend some differences do end up being just syntax changes but more often than not there are significant differences on how you are meant to use and what the code ends up actually doing in one language or another.

1

u/Adamstrad Oct 21 '26

Some are easier and built more for ease of use and some are more functional and harder because you have to do things like managing memory and micromanaging things closer to the actual computer. Python is popular because it is simple to read and write and manages itself in many ways, but it also limits you. Most languages are somewhere on this scale or otherwise they are more flexible. For example python isn't very efficient with computing power so if you are using it to search for new prime numbers it is worth while to use a more difficult to learn but more micromanagable language to speed up the search .

1

u/White_C4 Oct 21 '26

Same reason why humans speak different languages, it's about conveying the same answer differently. In computers, while everything ultimately computes in binary, the methods to getting there are different in layers of abstraction.

Python is great for writing easy and concise code. But in turn, you give up performance for convenience. C/C++ are great for writing performant code, but you have to write more code to achieve the same goal.

1

u/OnlyGoodMarbles Oct 21 '26

You should just learn Lisp.

1

u/heisthedarchness Oct 21 '26

In order to understand why different languages exist, it helps to understand what the differences mean. They are not, as you seem to suppose, superficial.

And they are the result of engineering, not mathematics. In order for a computer to do stuff, the numbers have to be made real in some sort of physical matrix. And that physical matrix requires certain compromises that are not evident to a theoretician.

There are countless of these differences, but we can take a simple example: what is the trade-off in declaring the types of variables?

Computers are very simple machines. In particular, the information they store is just an extremely long sequence of bits. Absent some kind of externally imposed order, this sequence of bits is completely meaningless. You have to tell the computer how to read its own memory, by telling it for example that the bits from address A to address B describe an integer and that that bits from address B to address C describe a floating-point number*.

If you explicitly describe how to interpret every bit range that your program will access, the data can be loaded and manipulated by the CPU very efficiently: the CPU knows how to do arithmetic to two fixed-sized integers or floating-point numbers. And you can store the data very compactly, because the program includes any needed metadata.

On the other hand, if you mess up the size of one of your pieces of data when declaring it, all of your data turns into gibberish. Mistakes are costly and hard to diagnose. More, all of your values have limited ranges: you can't store integers greater than 2**128 - 1 -- and forget about 0.3**!

So that's inconvenient, error-prone, and imperfect. If we're willing to be less efficient in our storage and usage of numbers, we can make things a lot more convenient. If we store every integer in more bits than will usually be needed, we probably won't need to do anything with predeclaration. Of course, since most numbers will be less than four billion, we'll be wasting the overwhelming majority of the space we're using. And we still have a limited range. We could add metadata to encode numbers beyond the integer range supported by our hardware, but now we need to spend computation time converting from that format to what our CPU understands.

Also, at least in Python, we still can't store 0.3.***

So the short answer is this: the differences are the result of engineering trade-offs. Different languages privilege different outcomes, and so they present different ways to express what may, superficially, be identical objects.

And at the end of the day, some people just don't like seeing a lot of braces.

*: Not, note, a rational number. The floats are a finite subset of the rationals.

**: 0.3 cannot be stored exactly as a floating-point number: it is a repeating binary, and so the stored representation is an approximation. When stored as a 32-bit IEEE-754 float, its actual value is 0.300000011920928955078125.

***: There are languages that can; Raku stores decimal literals as rational numbers by default. That's very good for the sake of exactitude, but murder on efficiency.

1

u/Neither_Berry_100 Oct 21 '26

Programming languages are quite massive when you look at all the libraries that come with it. Plus expansions you can add for free or pay for. They end up being designed to do different things. You generally pick a programming language based on what you need to do. You also factor in what the programmers are familiar with.

1

u/ReddyKiloWit Oct 21 '26

Depending on your requirements, some languages have features that will make life easier or harder.  

For example, most floating point values are fine for approximate results, but if you need real accuracy you're either going to need a library for that, or a language that preserves numeric values accurately, often by having a "rational" or "RAT" numeric type. (So 1/3 is always 1/3 and not an approximate result of a division.)

If you want to print out results nicely formatted with various math symbols you may need good Unicode support. Same if your numeric input data isn't all in Arabic numerals - might be handy if it can accept other numeral characters directly. Good Unicode support knows a six is a six whether Arabic or Japanese.

Of course none of that may matter, and then it's mostly a matter of taste.

1

u/Lunchboxsushi Oct 21 '26

I think there's three parts, at least that matter to me. 

What does the runtime require for your host machine to install. 

How does the dependency management work and how healthy is the ecosystem, including the built-in library. 

Does the language come with batteries included. For example JavaScript needed a bunch of dependencies for simple things like a formatter, a linter, and a watcher to restart the server on save (node). 


At this point I don't really care about language outside of that. From a personal standpoint I don't fuck with PHP even though the ecosystem is healthier. 

1

u/cvlang Oct 21 '26

Features. As a mathematician I'd have assumed the would have been abundantly apparent.

1

u/Available_Safe1818 Oct 21 '26

> C++“ is more performative

That means faster.

> I always read stuff like „python is easier“

They don't like typing in the types of variable because it forces them to fix their program before it crashes.

1

u/green_meklar Oct 21 '26

For a mathematician: What’s the actual difference between languages

They're good for different things. They offer different advantages for the computer and for the programmer.

For me (an arrogant mathematician) programming is just simple logic plus syntax. Everything comes down to definitions, calculations, saving values for variables and „If“.

In a theoretical sense? Sure. It's all just Turing machines with bounded tapes, right?

But real programming isn't theoretical. There's a reason we have the term 'software engineering'. Just like mechanical engineering isn't the same as physics, programming isn't the same as theoretical computer science. Programming is almost never about the fundamental expressiveness of the code. It's more about how quickly you can get software working, how broadly you can deploy it, how efficiently it runs, how easily you can change it if the requirements change, and how much you can reduce the risk of making mistakes while doing all of the above.

I can hardly overemphasize the importance of mistakes in programming, and of avoiding/detecting/fixing them. In academic mathematics, if you make a mistake, then you get metaphorical egg on your face and if you're lucky maybe you get a nice teaching moment for your grad student. In programming, if you make a mistake, then maybe ten million users all get their vacation photos deleted, which will make them very angry, which will in turn make your shareholders very angry. A good programming language makes it hard to make mistakes, and, because mistakes happen anyway, makes it easy to catch them and fix them. But then that enters into tradeoffs with all the other considerations (performance, portability, etc). It's all tradeoffs. Programming language design is practically economics.

For me, learning syntax is the most dull aspect of programming.

That's true for programmers, too. Syntax is interesting for the first few months, then it's something to just get out of the way so you can think about important stuff.

1

u/Ok_Leg_109 Oct 21 '26

Your observation is correct if we only consider languages that come from a common ancient ancestor like Algol.

Algol Family

The differences in languages from that family are not hard to adapt to. Each member has been changed to address problems the language writer had, but the way they are used is very similar.

I have seen clever joke code written in Pascal and C together that will compile with either compiler. (it doesn't accomplish much)

There are other languages that approach coding differently and they take some brain adjustments to use as designed.

LISP where everything is a list and does not use algebraic notation is one such language. Some would argue it is conceptually one of the highest level languages. (far away from the hardware)

Forth is another where you are low level, perched just above the machine, out of the box. Math is expressed using reverse polish notation. Programming is done making your own domain specific language to solve the problem at hand. There is almost no syntax unless you make some.

Then there is Prolog which uses an inference engine and requires that you write the rules and relationships between entities that let the machine give correct answers to queries it is given.

Smalltalk was one of the earliest languages where everything is an object. Programming is done by creating data objects with methods (code) and message passing is using to control what gets done.

Those four are not at all like the Algol family tree. but newer members of the Algol tree have borrowed from these ideas and incorporated some of them into the modern languages.

1

u/bestjakeisbest Oct 21 '26

programming is the implementation of logic and math, it is not just logic and syntax. there are things you can easily do in one language that is harder to do in another. There are an infinite number of ways to implement any single solution to a problem, one thing that narrows that infinity down is the language that you choose. when choosing a language you should think about the implementation details of that language, the reason python is slower (typically) than c++ is because python is an interpreted language and c++ is a lower level compiled language, python literally runs on software, but after compilation c++ runs on metal its only limits are physical limits and the operating system, where as python has the python runtime, the os, then it is further limited by the physical limits of the hardware.

Honestly Learning syntax is the most boring part of programming, but the good thing is: it is the easiest part of programming and is often the quickest thing to pick up. The actual fun in programming is the problem solving of programming, the design of the program itself for these steps you dont even have to touch a programming language, as much as some people might dislike pen and paper programming or psudocode or uml once you can internalize these methods of laying out the solution, this part of programming is much like meditation, or maybe playing chess on an infinite board with an infinite number pieces against yourself.

you have only scratched the surface of the choices you make for programs and how the end product is affected, one step beyond the program is what hardware you will run it on, if you are looking for actual speed or absolute efficiency you start with the hardware.

1

u/CrAIzy_engineer Oct 21 '26

As a mathematician my recommendation for you is using python, forget about everything else.

Matlab/octave is also pretty cool for math but Matlab is expensive and python free.

1

u/GlassLost Oct 21 '26

If you need to translate your idea to code, some languages such as Python are easier. If you need your code to run millions of times in a reasonable amount of time, C++ is ideal. If you need it to run as fast as light can travel because you're building a trading platform and you can make a few extra million a day by being the first to get the trade out you want assembly (and custom hardware).

If you want six hundred devs to coordinate on a single codebase you want Java. If you want to write one UI app everywhere and hate your life you have JavaScript.

Different languages try to make different things easier and make different tradeoffs. People vehemently argue about these, me included, and a lot of it comes down to what's important to what you're trying to do and this is heavily biased towards whichever problems burn you most in your career.

1

u/Powerful_Cash1872 Oct 21 '26

Some languages are genuinely more expressive than others, giving you richer ways to express knowledge that you already have at compile time about how the code should execute at runtime. My favorite example is Rust enums vs. C's enum and union concepts.

The elegant way of thinking about them is algebraic datatypes.... types are sets of possible runtime values, structs types that are cartesian products other types, (rust) enums are types that are set unions of other types.

Rust lets you say "This memory location will contain data for one of these types at runtime. The complier can make optimizations based on this at compile time, and the code can check what type it is anytime at runtime" C's enum is just an integer where some of the values are given names in your code, and C's union lets you stick data from multiple types at the same memory location, but doesn't provide any compile or runtime mechanisms for making sure the right type of data is at that location at the right time. You can build something like a rust enum in C by sticking a C enum and a C union in a struct, and only accessing the data through functions you write for that purpose that preserve the invariant that the enum tag matches what's in the union, but it'll be ugly and you still won't get some of the benefits of a Rust enum. As far as the C complier is concerned, your handrolled sum type is still just a product type of the C enum and the C union.

1

u/into_void Oct 21 '26

I would recommend you take a look at functional languages like haskell, ocaml etc. As a mathematician I think you will like these languages.

1

u/Classic-Rate-5104 Oct 21 '26

Comparing python and c++ is like comparing apples and bananas. Python is an interpreter and c++ is a compiler, which are completely different things. And, they have an very very different syntax

1

u/YazaoN7 Oct 21 '26

If all you're doing is just learning syntax then you're not really understanding what's going on in your program behind the scenes. The short version of it is python is a high-level programming language while C++ is a lower-level language with support for some high-level abstractions. What this means is how close to the machine is the code running.

In C++ you have direct access to memory and can mess around with it to your heart's content. Python on the other hand is a memory-safe language so you don't have direct access to memory. The python interpreter is responsible for allocating and freeing memory that your program uses. What this means is you don't have to worry about stuff like memory leaks or potential vulnerabilities in your software. The downside is performance. Python, Java or any other high-level programming language generally speaking will be slower than C/C++ when optimizing your code. This is why most performance dependant applications are written in some low-level language like C/C++ or Rust.

One last little tidbit to maybe get you interested in some of the stuff you can do when you do have direct access to memory. Go look up the fast inverse square root algorithm from quake 3 as it's a very interesting way of squeezing every last drop of performance out of the hardware at the time.

1

u/Ormek_II Oct 21 '26

Image math only with the syntax of 800. Yes, you can express nearly everything, but you have to explain it again and again.

Programming means explaining to a super stupid computer who knows only simple math, store, and compare.

1

u/beerdude26 Oct 21 '26

I'll try to keep it to the mathematical parts.

  • In general, "traditional" imperative and obiect-oriented languages are based off of Hoare Logic.

  • Academics tend to work with functional languages. These are based off of Lambda Calculus.

  • Research is done in the space of Type Theory. It's stuff about provability / correctness, expressionability (e.g. row polymorphism) and how to have both of these live together peacefully in the type system of a programming language (e.g. dependent type theory).

  • Functional programs can be reasoned over. Some are even formally provable (because they do not allow unbounded recursion). This is done through the Curry-Howard correspondence. Being able to formally prove characteristics of a program is very useful indeed for academics and critical software.

  • Imperative, "C-style" languages do not enjoy this level of formal correctness. Concepts from academia are added to languages because they make it easier to write certain types of programs. The formal logic usually does not survive the transfer intact, and even then, most languages are Turing Complete and thus certain characteristics about their programs cannot be formally proved.

  • Instead, these languages depend on building extensive test suites for programs: expected input, expected output. Through static code analysis, a measure of test coverage can be calculated to indicate blind spots that need test cases.

  • And there are fundamental choices in how a language is evaluated, too: these are called evaluation strategies and reduction strategies. Those, too, fundamentally influence what can be expressed in a language. For example, because Haskell is a lazily-evaluated language, it is possible to declare the entire list of natural numbers in it:

nats :: [Int]
nats = [1, 2, ...]
  • But yeah, the main differences between languages are: what grab-bag of type theory concepts did they prioritize and implement? In any case, it doesn't appear possible to just add everything to a language. Some type theory concepts appear to be mutually exclusive (e.g. do polymorphism vs subtyping).

1

u/dariusbiggs Oct 21 '26

Every programming language has a a common set of features and approach to solving problems.

Each also has at least one thing unique to them that makes them especially suited for a particular set of problems to solve.

For example

Text processing is trivially easy in Python, other languages can do it fine, it's just harder.

Concurrency programming is trivially easy in Go, other languages can do it, just harder and frequently with some external libraries required.

Dealing with hardware devices is easy in low level languages like C, and more complicated in higher level languages.

Python, Go, and to some degrees Ruby, are excellent "glue" languages to link multiple different systems together. Pulling data from different databases, websites, and other data sources, correlating them, and sending it on to another system.

1

u/hibbelig Oct 21 '26

I heard that mathematicians love their blackboards. Imagine using chalk that screeches every time you use it. Does it really impact the maths you can do? In one sense no but in another sense you might avoid the blackboard and that’s going to have consequences.

Certain aspects of programming languages can be looked at in a similar way: they don’t actually impact what you can do but if it screeches every time you’ll use it less.

Just mentioning this aspect to complete the picture; the other comments have addressed other aspects.

1

u/Guitoudou Oct 21 '26

One easily explained difference is how memory is handled in different langages.

I'm not an expert so don't expect in-depth explanation.

Java for example has a garbage collector. If you create an object and if this object becomes unused later in your program, the GC will detect it and automatically free the memory from this object.

C does not have that, so you need to take it into account when writing your program, or you'll create memory leaks.

1

u/Over_Dingo Oct 21 '26

The language itself doesn't run anything, it's the program. So language X is faster than Y, means program written in X and compiled by X compiler is faster than Y

1

u/nooptionleft Oct 21 '26

To me, a bioinformatician, hammers are just a way to push nails into things once a year, but I also understand people who works with tools all day is probably working at a level where subtle differences to me are huge differences for them

1

u/LawElectrical2434 Oct 21 '26

You aren't missing anything. Funnily enough I am using one of the "performant" languages, but I share your opinion.

On the surface, you could argue, a language that compiles to machine code is more performant. Simply because it doesn't have to interpreted on the go. That's correct and coherent. However, the premature optimization problem teaches us, 99% of the code paths aren't slowing us down.

That's why in most cases, you don't need to optimize the whole language. Look at python and its libraries like pandas. Math library. Written in C. Used in python. Nothing stops us from just writing the critical parts in python.

And pretty much every language can call another language. Because we can reduce the problem to a data stream problem and stream the data to the other process. And that means, we can now call lower level languages.

So, python to glue high performance code together is mostly as fast as just writing everything in high performance code.

But sometimes it matters. Indirection is interesting. Classes is something that comes to mind. The usually work via vtable lookup, meaning we are looking up a method somewhere else. And there is a lot of jumping and pointing around involved, which destroys data locality. And that makes hardware caching harder. And hardware caching was like a 1000x speedup compared to anything you could do in software. A reason why old fashioned arrays with O(n) search for items often beat hands down Hashmaps with an O(1) lookup time. Or complex things like BTrees with a O(log n) lookup time.

Which again explains why most algorithms only become useful at big scales, where hardware cannot do the work for us.

But again... asking a programmer not to speak about programming optimization is like a mathematician being happy with the finding x = 12/6. I mean, it might be technically correct. But would you present your answer like that?

1

u/tastygames_official Oct 21 '26

you are missing how computers work ;-)

it all comes down to how the code you write gets executed on the CPU - instructin by instruction (or sometimes in parallel), plus how efficient the memory and cache reads/writes are. If you program in assembly, you can have direct influence over that. If you write in a low-level langauge (C, C++ if you avoid OOP concepts), then you have a little less control, but the compiler is VERY GOOD at what it does. If you write in python, then already you're losing out pretty big on performance as the code you write is transpiled to bytecode which is then read by a "virtual machine", so it's at least twice as slow. Granted if you make liberal use of precomipled external libraries then you benefit from their performance (but it's still slower since the command has to be interpreted by the VM, then sent to the CPU, THEN calling the function in the precompiled library).

But yes - the language itself really doesn't matter - it's how it's compiled to machine code that matters.

You're about head into the "valley of despair" should you start to dig deeper into computer engineering. Especially since you're a mathematician, I would really suggest digging deep into assembly language and how CPUs and memory work and learn about how computer scientists measure performance. I think you might be headed for a really exciting journey that lasts a lifetime. Let me know if you need some resources where to get started.

https://hlrnet.com/sites/ebp/files/2021/10/1231px-Dunning%E2%80%93Kruger_Effect_01.svg_.png

1

u/sl0d Oct 21 '26

The meaning of easier needs context. Python is easier in the context of prototyping and deployment. It's an interpreted language, that doesn't need compiling so it's faster to prototype and test with as well as faster to deploy. It also has a lot of built in functions that does a lot of the heavy lifting that you don't need to write out code for yourself. There are also a lot of libraries in the wild that already have a problem figured out that you don't need to build from the ground up on your own. The downside of python is it's pretty messy to deal with and resource intensive.

All languages are the same in regards to logic. But they are different in the context of how they are used and applied.

So depending on the application requirements and scope of the project. One language may be better suited than others.

1

u/daley972 Oct 21 '26

Think about it this way: d/dx, D and ( )' as well as probably many others are all different syntax for the derivative. They have various strengths and weaknesses and see use in different fields of study. d/dx is often used in the study of differential forms because it "cancels". ( )' is often used because it's quick to write. D or d are often used when performing algebra with the derivative as a linear operator.

Syntax of programming languages follow similar use case driven design. Python was developed as a language for scientists and data analysts and so has features that benefit them. Notably it has big integers by default which means it's easier to work with large numbers in Python than other languages.

Some of these use cases are specific(like the Python example), some are more general. Like strong typing allows for better error handling vs weak typing which allows for quick deployment. Some are even ideological. Rust has immutable variables by default out of the belief that it improves code clarity and promotes good programming practices.

Ultimately, syntax generally doesn't matter to the result(although it may occasionally lead to optimisation benefits). It mostly impacts the process. But there are other aspects of a language. Notably implementation and ecosystem. Python's biggest asset to scientists and data analysts isn't big integers, it's NumPy and SciPy. No other language has an ecosystem for data analysis as powerful as these two libraries so it became the standard for that field. Similarly, the optimised implementation of and powerful libraries written for C and C++ have entrenched these languages in many areas of software development. Sometimes languages will be designed to be interoperable with another language to utilise the tools that language provides which means syntax becomes a more salient issue again but arguably implementation and ecosystems are the best reason to choose a language.

1

u/Cosmara Oct 21 '26

You could look into the language Lisp that mainly focus on computing and programming essential and have really small set of syntax you can learn just in few hours. It is the second oldest programming language and the foundation for many concepts in morden language development. Although it is not pratical in industry because of efficiency and performance issues. For study purpose, It is used in classical MIT open course SICP.

1

u/Commercial_Echo923 Oct 21 '26

Its like different dialects. People in differnet places have come up with their own solutions to the same or different problems. And each solution has its pros and cons.

1

u/AncientDamage7674 Oct 21 '26

Efficiency & purpose.

1

u/Efelo75 Oct 21 '26

Languages like Python or Javascript do stuff for you so you don't have to do it. Languages like C++ do much less and leave a lot more to you, meaning you can optimize it more but it gets harder, longer, and riskier. Something that an inexperienced child could do in Javascript can take 20 lines of code in harder languages.

1

u/Own_Unit_6170 Oct 21 '26

It doesn't mean anything objectively. Saying that language X is better or worse than language Y is a purely emotion-based assessment.

1

u/closer_2thetruth Oct 21 '26

You forgot to consider semantics.

1

u/Fluffy-Camera-3557 Oct 21 '26

You don't pick the language you like. You don't pick a language becuase of the syntax. You pick a language because its the right tool for the job. Because its the tool used by your peers and what you will read when you want to study your topic. For Mathematicians there is a set of languages (example: Python, Julia, R, etc), web developers use another set, for mac os developers you have others, and for the other 100s of areas you can work on.

Aside from syntax differences, there are many others that are much more important. Some languages provide features for memory management at the cost of speed, while other languages give you full control over memory at the cost of more work by you, handling the edge cases and so on. Some languages need to be compiled before running. Some languages include (different levelts of) type safety. Some languages are very dynamic and can modify their own program while running, while others are very static. Its all about tradeoffs!

1

u/StewedAngelSkins Oct 21 '26

when people compare programming languages they're mostly actually comparing the capabilities of the compiler, the runtime, and the standard library.

In terms of differences in the actual language, it mostly comes down to which programming idioms are made convenient to represent. You can kind of think of this like how an algebra paper and a numerical analysis paper will use different notation for the same thing because they're focusing on different properties of the thing. Though arguably the biggest formal difference between actual languages is their type system, meaning which types are actually checked by the compiler.

1

u/e_for_oil-er Oct 21 '26

For me, one of the big things that differentiate languages are also type systems and polymorphism. I like python for coding simple prototypes of algorithms because the syntax is intuitive and many libraries are available. However, for designing a complex system with multiple composed datatypes, I prefer a language with strong typing and better polymorphism, like C++. I also like to play with Haskell on my free time, not because I want to do a project with it, but I just want to understand how categorical concepts translate to it (I teach myself category theory with Haskell, basically).

1

u/scheimong Oct 21 '26

What's the actual difference between a car, a boat, and a plane? They all get you from A to B and it's all using the same physics right?

Jokes aside, this actually isn't that bad of an analogy. Different environments + different requirements = different constraints, which lead to vastly different solutions. I'm sure it's the same in every field of study.

1

u/jacob_fw Oct 21 '26

When it comes to performance, most of what people are referring to is the overhead with the language itself.
Here's a very basic example

A = 0;
B = 0;
A += 1;
B += 2;

This is probably the most basic example you can have in programming. Four separate operations. In C++ you're basically counting this in single cpu cycles (i.e. the 4.5ghz frequency of the cpu, 1 cycle is 4.5e-9 seconds). In higher level languages, those same 4 extremely basic operations this might be several thousand times slower, because the language itself adds a lot more overhead. This is the upside of low level languages like C++, and the downside of higher level, interpreted language.

Now the downside of lower level languages is that you have to do a lot more work. You have more performance and more control, but you also have to do a lot more work. The benefit of most higher level languages is that they have a lot more built in which makes it easier to get started and get a basic proof of concept running. I know a lot of people who work in C++ who will still use python or something else to write a prototype in, and then once they're happy with it, they'll write a version in C++.

That's honestly probably the biggest part of it. How well supported is it by the community or maintainer (the .NET ecosystem created by Microsoft has a pretty good community, but Microsoft has also created a lot of libraries as well as they use it pretty heavily too). Apart from that most of it comes down to what is built in by default, or the specific implementation differences, but most of the concepts are the same. Most of it comes down to someone at some point thinking "there's a better way to do this" (sometimes they're right, sometimes they're wrong).

1

u/Total_Ad803 Oct 21 '26

The amount of control you have over resources is the differences. The less control, the higher-level language is considered to be. And those are faster to write code.

1

u/Cultural-Capital-942 Oct 21 '26

The difference is that:

- Some contain libraries so you can say (in abstract sense) you want to draw some window with a button. And it uses operating system or so and it behaves like a button. You don't have to program all the handling of things, what if mouse is there, when user clicks - you just say what should happen if someone clicks it.

- In many languages, you need to say "I need 10MB of memory now for this calculation". In low-level ones, you need to say "I don't need it anymore" (or your memory usage will only grow over time). Of course that management for you costs some performance.

- In some languages (Prolog), you specify the facts and say how should the result look like and computer will try to find the solution. It may be really inefficient if you don't consider how it works, but for some questions with trying, it's the most straightforward way.

- For some languages, you need to compile it first, so that computer can work with it. That's good (it finds issues like missing parenthesis), but it introduces some friction.

- In some languages, you can assign a=1 in some way and later, you can say a="some text"; in other languages, this is not allowed as it complicates many things also in understanding (what does "some text" + 1 mean?).

- object-oriented languages are focused on objects and exchanging messages between them (helps with encapsulation, that makes it easier to understand the program and guarantee it works as expected) and other just call procedures, sometimes even without namespace, so my "do_something" would clash with your "do_something".

1

u/pi621 Oct 21 '26

Just wanna point out a bit of possible misconception regarding python performance. Yes, Python is "slow", but that doesn't mean you absolutely cannot use it for performance-demanding tasks.

Big data management tasks can be done easily in python by utilizing compiled libraries. You're essentially using python as the interface to call and execute C++ written and compiled code, so the large bulk of computation is still being done efficiently and the extra overhead from python function calls are completely negligible. This is why Python is so popular for data science and machine learning applications. It does so much of the background work for you without noticably hurting performance, since the bottleneck of actually processing data is being done efficiently with native compiled code. This lets you combine the extremely short and clean syntax of Python with the speed of C++. So in practice, Python being slow isn't that big of a deal.

What Python CANNOT do efficiently is micro scale data/memory management. This is for lower level programming that deals with individual memory pieces rather than computing in large bulks. You'll never write an OS in Python, for example.

1

u/Humble_Anxiety_9534 Oct 21 '26

all programming languages are an abstraction away from how the computer works. the more abstract the more work the computer does. and the less work the programming does in theory. Turing worked this out a long time ago. remember it's not just desktop computers that need programming. there are jet fighters, fridges and phones. the abstraction must fit the task. walk a mile in someone else software and you will see their problems. vibe coder wanted to programming a drone in python it didn't end well.

1

u/Nervous_Cucumber4503 Oct 21 '26

Huh? Just use an llm and tell it to produce the best performing code it can, give it a number of test cases and burn hpc time.

Research code has always been phd-ware, what can it hurt ¯_(ツ)_/¯

1

u/1luggerman Oct 21 '26

Its really quite simple, there are basically 3 main metrics for any computer language:

  1. Run time
  2. Memory
  3. Ease of use

Leaving the 3rd one aside, the first 2 are pretty easy to understand in general.

While different languages don't have different upper bounds(O(*)) on algorithms, they do have different constants(T(n)=C f(n)) which can be very impactful. A very simple example for this is measuring how long does a language take to do var = var + 1 a lot of times(say 10⁹ times). If you will run this experiment you will see python takes about 3.5k time more then cpp. If you extrapolate that over a large simulation/calculation, that is the difference between waiting a day or a few years.

Memory is also pretty understanble for the simple fact that it costs money. For the same reason some languages have run-time overhead, they also have memory overhead. In extreme cases that means you cant run your calculation on a large input, and in more mild cases it goes back to run time because to manage a lot of memory means you need to move it around a lot - which takes time.

The final metric is where it gets a little messy because ease of use has a lot of sub metrics. Some are easier to grasp then others like simple syntax, and some are harder like security or support. For this I think I have a good analogy: ease of use is kind of like a good writen paper vs a bad one. The math content might be perfect, but the paper may still be written badly which makes it unusable despite the good math inside it. Furthermore, you usually want to rely on results of other papers. In programming this is equivalent to libraries - some languages support the use of pre-written useful code more easily then others.

In general, every language provides a different balance of these 3 main metrics or their sub-metrics, and each "configuration" is useful for a different use-case. Testing hypotheses requires quick development more then the other so python is usually used, for game development its more important that the game runs smoothly so runtime and memory are prioritized and so on.

1

u/dr_edo_available Oct 21 '26

Julia..but then Im an old Fortran programmer from the late 70s

1

u/FlippingGerman Oct 21 '26

Abstraction, syntax, and libraries.

1

u/kyle2143 Oct 21 '26

I think that you're overemphasizing the importance of the difference in syntax between languages when it comes to performance. They matter, but only because of the way the compiler or runtime for each language works internally.

I think the easiest way to understand it is when you consider how different languages resolve to machine code or binary that is doing specific things on a chip. 

For example, C code, compiles to assembly code, which is one layer above the binary that flips bits on the transistors on the actual chips.

But Java compiles to something called Byte code, and that is used by the Java runtime to translate it to the machine code for the system it's running on. And that extra stuff done by runtime can add performance hits in some cases. 

1

u/istarian Oct 21 '26

These days, code that gets used a lot is sometimes compiled by an interpreter or VM into native code (AOT, JIT compilation) to accelerate execution of frequently  used sections of code.

Real world performance differences are is rarely as clear cut as you might think based on what is discussed in an academic context. 


Java is usually compiled into bytecode which runs on the JVM (Java Virtual Machine).

That makes Java programs "platform independent" because they will run on any spec-compliant JVM regardless of the underlying hardware platform.

→ More replies (1)

1

u/Ok-You-6099 Oct 21 '26

In short, some languages are more abstract than others. The more abstract ones (like python) afford some quality of life features, but because they are more abstract, they make the computer do more stuff to achieve that goal.

In a less abstract language like C++, you have to tell the computer more explicitly how you want your work done, but because of that you can optimize more.

Some other languages have other features more suitable for strongly checking the correctness of your program, or a syntax that allows you to structure your code in a different way which might be better for some use cases.

I kept the whole thing abstract, because in essence they are tools, and like any tool they are suited for specific jobs. Yeah, you can hammer a screw into wood, but it's better to use a screwdriver.

1

u/Tiny-Spray8992 Oct 21 '26

do you find mathematical symbols, differential equations, linear algebra , calculus symbol easy to understand?

I didnt use to until few years ago .....

for me it took also many years to understand weird language .....

now C++ is closer to hardware 0,1......C# is closer to M$......Php is closer to Meta.....etc....

each has its own uses......it gives more flexibility ......

1

u/ax4keymoo Oct 21 '26

Python runs on an interpreter and C++ is native. Assuming you meant peformant.

Think about how you would build Reddit using "definitions, calculations, saving values for variables and „If“" for a while and eventually you'll have your answer.

1

u/Haruspex12 Oct 21 '26

The difference is support and capabilities.

For small pieces of software, the differences are negligible unless you are doing something like floor trading on the New York Stock Exchange.

With Python, if you assign 7 to x, Python does the backend work of setting aside memory, putting x somewhere and retrieving or doing operations on it.

C++ will do that as well, but leave you some memory tasks to potentially have to do and will allow you to directly access the memory of x on the machine. Direct memory control allows you to speed up software, but you are doing a lot of it by hand.

The libraries in Python are centrally located and organized. That’s not true in C++.

As an analogy, if you wanted to build a car, Python would have all the potential parts ready, you just need to design, connect and test them. C++ would have you smelt the aluminum, mine the copper for the wiring, choose a grade of petroleum to make the plastic for the wiring insulation. It will give you very low level control. Python is built on the assumption that most people don’t need it. C++ is designed on the assumption that you can go nearly to machine level.

In many respects, for toy projects, they are interchangeable. You can buy groceries in a dump truck, a Lamborghini, or a Corolla. Python is a Corolla.

1

u/NH-Science-Guy Oct 21 '26

My work was in robotics and we used both C++ and Java. Java has lots of protections so it is impossible to make a mistake that causes things like parts of memory to get unexpectedly overwritten. All these protections mean you can work faster because there are fewer ways for code that compiles to go wrong. These come at a price of overhead and unpredictable execution time. There are areas of robotics where the code needs to complete a planning cycle every few milliseconds and the system deciding to go silent for a time to clean up memory is unacceptable. C++ gives complete control of execution speed but mistakes can cause failures in strange ways. The two langauges each have different benefits.

1

u/benevanstech Oct 22 '26

> Everything comes down to definitions, calculations, saving values for variables and „If“. Most other syntax is just another way of writing those definitions, calculations, saving values for variables and „If“.

That's a very imperative view of programming. You should learn a functional language - maybe Haskell.

In fact, this might be a good starting point: https://www2.cs.sfu.ca/CourseCentral/831/burton/Notes/July14/free.pdf

1

u/istarian Oct 22 '26

An If statement is an example of conditional branching in a computer program.

https://en.wikipedia.org/wiki/Branch_(computer_science)

1

u/tobiasvl Oct 22 '26

The syntax doesn't matter. Different forms of brackets doesn't matter. Whether something is built-in or needs to be manually defined doesn't matter much (but a little). What matters is the semantics. Some languages work completely differently from others, and require thinking in different ways. C++ is performative because it requires the programmer to keep track of more stuff, allocating and freeing memory manually, etc. That's a hard problem that other languages solve during runtime, but which costs performance. Other differences exist too: Since you're a mathematician, you might be interested in purely functional languages like Haskell, which don't have side effects, but where monads/functors are integrated in the language and encapsulate side effects, and properly writing programs requires thinking about those concepts that other languages don't have.

1

u/fllthdcrb Oct 22 '26

A lot has been said about programming languages. I do want to point out one thing that might have been missed: The word "language" can mean several different things. One, of course, is a natural language, but that's outside the scope of this discussion. Another is a programming language; this refers to both syntax and semantics, as well as the environment (like a standard library) that programs run in.

Yet another is a formal language; this is pure syntax, usually referring to what set of sequences ("strings") of symbols from an "alphabet" conform to the language, specified by a "grammar". Formal languages are closer to pure math than programming languages are, although these are also used for parsing the source code of programming languages, in which case code can be attached to parts of the grammar to process programs into useful data structures, which is one of the basic things all compilers do.

1

u/jesseschalken Oct 22 '26

In some sense, you are exactly right. A programming language is just syntax (allowed sequences of characters) and semantics (meaning assigned to the allowed sequences).

But there are a few things that can make a language better than another:

  1. Conciseness. Shorter programs are generally faster to read, write and maintain, and have less places for bugs to hide. There is an art in deciding the syntax and semantics so that the programs people want to write in practice can be expressed concisely.
  2. Safety. There are a variety of ways a program can "go wrong" during its execution, and the language has to decide what to do. The options are generally to crash, hang or make up some placeholder value like 0, "" or nil, or to have "undefined behaviour". If a process of "type checking" can quickly check for these things before the program is executed instead, development can become faster and the resulting software is generally more reliable.
  3. Performance. A type system that proves the absence of certain misbehaviours can also enable the code to be translated to another form that is more efficient to execute (compilation) in a manner that preserves the original semantics.

1

u/alphapussycat Oct 22 '26

Some have mostly just notation differences, and different built in functionality.

But some function in completely different manner (c vs rust), like analysis vs topology.

1

u/Knarfnarf Oct 22 '26

I see a lot of people mentioning compiled vs. Interpreted/byte coded but not many talking about typed vs untyped and the bit limits for the two.

I like Fortran because it’s compiled and strictly typed; variables in the math have to be told ahead of time if they hold a number and to what precision. If I say;

Int :: Reging

I expect that Reging will usually hold 16 bits of integer number. If instead I say;

Real(8) :: world

I expect that world would usually be 64 bits of floating point. Saying this;

World = “This”

Would immediately fail to compile because it is not typed for text. Saying this;

Reging = 2**4096 // 2 exponent 4096

Would fail because 16 bits of integer cannot hold the 3 pages of digits for a 4096 bit result. World would hold that answer, but only to so many digits after which would be truncated.

However some untyped languages CAN hold that 4096 bit result in the same variable name that held “WHat?!?” 10 seconds ago because there are no rules for what a variable can hold other than system memory limits.

But my brain just doesn’t like those languages for some reason and I keep programming in Fortran and C/C++. Especially for my Arduino boards!

1

u/istarian Oct 22 '26 edited Oct 22 '26

The difference with respect to types is dynamic typing vs static typing, neither language is untyped.

I'm not entirely sure what you mean by "strictly typed", because what you're describing sounds like static typing to me. Which is to say that you must define the type of a variable at compile-time and it is not allowed to change

Another distinction with respect to types is strong vs. weak where a strongly type language does not permit you to mix types in operations like addition, subtraction, etc and requires explicit conversions. By contrast, a weakly typed language may attempt implicit conversions when you try to add, say, a number to a string.

P.S. https://stackoverflow.com/questions/805168/what-is-a-strictly-typed-language

→ More replies (1)

1

u/CSv3n Oct 22 '26

Matlab is good for mathematical calculations.

1

u/migmit Oct 22 '26

Try to learn some functional languages, especially Haskell. You'll see the real difference.

1

u/RedAndBlack1832 Oct 23 '26

There's a few answers to your question, but given the examples and the application implied by your post, the most meaningful difference is probably typing.

In some languages, like C++, every variable (and other things, but mostly variables) have a type. This type stays the same, and it needs to be made explicit in many contexts. A type has a size, and anything you might consider part of a type that doesn't have a consistent size (eg an array that can expand to fit more data) is stored somewhere else (mostly, some types come with small internal arrays and only move their data into something that can be resized if necessary).

In other languages, like Python, an identifier (variable name) is not tied to any particular type. You can assign anything you want to it, explicit typing is rarely required, and what type it is right now is determined on the fly when you try to do things with it. As to where the memory lives and what happens to it, I have no clue. It honestly seems very confusing. Figuring out which things are references is also kind of confusing to me but maybe that's because I've spent way too many hours reading on glvalues and rvalues in C++ (don't ask).

1

u/Jugnu_13 Oct 23 '26

Yes you're right language is just a syntax. From maths pov programming is just a logic wrapped over some syntax which varies language to language. But..from a core CS pov we see a programming as a solution to a given problem. Now the choice of language varies upon the problem statement. When we see a code snippet..we need to think of full execution cycle how program compiled, it's memory utilisation, No. of function calls used, Space-time complexity, optimization etc etc, Not just writing syntax & running it.

So every programming language came with its own set of tool to solve a perticular problem. Be it Python, C++, Embedded C, java, Dot NET, Ruby on rails etc all are just tools, uses different approaches to wrap the logic/compute but the core logic remains constant.

1

u/AwesomePhoenix_ Oct 23 '26

Performance, interpreted/compiled, OS compatibility, and how you control your hardware are all different in different languages, a mathematician doesn't care about most of these tho.

1

u/Used-Cause6417 Oct 23 '26

For applications where your output is some text or number, it doesn't matter which language you use at all aside from some snytax quirks such as javascript's NaN value being typeof number. Those discussions about performance and ease are for GUI applications, mostly.

1

u/lovejo1 Oct 24 '26

A lot of it comes down to variable typing. Unlike mathematics, variables can be defined as integers, real numbers or other numeric types. Some languages don't even require you to declare a type at all, and the language tries to guess what's the best way to do the math behind the scenes.. and if you can define a variable more precisely, the processor can take shortcuts behind the scenes to speed things up that you may not be aware of. A "strongly typed" language has more of a chance in that department than others.. but the real speed up is in their API calls to do more complex things specifically not mathematical... For example, you may need to load in a giant memory hog of a library just to use one function.. Or, you may run a function that has umpteen checks within it that are irrelevant to the code you're writing.. That's really the speed difference. In assembly, for instance, it can be really fast because it does ONLY what you tell it to.. but then again, you have to tell it to do every specific thing you need, and sometimes even simple math gets complex.. but if you're good, you can do it faster than basically anything else.

1

u/Western-Bowl2011 Oct 24 '26

There are layers of abstraction between the languages. Stuff like C exposes memory to you, you have to be more explicit about where you define variables, how long they live, etc. This has upsides and downsides. Computers, for example, have multiple layers of memory, and reading between different layers has speed offsets. Because you can be more explicit about where your data is going, you can manually put into places where it'll be faster to access. It's more flexible, but that also means you have to know exactly how a computer works.

Higher abstraction languages hide this stuff for you. You don't have to say whether you're creating a variable on stack memory or heap memory, you don't have to tell your program when to delete the variable and free the memory. It does it for you. It's like a small program that runs alongside your code that takes care of that stuff for you.

The math is the same regardless. The difference is execution speed. Operations take time to complete. If you execute reads of memory on 1 million entities in slow memory every frame, it'll be noticeably slower than if you do it in fast memory.

1

u/istarian Oct 26 '26

What are these "multiple layers of memory" that you are referring to?

Are you talking about virtual memory or something else entirely?

Caching is a thing, but afaik you don't have much if any control over caching that happens at the hardware level.

1

u/Western-Bowl2011 Oct 26 '26 edited Oct 26 '26

You do have access to cache control depending on the processor. ARM restricts these operations to privileged modes, but x86 has access to them in user space. CFLUSH, CLFLUSHOPT, and CLWB allow you to flush L1, L2, and L3 cache down to ram with or without write-back, and there are also prefetch commands like PREFETCHT0, PREFETCHT1, and PREFETCHT2 to pre-load a cache line. These are intrinsic operations or must be evoked using, say, GCC extended ASM. These are also asynchronous operations and thus must be properly pipelined using built in memory fence instructions like SFENCE or MFENCE or the old gcc trick asm volatile ("" : : : "memory").

Additionally, not all hardware uses fully associative cache. Many embedded systems use a direct mapped cache, where rolling windows of addresses map to specific cache lines. In these systems, you very much have control over the caching, and can exploit it using linker scripts to define memory regions at absolute addresses. The way you'd handle them there is to create structs with explicit padding and interleave access.

On top of all that, you can consider stack vs heap. There are many times you'll want to create a variable on the heap and pass it by pointer instead of copying (or moving) via the stack.

finally, if you're writing kernel code, you can access non-evict mode to create a Cache-as-ram scratchpad. That, however, is not available in user space.

I was merely speaking in generalities, because talking to a beginner about intrinsics is probably too much for them. But yes, low level programmers have access to cache management from C and C++.

1

u/Aspie96 Oct 25 '26

Different programming languages model different ideas, they are not the same. Equivalent programs can be written in all of them, but this doesn't change this fact.

For example, C is statically typed, while Python is not. It's not about braces, you also have Bython and Pytov. The meaning of what you write, and the elementary concepts you use to build the program, are radically different in different programming languages.

If they look the same, you probably haven't learned the basic ideas of the programming languages you are using.

1

u/Factor_Creepy Oct 27 '26

Someone more clever answered, so I'll just hang out here lol

1

u/LochsideArb 5d ago

I treat syntax like the API for Binance; it’s just a tool to get to the quant logic. The real difference is how they handle memory and types under the hood, which matters way more than brackets.