Questions tagged [language-features]

Questions about distinctive aspects of particular computer languages, particularly in the way they are written or in the expressive capabilities provided to the programmer.

Computer languages offer a very wide range of different lexical, syntactical and semantic features, and vary widely in the style and approach by which they allow a programmer to express a particular requirement.

In the widest sense, the concept embraces the level of the language (high or low), its portability (working on different machines), its standards compliance, whether it is imperative or functional, whether general purpose or domain specific.

In the more usual sense it deals with coding features such as how comments and tokens are written, available types, strongly typed or not, object model (if any), how to express looping and branching, and how it supports functions and modules/components.

150 questions
162
votes
9 answers

What is a closure?

Every now and then I see "closures" being mentioned, and I tried looking it up but Wiki doesn't give an explanation that I understand. Could someone help me out here?
gablin
  • 17,377
  • 22
  • 89
  • 138
88
votes
63 answers

What features would you like to have in PHP?

Since it's the holiday season now and everybody's making wishes, I wonder - which language features you would wish PHP would have added? I am interested in some practical suggestions/wishes for the language. By practical I mean: Something that can…
StasM
  • 3,377
  • 2
  • 23
  • 28
73
votes
6 answers

When is a feature considered a "First class citizen" in a programming language/platform?

I have seen many times statements like- "Please make this feature a first class citizen in so and so language/platform". For example, it is said about enums in C#/.net. So, when is a feature considered a "First class citizen" in a programming…
Gulshan
  • 9,402
  • 10
  • 58
  • 89
55
votes
8 answers

Why design a modern language without an exception-handling mechanism?

Many modern languages provide rich exception handling features, but Apple's Swift programming language does not provide an exception handling mechanism. Steeped in exceptions as I am, I'm having trouble wrapping my mind around what this means. Swift…
orome
  • 703
  • 1
  • 5
  • 10
43
votes
10 answers

Why do most mainstream languages not support "x < y < z" syntax for 3-way Boolean comparisons?

If I want to compare two numbers (or other well-ordered entities), I would do so with x < y. If I want to compare three of them, the high-school algebra student will suggest trying x < y < z. The programmer in me will then respond with "no, that's…
43
votes
7 answers

Why the static data members have to be defined outside the class separately in C++ (unlike Java)?

class A { static int foo () {} // ok static int x; // <--- needed to be defined separately in .cpp file }; I don't see a need of having A::x defined separately in a .cpp file (or same file for templates). Why can't be A::x declared and defined…
iammilind
  • 2,232
  • 4
  • 24
  • 35
41
votes
40 answers

Is anything in programming truly evil?

So, there are a bunch of questions appearing asking is X evil, is Y evil. My view is that there are no language constructs, algorithms or whatever which are evil, just ones which are badly used. Hell, if you look hard enough there are even valid…
Jon Hopkins
  • 22,734
  • 11
  • 90
  • 137
39
votes
8 answers

Is it actually possible to have a 'useful' programming language that isn't Turing complete?

Where it is accepted that a language has to be Turing complete to be any good, is it actually possible to have a 'useful' programming language that isn't Turing complete? I should clarify that this is quite specifically about 'programming' languages…
PhonicUK
  • 1,047
  • 3
  • 11
  • 12
38
votes
5 answers

Java dev learning Python: what concepts do I need to wrap my head around?

Background: I've run through a few tutorials and written some small projects. All is going well enough using Google and StackOverflow. Several times in the last few days I've found myself wondering "what am I missing?" - I feel that I'm still…
LRE
  • 728
  • 5
  • 10
37
votes
2 answers

What are 4th & 5th programming language generations? Are there more of them?

As it is often classified at school/college level, popular programming languages (C#, Java, C++) are all 3rd generation languages (with higher level of abstraction from the machine's physical parts). Also, assembly languages are classified as 2nd…
Ali
  • 1,222
  • 2
  • 13
  • 27
36
votes
6 answers

Why is studying a Lisp interpreter in lisp so important?

I have seen many CS curriculums and learning suggestions for new programmers that call for the aspiring programmer to study a Lisp interpreter that is specifically written in Lisp. All these sites say things similar to, "its an intellectual…
33
votes
7 answers

Is Haskell's type system an obstacle to understanding functional programming?

I'm studying Haskell for the purpose of understanding functional programming, with the expectation that I'll apply the insight that I gain in other languages (Groovy, Python, JavaScript mainly.) I choose Haskell because I had the impression that it…
31
votes
4 answers

Why aren't `void *`'s implicitly cast in C++?

In C, there is no need to cast a void * to any other pointer type, it is always safely promoted. However, in C++, this is not the case. E.g., int *a = malloc(sizeof(int)); works in C, but not in C++. (Note: I know that you shouldn't use malloc in…
wolfPack88
  • 678
  • 2
  • 7
  • 15
29
votes
9 answers

In OOP, isn't the 'protected' keyword required?

Some modern languages (e.g. Swift, Dart) do not support the protected access modifier keyword. Swift is a protocol-oriented language, but I've heard that Dart is a completely object-oriented language. Why don't these modern languages ​​support…
29
votes
13 answers

Why aren't databases integrated as a language feature?

Are there any programming languages that have a built-in database as a first-class language feature rather than connecting to an external SQL (or other) database? What would be the drawbacks and benefits to such a feature? What would such a feature…
1
2 3
9 10