Questions tagged [language-comparison]

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

Filter by
Sorted by
Tagged with
4 votes
4 answers
448 views

What programming languages contain a built-in imaginary data type?

Many languages like R, Julia, and Python store imaginary numbers as a complex number with a 0 valued real component. We may see this with the following R code: ...
Adam Hyland's user avatar
7 votes
0 answers
379 views

What do you mean by the ‘computational model’ of a programming language?

What do you mean by the ‘computational model’ of a programming language? Are ‘abstract machines’ such as Stack, RAM, and Warren Abstract Machine (WAM) examples of computational models? Is the ...
Stephen's user avatar
  • 179
-4 votes
2 answers
283 views

What makes a very high level language? [closed]

Outline of question+justification soon to be expanded: Managing Complexity is job #1 Abstraction is our #1 tool A VHLL does abstraction best So VHLL's should be our aim Talking about VHLL's, with his ...
MicroservicesOnDDD's user avatar
25 votes
5 answers
4k views

I want to make breaking changes to my language, what techniques exist to allow a smooth transition of the ecosystem?

Alas, when developing my language I may have made some decisions that turned out less than ideal in hindsight. Some I managed to fix in a backwards compatible way, but others will require breaking ...
mousetail's user avatar
  • 8,111
12 votes
2 answers
455 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,793
3 votes
2 answers
178 views

Can I use monadic types without needing colored functions?

The inspiration for this question There are many advantages of using monadic types like Promise<T> or Result<T> as ...
mousetail's user avatar
  • 8,111
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
  • 1,967
2 votes
3 answers
307 views

What are the differences between designing a print function Python-style as opposed to C-style?

A regular Python print statement might look like this (Dart printing looks similar to this): print(a_number) # for a number print(a_string) # for a string These ...
Redz's user avatar
  • 900
-5 votes
1 answer
169 views

Are you allowed to use almost identical language to another language? [closed]

In Python, you use the term print. If there was another language that worked in the exact same way as Python, but used slightly different terms (like ...
taylor.2317's user avatar
2 votes
4 answers
193 views

What are the different ways of implementing special methods?

What mechanisms could languages use to detect certain methods and handle them specially? For example, in Python, special methods are named differently, using double underscores: ...
nchistov's user avatar
  • 1,585
0 votes
3 answers
144 views

Should a REPL show null values as null? [closed]

I'm working on a REPL for a language that has a null value, and I'm not sure how to represent it in the output. The behavior of existing REPLs seems to be either to represent it by its name (...
Ginger's user avatar
  • 2,579
12 votes
3 answers
2k views

Why does Rust have an infinite loop construct?

The Rust programming language has an infinite loop construct, which looks like this: loop { <some code> } It's the only language I can think of that has ...
Ginger's user avatar
  • 2,579
11 votes
7 answers
416 views

What are the different ways of handling multiple return values?

(inspired by this question) Different programming languages handle multiple return values differently, used in functions such as divmod. For example, in Python or ...
naffetS's user avatar
  • 1,027
15 votes
1 answer
182 views

Segmented Stack Efficiency

Segmented stacks are one method to enable the growth of execution stacks in multi-threaded paradigms at runtime, instead of having to statically pre-allocate a fixed-sized stack at compile time. Some ...
WormholeX's user avatar
  • 153
2 votes
2 answers
105 views

What syntax options exist for variable destructuring/unpacking?

Some languages allow you to write something like x, y, z = (1, 2, 3) Which is equivalent to x = 1 y = 2 z = 3 What are some of ...
lyxal's user avatar
  • 1,775
11 votes
2 answers
405 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,583
-4 votes
2 answers
277 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
16 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,579
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
-3 votes
1 answer
221 views

In Julia, what is the benefit of requiring commas between elements when defining a vector for a dot product?

Introduction (Python, MATLAB/Octave, Julia) One of things about MATLAB/Octave that I find very convenient is the simplicity when defining vectors. For example: ...
Nike Dattani's user avatar
41 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,111
37 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,384
20 votes
3 answers
532 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,118