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
18
votes
8 answers

What is the purpose of case sensitivity in languages?

Possible Duplicates: Is there any advantage of being a case-sensitive programming language? Why are many languages case sensitive? Something I have always wondered, is why are languages designed to be case sensitive? My pea brain can't fathom any…
18
votes
6 answers

Java Private Field Visibility

So I was making a class the other day and used Eclipse's method to create the equals method when I realized that it generated the following working code: class Test { private int privateInt; [...] public boolean equals(Object obj) { [...] …
pek
  • 17,847
  • 28
  • 86
  • 99
17
votes
5 answers

Why is Self assignable in Delphi?

This code in a GUI application compiles and runs: procedure TForm1.Button1Click(Sender: TObject); begin Self := TForm1.Create(Owner); end; (tested with Delphi 6 and 2009) why is Self writable and not read-only? in which situations could this be…
mjn
  • 36,362
  • 28
  • 176
  • 378
17
votes
1 answer

C#: Property overriding by specifying the interface explicitly

While attempting to override the explicit interface implementation of the ICollection.IsReadOnly property from the Collection class, I came across some documents stating that explicit interface member implementations cannot be overridden…
17
votes
6 answers

Is there a Python equivalent to `perl -pi -e`?

I know of python -c '', but I'm wondering if there's a more elegant python equivalent to perl -pi -e ''. I still use it quite a bit for things like find and replace in a whole directory (perl -pi -e s/foo/bar/g * or even find . | xargs…
Silfheed
  • 11,585
  • 11
  • 55
  • 67
17
votes
3 answers

How to do lazy evaluation in Dart?

Is there a native (language supported) lazy evaluation syntax? Something like lazy val in Scala. I've gone through the docs, and could not find anything. There is only a chapter about "lazily loading a library", but it's not what I am asking. Based…
Maciej Sz
  • 11,151
  • 7
  • 40
  • 56
17
votes
11 answers

Can you do Logic Programming in Scala?

I read somewhere that Pattern Matching like that supported by the match/case feature in Scala was actually borrowed from Logic languages like Prolog. Can you use Scala to elegantly solve problems like the Connected Graph problem? e.g.…
Alex R
  • 11,364
  • 15
  • 100
  • 180
16
votes
2 answers

Is the order of fields in a javascript object predictable when looping through them?

In php, if you have the following code: $map = array( "first" => 1, "second" => 2 ); $map["third"] = 3; foreach($map as $key => $value) { // code } You know the entries will be listed in the order they have been added to the array. Now, can…
Julian Aubourg
  • 11,346
  • 1
  • 29
  • 29
16
votes
5 answers

Why doesn't Haskell have symbols (a la ruby) / atoms (a la erlang)?

The two languages where I have used symbols are Ruby and Erlang and I've always found them to be extremely useful. Haskell does have algebraic datatypes, but I still think symbols would be mighty convenient. An immediate use that springs to mind is…
Anupam Jain
  • 7,851
  • 2
  • 39
  • 74
16
votes
4 answers

string.Format() parameters

How many parameters can you pass to a string.Format() method? There must be some sort of theoretical or enforced limit on it. Is it based on the limits of the params[] type or the memory usage of the app that is using it or something else entirely?
Blatfrig
  • 591
  • 1
  • 7
  • 21
16
votes
3 answers

R as a general purpose programming language

I liked Python before because Python has rich built-in types like sets, dicts, lists, tuples. These structures help write short scripts to process data. On the other side, R is like Matlab, and has scalar, vector, data frame, array and list as its…
Yin Zhu
  • 16,980
  • 13
  • 75
  • 117
16
votes
7 answers

equivalent of Python's "with" in Ruby

In Python, the with statement is used to make sure that clean-up code always gets called, regardless of exceptions being thrown or function calls returning. For example: with open("temp.txt", "w") as f: f.write("hi") raise…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
16
votes
5 answers

C1x: When will it land, what to expect?

C99 still isn't supported by many compilers, and much of the focus is now on C++, and its upcoming standard C++1x. I'm curious as to what C will "get" in its next standard, when it will get it, and how it will keep C competitive. C and C++ are known…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
16
votes
7 answers

Why are Nested Comments forbidden?

Why are nested comments forbidden in C++, Java inspite of the fact that nested comments are useful, neat, and elegant and can be used to comment out statements that have comments?
Primal Pappachan
  • 25,857
  • 22
  • 67
  • 84
16
votes
3 answers

Is there anything like Enumerable.Range(x,y) in Java?

Is there something like C#/.NET's IEnumerable range = Enumerable.Range(0, 100); //.NET in Java?
Simon
  • 9,255
  • 4
  • 37
  • 54