language-features

What extensions to the language does the C# compiler implement?

In Eric Lippert's blog entry on umpires and the C# compiler and spec, he makes this statement: (or deliberately; we implement a small number of extensions to the formal C# language) And that got me wondering, what extensions is he referring to, exactly? ...

Why do fixes of PHP Bugs/Features take so long?

This may not be strictly programming-related. How come PHP Features / Bugs that seem important(*) always take a while to be developped? For example, in PHP most sorting functions support the SORT_LOCALE_STRING, which allows an array of elements to be sorted depending on the system's locale. Most of them, except for the super-useful arr...

Why doesn't 'using' have a catch block?

I understand the point of "using" is to guarantee that the Dispose method of the object will be called. But how should an exception within a "using" statement be handled? If there is an exception, I need to wrap my "using" statement in a try catch. For example: Lets say there is an exception created in the creation of the object insi...

Python: create a dictionary with list comprehension

I like the python list comprehension operator (or idiom, or whatever it is). Can it be used to create dictionaries too? For example, by iterating over pairs of keys and values: dict = {(k,v) for (k,v) in blah blah blah} # doesn't work :( ...

Detecting the browser language of choice with PHP

Hello guys, I'm trying to implement this code to have different files to load for german, spanish or english browser languages of choice. The case is that with my spanish IE I still get the english file. <?php if (is_home()) { if (preg_match('/de-DE/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) { include(TEMPLATEPATH . '/german-navbar.p...

C# - Indexer at its meaningful application

I understand indexer enable us to access a collection within a class as though the class itself were an array. Suppose we are developing a project ,where do we fit the real pratical usage (example may help) of such indexers ? ...

Advice on implementing low-level libraries in D (as opposed to C/C++)

I need some advice on selecting the D programming language for a project. The project is a low-level library akin to a database with many associative containers and so forth. Hence efficiency is quite important to me. I need to provide a C API for the library for compatibility with other languages like C++ and Python and I also anticipa...

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 going with the familiar C-style naming of break/last. A bit of history from the Perl 1....

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 find the syntax very cryptic for hashes A good explanation of hashes and hash references...

is there a good place to discuss compilers ?

I am looking for some place where I can discus compilers and language design ? forum or any thing of this sort ...

Using flag to identify spoken language

Hello, In the webapp I am doing, I need to identify language people are speaking. I wanted to use flag to do that. But I have some problems. For example, if you speak French, you can put the French flag. But if you speak English you can put either the US or UK flag or a mix of both. Which flag to choose for Arabic language ? Saudi Ara...

how to vectorize with xml data?

let's say, I have this xml file: <?xml version="1.0" encoding="UTF-8" ?> <TimeSeries> <timeZone>1.0</timeZone> <series> <header/> <event date="2009-09-30" time="10:00:00" value="0.0" flag="2"></event> <event date="2009-09-30" time="10:15:00" value="0.0" flag="2"></event> <event date="2009-09-30" time="10:30:00" value...

Concepts in C# 3.0

When a person moves from C# 2.0 C# 3.0 ,what are the concepts does he need to learn? like extension method,lambda expression,Linq. ...

What are the advantages and disadvantages of the require vs. import methods of loading code?

Ruby uses require, Python uses import. They're substantially different models, and while I'm more used to the require model, I can see a few places where I think I like import more. I'm curious what things people find particularly easy — or more interestingly, harder than they should be — with each of these models. In particular, if y...

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 finalization and (at least in java), they incur an amazingly huge performance hit to even s...

Are there performance issue of using while loop vs foreach/for loop?

What are the performance issue of using while loop v/s foreach/for loop or vice-versa ? Also is it always preferable to use foreach loop v/s while in php ? ...

Have you ever restricted yourself to using a subset of language features?

Have you ever restricted yourself to using a subset of language features, and more importantly, why? I'm curious to find out who choose to use only certain language features and avoid others in order to win big in areas such as, but not limited to, memory usage, execution speed or plain old readability and maintainability. And by doing ...

When to upgrade an existing program to new language features?

Imagine you have a program written e.g. in Java 1.4 or C# 1.0. Of course this program doesn't use generics and other language features that were introduced with later versions. Now some non-trivial changes have to be made. And of course, you already have a newer IDE/compiler so you could use Java 1.6 resp. C# 3.5 instead. Would you use ...

Using new languages in an Apache/PHP/JavaScript world

I am stuck in a MySQL/Apache/PHP/JavaScript world. Is it possible to stay inside that stack yet incorporate other languages and technologies to advantage and increase interest? The idea is to still serve pages with PHP, but they might have been made with another technology or the JavaScript might have been built with a tool rather th...

Who invented the throw/try/catch[/finally] kind of error handling?

My questions are more of historical nature than practical: Who invented it? Which language used it first (and to what extent)? What was the original idea, the underlying concept (which actual problems had to be solved these days, papers welcome) ? Is LISPs condition system the ancestor of current exception handling? ...