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.

618 questions
11
votes
4 answers

How much of the "Objective-C" I'm learning is universal Objective-C, and not Apple's frameworks?

This question is related to one of my others about C: What can you do in C without “std” includes? Are they part of “C,” or just libraries? I've become curious lately as to what is really contained the the core Objective-C language, and what parts…
11
votes
8 answers

Why is there no string interpolation in Scala?

This is not just an idle quip... I wonder if anybody knows if there's an actual design reason why Scala does not support interpolation similar to Groovy and other "syntactically better Javas"? e.g. var str1 = "World"; var str2 = "Hello, ${str1}";
Alex R
  • 11,364
  • 15
  • 100
  • 180
11
votes
3 answers

How would you go about implementing off-side rule?

I've already written a generator that does the trick, but I'd like to know the best possible way to implement the off-side rule. Shortly: Off-side rule means in this context that indentation is getting recognized as a syntactic element. Here is the…
11
votes
9 answers

Why are there finalizers in java and c#?

I'm not quite understanding why there are finalizers in languages such as java and c#. AFAIK, they: are not guaranteed to run (in java) if they do run, they may run an arbitrary amount of time after the object in question becomes a candidate for…
RCIX
  • 38,647
  • 50
  • 150
  • 207
11
votes
3 answers

Why is _GNU_SOURCE macro required for pthread_mutexattr_settype() while it is in POSIX/IEEE standard?

I have written a multithread server program in C, which echoes back all the data that a client sends. Initially, I used poll() function in my program to detect POLLRDHUP event, for that I defined _GNU_SOURCE macro (This event is defined here).…
0xF1
  • 6,046
  • 2
  • 27
  • 50
11
votes
7 answers

Why doesn't VB.NET 9 have Automatic Properties like C# 3?

Would having a nice little feature that makes it quicker to write code like Automatic Properties fit very nicely with the mantra of VB.NET? Something like this would work perfect: Public Property FirstName() As String Get Set End…
Chris Pietschmann
  • 29,502
  • 35
  • 121
  • 166
11
votes
2 answers

Should I Use self Keyword (Properties) In The Implementation?

I believe I understand properties for the most part. My question is, if I have a property for an instance variable, and I am setting or retrieving it from within a method in my implementation file, should I use self.myProperty or just myProperty? I…
Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
10
votes
1 answer

When will the Javascript "for...of" loop be implemented in Chrome Chrome?

I just coded a function using the Javascript for...of loop, assuming it had been implemented in Chrome (as in Firefox 13).. It has not. Does anyone know where i can find out if, and when it is scheduled for implementation?
Lloyd
  • 8,204
  • 2
  • 38
  • 53
10
votes
6 answers

Handling the data in an IN clause, with SQL parameters?

We all know that prepared statements are one of the best way of fending of SQL injection attacks. What is the best way of creating a prepared statement with an "IN" clause. Is there an easy way to do this with an unspecified number of values? …
Kibbee
  • 65,369
  • 27
  • 142
  • 182
10
votes
15 answers

What languages do date, time, and calendar operations really well?

This is probably too much to ask, but is there any language that does a really terrific job of representing time and date operations? I'll grant straight away that it's really hard to write a truly great time library. That said, are there any…
Scott McKuen
10
votes
1 answer

Why does JS desctructuring assignment work with numbers

As the title says, why does this code not throw a SyntaxError? I thought you could only destructure Objects const { a, b } = 0; console.log(a, b); // undefined, undefined
10
votes
4 answers

Problem with loop optimization or closure of lambda?

In the following method I'm sending an enumeration of actions and want an array of ICommands back that call Action that wrap those actions (needed for the relayCommand). The problem is that if I do this inside the for each (or even a for…
Marino Šimić
  • 7,318
  • 1
  • 31
  • 61
10
votes
7 answers

Are interfaces redundant with multiple inheritance?

This is not yet another question about the difference between abstract classes and interfaces, so please think twice before voting to close it. I am aware that interfaces are essential in those OOP languages which don't support multiple inheritance…
10
votes
1 answer

Confused by Boxing. Casting -1 to Int64 throws InvalidCastException

Ok I must be overlooking something extremely simple but I am lost. Given this object val = -1; var foo = (Int32)(val); var bar = (Int64)(val); The cast to Int64 throws and InvalidCastException. I recognize this is related to some strangeness with…
Brad Cunningham
  • 6,402
  • 1
  • 32
  • 39
10
votes
4 answers

var: a Type or a keyword

MSDN categorizes var under Types. variables that are declared at method scope can have an implicit type var what does 'implicit type var' mean in this context? Strictly said, if I have it to explain to fellow programmers. Can I say; var is a…
Caspar Kleijne
  • 21,552
  • 13
  • 72
  • 102