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
72
votes
4 answers
Python type() or __class__, == or is
I want to test whether an object is an instance of a class, and only this class (no subclasses). I could do it either with:
obj.__class__ == Foo
obj.__class__ is Foo
type(obj) == Foo
type(obj) is Foo
Are there reasons to choose one over another?…

mgibsonbr
- 21,755
- 7
- 70
- 112
69
votes
4 answers
What's the difference between a hash and hash reference in Perl?
I would like to properly understand hashes in Perl. I've had to use Perl intermittently for quite some time and mostly whenever I need to do it, it's mostly related to text processing.
And everytime, I have to deal with hashes, it gets messed up. I…

user855
- 19,048
- 38
- 98
- 162
69
votes
12 answers
Will a future version of .NET support tuples in C#?
.Net 3.5 doesn't support tuples. Too bad, But not sure whether the future version of .net will support tuples or not?

Graviton
- 81,782
- 146
- 424
- 602
68
votes
5 answers
Double dispatch in C#?
I have heard/read the term but don't quite understand what it means.
When should I use this technique and how would I use it? Can anyone provide a good code sample?

Oded
- 489,969
- 99
- 883
- 1,009
67
votes
5 answers
Why does Java permit escaped unicode characters in the source code?
I recently learned that Unicode is permitted within Java source code not only as Unicode characters (eg. double π = Math.PI; ) but also as escaped sequences (eg. double \u03C0 = Math.PI; ).
The first variant makes sense to me - it allows programmers…

Zaven Nahapetyan
- 1,259
- 1
- 10
- 15
62
votes
1 answer
Problem understanding C# type inference as described in the language specification
The C# language specification describes type inference in Section §7.5.2. There is a detail in it that I don’t understand. Consider the following case:
// declaration
void Method(T obj, Func func);
// call
Method("obj", s => (object)…

Timwi
- 65,159
- 33
- 165
- 230
62
votes
8 answers
Javascript as a functional language
I am looking get to grips with functional programming concepts.
I've used Javascript for many years for client side scripting in web applications and apart from using prototypes it was all simple DOM manipulation, input validation etc.
Of late, I…

Ash
- 60,973
- 31
- 151
- 169
58
votes
9 answers
Why isn't there an endianness modifier in C++ like there is for signedness?
(I guess this question could apply to many typed languages, but I chose to use C++ as an example.)
Why is there no way to just write:
struct foo {
little int x; // little-endian
big long int y; // big-endian
short z; // native…

Lena Schimmel
- 7,203
- 5
- 43
- 58
52
votes
5 answers
C# method call with parameter name and colon
I've begun to notice at times when I'm making method calls in C# that the names of the parameters for the method I'm calling will show up in the intellisense list appended with a colon, and that I can then format the method call…

Zann Anderson
- 4,767
- 9
- 35
- 56
50
votes
6 answers
What is a maximum number of arguments in a Python function?
It's somewhat common knowledge that Python functions can have a maximum of 256 arguments. What I'm curious to know is if this limit applies to *args and **kwargs when they're unrolled in the following manner:
items = [1,2,3,4,5,6]
def…

Soviut
- 88,194
- 49
- 192
- 260
49
votes
6 answers
Methods in Ruby: objects or not?
Inspired by this discussion, after some googling I wasn't able to find an answer to a pretty simple question regarding methods in Ruby: are methods objects or not?
There are different opinions here and there, and I would really like to hear, let's…

Mladen Jablanović
- 43,461
- 10
- 90
- 113
47
votes
7 answers
What is the purpose of long, double, byte, char in Java?
So I'm learning java, and I have a question. It seems that the types int, boolean and string will be good for just about everything I'll ever need in terms of variables, except perhaps float could be used when decimal numbers are needed in a…

Ali
- 261,656
- 265
- 575
- 769
46
votes
4 answers
Why do enums have computed properties but not stored properties in Swift?
I am new to Swift and just came across this in the documentation:
Computed properties are provided by classes, structures, and
enumerations. Stored properties are provided only by classes and
structures.
Why is that? Do associated values for…

Adit Gupta
- 1,314
- 1
- 18
- 32
44
votes
5 answers
44
votes
2 answers
Equivalent of Class Loaders in .NET
Does anyone know if it possible to define the equivalent of a "java custom class loader" in .NET?
To give a little background:
I am in the process of developing a new programming language that targets the CLR, called "Liberty". One of the features…

Scott Wisniewski
- 24,561
- 8
- 60
- 89