Questions tagged [language-comparisons]

Questions comparing two or more programming or markup languages against each other.

Usage guidance

Questions and answers on Stackoverflow are generally intended to discuss specific features with one or more repeatable and unambiguous solutions.

Consequently, the language-comparisons tag is intended to cover cases where:

  • two or more languages implement the same or substantially similar functionality
  • the functionality comparison is capable of unambiguous identification and resolution
  • such resolution does not require extended discussion or rely solely on subjective personal opinions or personal preference
124 questions
72
votes
8 answers

What is the idiomatic way to slice an array relative to both of its ends?

Powershell's array notation has rather bizarre, albeit documented, behavior for slicing the end of arrays. This section from the official documentation sums up the bizarreness rather well: Negative numbers count from the end of the array. For…
alx9r
  • 3,675
  • 4
  • 26
  • 55
72
votes
21 answers

Is Grails (now) worth it?

I know this is a duplicate, however, the Grails world has moved on considerably since that question was asked more than a year ago, as has the IDE support in Eclipse, so please don't just blindly close it. I thought the answer was yes and have…
Simon
  • 78,655
  • 25
  • 88
  • 118
67
votes
11 answers

Make Javascript do List Comprehension

What is the cleanest way to make Javascript do something like Python's list comprehension? In Python if I have a list of objects whose name's I want to 'pull out' I would do this... list_of_names = [x.name for x in list_of_objects] In javascript I…
Chris W.
  • 37,583
  • 36
  • 99
  • 136
63
votes
7 answers

Is there something in PHP equivalent to LINQ in C#?

Is there something in PHP equivalent to LINQ in C#?
eomeroff
  • 9,599
  • 30
  • 97
  • 138
61
votes
4 answers

What are the PowerShell equivalents of Bash's && and || operators?

In Bash I can easily do something like command1 && command2 || command3 which means to run command1 and if command1 succeeds to run command2 and if command1 fails to run command3. What's the equivalent in PowerShell?
Andrew J. Brehm
  • 4,448
  • 8
  • 45
  • 70
61
votes
5 answers

YAML compared to XML

I read that after years yaml will be used instead of xml. Please compare the relative advantages and disadvantages of each specification.
Iguramu
  • 2,080
  • 5
  • 26
  • 30
57
votes
10 answers

Is there const in C?

This question may be naive, but: is there const keyword in C? since which version? are there any semantic and/or syntactic differences between const in C and C++?
Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
56
votes
6 answers

Disadvantages of Scala type system versus Haskell?

I have read that Scala's type system is weakened by Java interoperability and therefore cannot perform some of the same powers as Haskell's type system. Is this true? Is the weakness because of type erasure, or am I wrong in every way? Is this…
54
votes
10 answers

equivalent of vbCrLf in c#

I have a to do this: AccountList.Split(vbCrLf) In c# AccountList is a string. How can i do? thanks
Luca Romagnoli
  • 12,145
  • 30
  • 95
  • 157
48
votes
10 answers

Does Python do variable interpolation similar to "string #{var}" in Ruby?

In Python, it is tedious to write: print "foo is" + bar + '.' Can I do something like this in Python? print "foo is #{bar}."
mko
  • 21,334
  • 49
  • 130
  • 191
46
votes
5 answers

What is the equivalent of a Python docstring in Ruby?

In Python, you can access an object's docstring by using obj.__doc__. What is the equivalent action in Ruby?
parzival
  • 1,536
  • 2
  • 19
  • 27
45
votes
2 answers

Initialize dictionary at declaration using PowerShell

Given this powershell code: $drivers = New-Object 'System.Collections.Generic.Dictionary[String,String]' $drivers.Add("nitrous","vx") $drivers.Add("directx","vd") $drivers.Add("openGL","vo") Is it possible to initialize this dictionary directly…
C.J.
  • 15,637
  • 9
  • 61
  • 77
45
votes
9 answers

F# vs Haskell vs Lisp - which language to learn?

I've heard a lot about functional programming languages and I'm willing to learn one. I guess it will be mostly for fun, however, I hope it will improve my programming skills. I have mostly C#/.NET background, so my first choice is to learn F#…
empi
  • 15,755
  • 8
  • 62
  • 78
44
votes
4 answers

PHP equivalent of Python's __name__ == "__main__"?

As per the title, is there PHP equivalent of __name__ == "__main__"? Is there something that would work for both scripts executed through the command line and through a web request, or would a custom function be needed? For those unfamiliar with…
Shabbyrobe
  • 12,298
  • 15
  • 60
  • 87
36
votes
10 answers

What advantages does modern Fortran have over modern C++?

I'm trying to decide between Fortran and C++ for an application in scientific computing. It's not clear to me if Fortran still has advantages over other languages when it comes to performance. For example, I believe since Fortran enforces strict…
royco
  • 5,409
  • 13
  • 60
  • 84
1
2
3
8 9