language-design

When and in what language were certain programming features introduced?

Programming has come a long way. I am still relatively young (first Computer: C64), hence I take many things in programming for granted that were obviously introduced at some point and facilitated ways of programming that are now commonplace. What follows is a (by no means complete) list of features, where I would love to know in which ...

"Least Astonishment" in Python: The Mutable Default Argument

Anyone tinkering with python long enough has been bit (or torn to pieces) by the following issue: def foo(a=[]): a.append(5) return a Python novices would expect this function to always return a list with only one element: [5]. The result is instead very different, and very astonishing (for a novice): >>> foo() [5] >>> foo() ...

What is F# lacking for OO or imperative?

Many times I hear that F# is not suited to particular tasks, such as UI. "Use the right tool" is a common phrase. Apart from missing tools such as a WinForms/WPF/ORM designer, I'm not sure what exactly is missing in F# -- honestly! Yet, particularly with UI, I'm told that C# just does it better. So, what are the actual differences and ...

Finding language designers and programmers

I'd like to create a new and open sourced language. Since it's really rare to find programmers that actually dealt with compiler theory I need some advice. How would you make a person interested in your open source project? How do you bring him to a position where he wants to contribute? Is there a special place where I can find those pe...

Treatment of error values in the SQL standard

I have a question about the SQL standard which I'm hoping a SQL language lawyer can help with. Certain expressions just don't work. 62 / 0, for example. The SQL standard specifies quite a few ways in which expressions can go wrong in similar ways. Lots of languages deal with these expressions using special exceptional flow control, or b...

Making it clear a function can modify its parameters

Why is it that so many programming languages make it possible for a function to modify an object passed to it as a parameter, without having some sort of syntax to make that clear to the caller. Eg consider: SomeObject A(15), B B = DoSomething(A) print(A + " " + B + "\n) Reading that code you would expect the output to be something li...

Why is an array not assignable to Iterable?

with Java5 we can write: Foo[] foos = ... for (Foo foo : foos) or just using an Iterable in the for loop. This is very handy. However you can't write a generic method for iterable like this: public void bar(Iterable<Foo> foos) { .. } and calling it with an array since it is not an Iterable: Foo[] foos = { .. }; bar(foos); // co...

Why properties are not declarables in interfaces

In Actionscript 3 I can't declare vars in Interfaces. I don't get it. I know i can work this around by defining getters and setters, but what if i just want a simple public property? I usually use getters and setters if there is something to do when i set or get a property, but what if i just want to store a value? ...

What are reasons to choose a scripting language over C#?

What are reasons to choose a non DSL scripting language over statically compiled language such as C#? -edit- Good answers so far. I feel I should explain further. I am pretty sure people use Python over C# for more reasons than just taste and C# over Python for other situations. ...

Methodologies for designing a simple programming language

In my ongoing effort to quench my undying thirst for more programming knowledge I have come up with the idea of attempting to write a (at least for now) simple programming language that compiles into bytecode. The problem is I don't know the first thing about language design. Does anyone have any advice on a methodology to build a pars...

what does a php function return by default?

If I return nothing explicitly, what does a php function exactly return? function foo() {} What type is it? What value is it? How do I test for it exactly with === ? Did this change from php4 to php5? Is there a difference between function foo() {} and function foo() { return; } (I am not asking how to test it like if (foo() !=0) ....

How-to: short-circuiting inverted ternary operator implemented in, e.g. C#? Does it matter?

Suppose you are using the ternary operator, or the null coalescing operator, or nested if-else statements to choose assignment to an object. Now suppose that within the conditional statement, you have the evaluation of an expensive or volatile operation, requiring that you put the result into a temporary variable, capturing its state, so...

Programming languages that define the problem instead of the solution?

Are there any programming languages designed to define the solution to a given problem instead of defining instructions to solve it? So, one would define what the solution or end result should look like and the language interpreter would determine how to arrive at that result. Looking at the list of programming languages, I'm not sure ...

Functional programming and equation solvers

Hi all, Just as a personal experiment, in order to try to learn better about programming and formal language theory and the like, I'm trying to write a language that basically takes in a bunch of equations and solves for unknowns more or less automatically or heuristically. I'm trying to do this by writing an interpreter in C. All that...

Why is a const variable available within a static method?

I have been writing code without realizing WHY I can access constant values within static methods. Why is it possible to access const values without declaring it as static? E.g.) It's legal to call IMAGE_FILE_EXTENSION within AddImageToDocument(...) public abstract class ImageDocumentReplacer : DocumentReplacer { private const ...

Better word for inferring variables other than var - C#

This might get closed, but I'll try anyway. I was showing a VB6 programmer some of my C# code the other day and he noticed the var keyword and was like "Oh a variant type, that's not really strong typing when you do that." and I had to go on the typical "var != VARIANT" speech to explain to him that it is not a variant it just compiler...

advantages, disadvantages, and difficulties of writing a language to use .NET

I'm thinking about possibly designing/building a language at some point, and what are the advantages, disadvantages, and difficulties of writing it to run on the .NET framework/CLR? ...

How would you replace the 'new' keyword?

There was an article i found long ago (i cant find it ATM) which states reasons why the new keyword in C++ is bad. I cant remember all of the reasons but the two i remember most is you must match new with delete, new[] with delete[] and you cannot use #define with new as you could with malloc. I am designing a language so i like to ask ...

How to do true==false or true!=true in your language?

Booleans seem to be the most primitive building blocks of programming languages, because they can actually take only two (or in some cases three) "singleton" values: true, false (and sometimes undeterminded/null) But it seems that sometimes language design might allow someone to write code where actually "true is false" or "true is not ...

Why does C++ need a separate header file?

I've never really understood why C++ needs a separate header file with the same functions as in the .cpp file. It makes creating classes and refactoring them very difficult, and it adds unnecessary files to the project. And then there is the problem with having to include header files, but having to explicitly check if it has already bee...