A language feature is a distinct aspect of a programming language, such as binding rules, lexical design, or facets of the type system.
Questions tagged [language-features]
618 questions
10
votes
2 answers
Python descriptor protocol analog in other languages?
Is there something like the Python descriptor protocol implemented in other languages? It seems like a nice way to increase modularity/encapsulation without bloating your containing class' implementation, but I've never heard of a similar thing in…

cdleary
- 69,512
- 53
- 163
- 191
10
votes
3 answers
Catch access to undefined property in JavaScript
The Spider-Monkey JavaScript engine implements the __noSuchMethod__ callback function for JavaScript Objects.
This function is called whenever JavaScript tries to execute an undefined method of an Object.
I would like to set a callback function to…

avri
- 125
- 2
- 11
10
votes
3 answers
Call/Return feature of classic C++(C with Classes), what modern languages have it?
On page 57 of The Design and Evolution of C++, Dr. Stroustrup talks about a feature that was initially part of C with Classes, but it isn't part of modern C++(standard C++). The feature is called call/return. This is an example:
class myclass
{
…

Khaled Alshaya
- 94,250
- 39
- 176
- 234
10
votes
4 answers
What is the difference between "new Number(...)" and "Number(...)" in JavaScript?
In Javascript, one of the reliable ways to convert a string to a number is the Number constructor:
var x = Number('09'); // 9, because it defaults to decimal
Inspired by this question, I started wondering — what is the difference between the above…

Nicole
- 32,841
- 11
- 75
- 101
10
votes
3 answers
Are move semantics incomplete?
Move semantics replace copy semantics in situations where copying is inefficient. Copy semantics deals fully with copyable objects, including const objects.
Already, there exists a myriad of non-copyable objects in c++11, for example…

user3125280
- 2,779
- 1
- 14
- 23
10
votes
8 answers
Why doesn't 'using' have a catch block?
I understand the point of "using" is to guarantee that the Dispose method of the object will be called. But how should an exception within a "using" statement be handled? If there is an exception, I need to wrap my "using" statement in a try…

SwDevMan81
- 48,814
- 22
- 151
- 184
9
votes
16 answers
What's the bright side of Cobol?
I love spending my time investigating cool features of languages, even if I won't have a chance to use them anytime soon, but keep hearing only bad things about Cobol, but I'm sure it must of had some nice features for it to become as important as…

Robert Gould
- 68,773
- 61
- 187
- 272
9
votes
4 answers
What does C++ using mean inside a class?
What does it mean to have a using inside a class definition?
class myClass {
public:
[...]
using anotherClass::method;
};

WilliamKF
- 41,123
- 68
- 193
- 295
9
votes
1 answer
The missing folds
If you want to fold a list, I see four ways to do it.
Fold from the right of the list, with the recursive term on the right
foldrr (-) 100 [1..10] = 1 - (2 - (3 - (4 - (5 - (6 - (7 - (8 - (9 - (10 - (100)))))))))) = 95
foldrr :: (a -> b -> b) ->…

martin
- 1,102
- 2
- 12
- 20
9
votes
7 answers
Why static Structures are not allowed in C#?
I always used to consider structures as some sort of lesser privileged things, or something with lesser features. Maybe because of the OOP concepts blowing everything into Classes.
From the little amount of exposure to C#, I understand that Setting…

loxxy
- 12,990
- 2
- 25
- 56
9
votes
3 answers
Which "C# Experimental language feature" is this?
In the example below, Resharper shows "C# Experimental language feature" tooltip on the first curly bracket. I've checked the new features of C# 6.0 but didn't come across a similar one. What is the referred experimental feature?
class Class1
{
…

henginy
- 2,041
- 1
- 16
- 27
9
votes
4 answers
How to define a ternary operator in Scala which preserves leading tokens?
I'm writing a code generator which produces Scala output.
I need to emulate a ternary operator in such a way that the tokens leading up to '?' remain intact.
e.g. convert the expression c ? p : q to c something. The simple if(c) p else q fails my…

Alex R
- 11,364
- 15
- 100
- 180
9
votes
1 answer
Are Scala "continuations" just a funky syntax for defining and using Callback Functions?
And I mean that in the same sense that a C/Java for is just a funky syntax for a while loop.
I still remember when first learning about the for loop in C, the mental effort that had to go into understanding the execution sequence of the three…

Alex R
- 11,364
- 15
- 100
- 180
9
votes
5 answers
Scala puts precedence on implicit conversion over "natural" operations... Why? Is this a bug? Or am I doing something wrong?
This simple test, of course, works as expected:
scala> var b = 2
b: Int = 2
scala> b += 1
scala> b
res3: Int = 3
Now I bring this into scope:
class A(var x: Int) { def +=(y:Int) { this.x += y } }
implicit def int2A(i:Int) : A = new A(i) …

Alex R
- 11,364
- 15
- 100
- 180
9
votes
9 answers
What features is lisp lacking?
I have read that most languages are becoming more and more like lisp, adopting features that lisp has had for a long time. I was wondering, what are the features, old or new, that lisp does not have? By lisp I mean the most common dialects like…

bennybdbc
- 1,425
- 3
- 15
- 24