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
13
votes
5 answers

"using" construct and exception handling

The "using" construct looks incredibly handy for situations that require both beginning and separated end parts. Quick example to illustrate: using (new Tag("body")) { Trace.WriteLine("hello!"); } // ... class Tag : IDisposable { String…
Trident D'Gao
  • 18,973
  • 19
  • 95
  • 159
12
votes
5 answers

Java Language Specification - Cannot understand 'BlockStatement'

I've been examining the Java Language Specification here (instead I should be out having a beer) and I am curious about what a method can contain. The specification states a method body can contain a block MethodBody: Block Where a 'Block'…
Joeblackdev
  • 7,217
  • 24
  • 69
  • 106
12
votes
6 answers

Are there any non-Lisp dialects that allow for syntactic abstraction?

As Rich Hickey says, the secret sauce of Lisp languages is the ability to directly manipulate the Abstract Syntax Tree through macros. Can this be achieved in any non-Lisp dialect languages?
Mike
  • 19,267
  • 11
  • 56
  • 72
12
votes
3 answers

What is a cofunction and how would it work in Python?

I am reading PEP-3153, but I don't understand what the problem is it wants to address. Could you please explain?
Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
12
votes
5 answers

Why was constness removed from Java and C#?

I know this has been discussed many times, but I am not sure I really understand why Java and C# designers chose to omit this feature from these languages. I am not interested in how I can make workarounds (using interfaces, cloning, or any other…
Hosam Aly
  • 41,555
  • 36
  • 141
  • 182
12
votes
3 answers

Compilation error. Using properties with struct

Please explain the following error on struct constructor. If i change struct to class the erros are gone. public struct DealImportRequest { public DealRequestBase DealReq { get; set; } public int ImportRetryCounter { get; set; } public…
Captain Comic
  • 15,744
  • 43
  • 110
  • 148
12
votes
5 answers

How unique is PHP's __autoload()?

PHP's __autoload() (documentation) is pretty interesting to me. Here's how it works: You try to use a class, like new Toast_Mitten()(footnote1) The class hasn't been loaded into memory. PHP pulls back its fist to sock you with an error. It pauses.…
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
12
votes
2 answers

Languages and VMs: Features that are hard to optimize and why

I'm doing a survey of features in preparation for a research project. Name a mainstream language or language feature that is hard to optimize, and why the feature is or isn't worth the price paid, or instead, just debunk my theories below with…
12
votes
6 answers

Why is 'last' called 'last' in Perl?

What is the historical reason to that last is called that in Perl rather than break as it is called in C? The design of Perl was influenced by C (in addition to awk, sed and sh - see man page below), so there must have been some reasoning behind not…
knorv
  • 49,059
  • 74
  • 210
  • 294
11
votes
2 answers

How does the C++ runtime determine the type of a thrown exception?

If I do the following, how does the runtime determine the type of the thrown exception? Does it use RTTI for that? try { dostuff(); // throws something } catch(int e) { // .. } catch (const char * e) { // .. } catch (const myexceptiontype *…
codymanix
  • 28,510
  • 21
  • 92
  • 151
11
votes
6 answers

Which syntax options/language features did Scala remove over time (and why)?

The title pretty much sums up my question. The deprecation and removal of case class inheritance is a pretty new one, and I wonder which things got removed/substantially changed before that. I remember something about val in for loops and a…
soc
  • 27,983
  • 20
  • 111
  • 215
11
votes
5 answers

Volatile fields in C#

From the specification 10.5.3 Volatile fields: The type of a volatile field must be one of the following: A reference-type. The type byte, sbyte, short, ushort, int, uint, char, float, bool, System.IntPtr, or System.UIntPtr. An enum-type having…
Cheng Chen
  • 42,509
  • 16
  • 113
  • 174
11
votes
10 answers

What's the best language for physics modeling?

I've been out of the modeling biz, so to speak, for a while now. When I was in college, most of the models I worked with were written in FORTRAN, which I never liked. I'm looking to get back into science, so I'm wondering if there are modern…
FCBastiat
  • 119
  • 1
  • 1
  • 4
11
votes
4 answers

Question regarding implicit conversions in the C# language specification

Section 6.1 Implicit conversions defines an identity conversion thusly: An identity conversion converts from any type to the same type. This conversion exists such that an entity that already has a required type can be said to be convertible to…
Timwi
  • 65,159
  • 33
  • 165
  • 230
11
votes
6 answers

Are strings created with + concatenation stored in the string pool?

For instance String s = "Hello" + " World"; I know there are two strings in the pool "Hello" and "World" but, does: "Hello World" go into the string pool? If so, what about? String s2 = new String("Hola") + new String(" Mundo"); How many strings…
OscarRyz
  • 196,001
  • 113
  • 385
  • 569