Questions tagged [language-comparison]

For questions comparing the implementation of a feature on different languages.

Filter by
Sorted by
Tagged with
83 votes
7 answers
11k views

How can we compare expressive power between two Turing-complete languages?

Is this possible? Is there an accepted (and unambiguous) notion of "expressive power" that could differ between two different Turing-complete languages? It seems like, for example, Python is ...
David Young's user avatar
  • 2,127
42 votes
13 answers
1k views

What are different ways of handling runtime errors?

Most languages have a system where exceptions are classes and you can throw them then use a try/catch block to handle them. What ...
mousetail's user avatar
  • 8,199
38 votes
6 answers
3k views

Why do some PL choose to have a dedicated keyword for elseif instead of like in C?

In C, else if is nothing but a new if statement after a single-statement else clause. Why do ...
ice1000's user avatar
  • 2,414
27 votes
13 answers
2k views

What are the drawbacks of using indentation for code blocks?

I'm not aware of any language other than Python that uses indentation to denote code blocks. To me, it seems like the simplest way to indicate blocks, and it also encourages proper formatting by ...
Someone's user avatar
  • 379
20 votes
3 answers
557 views

Which horizontal whitespace should be supported?

There seems to be three approaches to horizontal whitespace for separating tokens: Only tab and space: Bash, C, D, Dart, Go, Java, Lua, OCaml, Python, PHP, Perl, Ruby, Rust, Scala, Swift (also ...
Adám's user avatar
  • 3,138
17 votes
15 answers
1k views

What are the syntax options for implementing a ternary "if" operator?

The ternary "if" operator is a syntactic construct for returning one of two values based upon a boolean condition. In most C-family languages its syntax resembles ...
Ginger's user avatar
  • 2,599
13 votes
2 answers
463 views

Can Felleisen's expressivity metric be abused to construct ever more expressive languages that aren't actually more expressive?

The idea of comparing the expressivity of languages objectively using various metrics is very interesting. A particularly interesting answer is Matthias Felleisen's formal notion of expressivity. I ...
Bruce Adams's user avatar
  • 2,833
11 votes
2 answers
463 views

What are the different types of import semantics?

As per my current understanding, there are many different ways that imports, and other related operations, are handled in different programming languages. For example, ...
FireTheLost's user avatar
  • 1,603
-4 votes
2 answers
282 views

Why does Python not allow us to call functions like other languages do?

What many other languages do In many languages, I can have a function defined in a file called get_xyz.m (for example) and then other functions or scripts can use ...
Nike Dattani's user avatar