Questions tagged [language-features]

A language feature is a distinct aspect of a programming language, such as binding rules, lexical design, or facets of the type system.

613 questions
155
votes
10 answers

Why are private fields private to the type, not the instance?

In C# (and many other languages) it's perfectly legitimate to access private fields of other instances of the same type. For example: public class Foo { private bool aBool; public void DoBar(Foo anotherFoo) { if…
RichK
  • 9,771
  • 5
  • 32
  • 47
150
votes
10 answers

What is the tilde (~) in the enum definition?

I'm always surprised that even after using C# for all this time now, I still manage to find things I didn't know about... I've tried searching the internet for this, but using the "~" in a search isn't working for me so well and I didn't find…
hugoware
  • 33,265
  • 24
  • 58
  • 70
134
votes
3 answers

VB.NET equivalent of C# property shorthand?

Is there a VB.NET equivalent to the C#: public string FirstName { get; set; } I know you can do Public Property name() As String Get Return _name.ToString End Get Set(ByVal value As String) _name = value End Set End…
Birk
  • 2,091
  • 4
  • 21
  • 26
123
votes
2 answers

Python ? (conditional/ternary) operator for assignments

C and many other languages have a conditional (AKA ternary) operator. This allows you to make very terse choices between two values based on the truth of a condition, which makes expressions, including assignments, very concise. I miss this because…
Will
  • 68,898
  • 35
  • 156
  • 231
121
votes
12 answers

Why is there a `null` value in JavaScript?

In JavaScript, there are two values which basically say 'I don't exist' - undefined and null. A property to which a programmer has not assigned anything will be undefined, but in order for a property to become null, null must be explicitly assigned…
Christoph
  • 149,808
  • 36
  • 172
  • 230
110
votes
36 answers

Hidden features of HTML

HTML being the most widely used language (at least as a markup language) has not gotten its due credit. Considering that it has been around for so many years, things like the FORM / INPUT controls have still remained same with no new controls…
Binoj Antony
  • 15,352
  • 24
  • 86
  • 95
110
votes
6 answers

When do I need to use Begin / End Blocks and the Go keyword in SQL Server?

Can someone tell me when and where I need to use begin and end blocks in SQL Server? Also, what exactly does the Go keyword do?
Tarik
  • 73,061
  • 78
  • 222
  • 327
106
votes
9 answers

What is the purpose of python's inner classes?

Python's inner/nested classes confuse me. Is there something that can't be accomplished without them? If so, what is that thing?
Geo
  • 85,654
  • 109
  • 315
  • 497
99
votes
4 answers

The written versions of the logical operators

This is the only place I've ever seen and, or and not listed as actual operators in C++. When I wrote up a test program in NetBeans, I got the red underlining as if there was a syntax error and figured the website was wrong, but it is NetBeans which…
defectivehalt
  • 2,302
  • 2
  • 20
  • 22
99
votes
8 answers

What unique features does Firebug have that are not built-in to Firefox?

I just cleaned my Firefox addons and wondered: Which features does Firebug have that make it unique? Which features are available in both Firebug and the Firefox Developer Tools?
janpio
  • 9,466
  • 12
  • 54
  • 99
95
votes
18 answers

Samples of Scala and Java code where Scala code looks simpler/has fewer lines?

I need some code samples (and I also really curious about them) of Scala and Java code which show that Scala code is more simple and concise then code written in Java (of course both samples should solve the same problem). If there is only Scala…
Roman
  • 59,060
  • 84
  • 230
  • 322
84
votes
3 answers

Why isn't the eigenclass equivalent to self.class, when it looks so similar?

I've missed the memo somewhere, and I hope you'll explain this to me. Why is the eigenclass of an object different from self.class? class Foo def initialize(symbol) eigenclass = class << self self end eigenclass.class_eval do …
Robert K
  • 28,868
  • 12
  • 59
  • 77
83
votes
9 answers

Why C# doesn't implement indexed properties?

I know, I know... Eric Lippert's answer to this kind of question is usually something like "because it wasn't worth the cost of designing, implementing, testing and documenting it". But still, I'd like a better explanation... I was reading this blog…
Thomas Levesque
  • 270,447
  • 59
  • 580
  • 726
81
votes
30 answers

Best javascript syntactic sugar

Here are some gems: Literals: var obj = {}; // Object literal, equivalent to var obj = new Object(); var arr = []; // Array literal, equivalent to var arr = new Array(); var regex = /something/; // Regular expression literal, equivalent to var regex…
eyelidlessness
  • 58,600
  • 11
  • 86
  • 93
74
votes
18 answers

What are C macros useful for?

I have written a little bit of C, and I can read it well enough to get a general idea of what it is doing, but every time I have encountered a macro it has thrown me completely. I end up having to remember what the macro is and substitute it in my…
Jack Ryan
  • 8,148
  • 3
  • 34
  • 74
1
2
3
40 41