Questions involving the design and structure of programming languages.
88
votes
77answers
13k views
What features would you like to have in PHP? [closed]
Since it's the holiday season now and everybody's making wishes, I wonder - which language features you would wish PHP would have added? I am interested in some practical suggestions/wishes for the ...
61
votes
8answers
13k views
How were some language communities (eg, Ruby and Python) able to prevent fragmentation while others (eg, Lisp or ML) were not?
The term "Lisp" (or "Lisp-like") is an umbrella for lots of different languages, such as Common Lisp, Scheme, and Arc. There is similar fragmentation in other language communities, like in ML.
...
43
votes
12answers
4k views
Did the developers of Java consciously abandon RAII?
As a long-time C# programmer, I have recently come to learn more about the advantages of Resource Acquisition Is Initialization (RAII). In particular, I have discovered that the C# idiom:
using (var ...
41
votes
10answers
2k views
I've been told that Exceptions should only be used in exceptional cases. How do I know if my case is exceptional?
My specific case here is that the user can pass in a string into the application, the application parses it and assigns it to structured objects. Sometimes the user may type in something invalid. ...
38
votes
14answers
4k views
Are null references really a bad thing?
I've heard it said that the inclusion of null references in programming languages is the "billion dollar mistake". But why? Sure, they can cause NullReferenceExceptions, but so what? Any element of ...
38
votes
6answers
2k views
Why do old programming languages continue to be revised?
This question is not, "Why do people still use old programming languages?" I understand that quite well. In fact the two programming languages I know best are C and Scheme, both of which date back to ...
37
votes
15answers
2k views
How would you design a programming language? [closed]
If you were to design a programming language, how would you do it? What features would you put in? What would you leave out? Statically or dynamically typed? Strongly or weakly typed? Compiled or ...
34
votes
12answers
2k views
Why does the assignment operator assign to the left-hand side?
I began teaching a friend programming just recently (we're using Python), and when we began discussing variable creation and the assignment operator, she asked why the value on the right is assigned ...
33
votes
26answers
2k views
What do you wish language designers paid attention to? [closed]
The purpose of this question is not to assemble a laundry list of programming language features that you can't live without, or wish was in your main language of choice. The purpose of this question ...
33
votes
18answers
2k views
Has whitespace in identifiers ever been idiomatic?
C# style suggests using CamelCase in identifiers to delimit words. Lisp tradition suggests using-dashes-instead.
Has there ever existed a programming language where using spaces in identifiers was ...
33
votes
13answers
9k views
How have languages influenced CPU design?
We are often told that the hardware doesn't care what language a program is written in as it only sees the compiled binary code, however this is not the whole truth. For example, consider the humble ...
32
votes
12answers
4k views
Why is 0 false?
This question may sound dumb, but why does 0 evaluates to false and any other [integer] value to true is most of programming languages?
String comparison
Since the question seems a little bit too ...
31
votes
2answers
1k views
Why do bitwise operators have lower priority than comparisons?
Could someone explain the rationale, why in a bunch of most popular languages (see note below) comparison operators (==, !=, <, >, <=, >=) have higher priority than bitwise operators (&, |, ...
30
votes
4answers
2k views
Why don't languages include implication as a logical operator?
It might be a strange question, but why there is no implication as a logical operator in many languages (Java, C, C++, Python Haskell - although as last one have user defined operators its trivial to ...
27
votes
10answers
1k views
What mistakes do language writers often make which doom their language? [closed]
Are there common mistakes that language creators make that prevent or slow the adoption of their language? An example (though perhaps not a good one): they focus more on language semantics than tool ...
23
votes
12answers
4k views
Should I use a parser generator or should I roll my own custom lexer and parser code?
What specific advantages and disadvantages of each way to working on a programming language grammar?
Why/When should I roll my own? Why/When should I use a generator?
22
votes
2answers
3k views
Why is 'void' not allowed as a generic type in C#
What were the design decisions that argued in favour of void not being constructable and not being allowed as a generic type? After all it is just a special empty struct and would have avoided the ...
21
votes
7answers
2k views
Why are so many languages passed by value?
Even languages where you have explicit pointer manipulation like C it's always passed by value (you can pass them by reference but that's not the default behavior).
What is the benefit of this, why ...
20
votes
11answers
1k views
Is there a language out there in which parameters are placed inside method name?
in JavaScript:
function getTopCustomersOfTheYear(howManyCustomers, whichYear) {
// Some code here.
}
getTopCustomersOfTheYear(50, 2010);
in C#:
public List<Customer> ...
20
votes
19answers
1k views
What language, or language feature, do you wish made it to the mainstream? [closed]
Some languages in the past have been influential without ever reaching wide adoption. For example, many languages owe much to the design of Algol 68, even though few compilers were ever written for ...
20
votes
8answers
13k views
Why use partial classes?
In my understanding, the partial keyword does nothing but allow a class to be split between several source files. Is there any reason to do this other than for code organization? I've seen it used for ...
20
votes
8answers
710 views
Why is there such limited support for Design by Contract in most modern programming languages?
I recently discovered Design by Contract (DbC) and I find it an extremely interesting way to write code. Among other things, it would seem to offer:
Better documentation. Since the contract is the ...
19
votes
3answers
3k views
How fast can Go go?
Go is one of the few languages that are supposed to run 'close to the metal', i. e. it's compiled, statically typed and executes code natively, without a VM. This should give it a speed advantage over ...
18
votes
10answers
6k views
What do Java developers think of Scala? [closed]
I've noted that IDE support is nowhere near as good, but the language itself supports functional programming idioms much more cleanly.
18
votes
17answers
1k views
Why aren't databases integrated as a language feature?
Are there any programming languages that have a built-in database as a first-class language feature rather than connecting to an external SQL (or other) database? What would be the drawbacks and ...
18
votes
8answers
2k views
Why is String immutable in Java?
I couldn't understand the reason of it. I always use String class like other developers, but when I modify the value of it, I need to create new instance of String.
What might be the reason of ...
18
votes
8answers
1k views
Are there any programming languages that follow a minimalist development approach?
I find it that when languages are considered the same as commercial software, there is always a constant need to add new features to justify new releases.
Can there be or are there languages where ...
17
votes
4answers
846 views
Why doesn't C# have local scope in case blocks?
I was writing this code:
private static Expression<Func<Binding, bool>> ToExpression(BindingCriterion criterion)
{
switch (criterion.ChangeAction)
{
case ...
16
votes
4answers
2k views
Why do iterators in Python raise an exception?
Here's the syntax for iterators in Java (somewhat similar syntax in C#):
Iterator it = sequence.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
Which makes sense. Here's ...
16
votes
1answer
352 views
Does Groovy follow Tennent's Correspondence Principle?
Here's an interesting discussion of Tennent's Correspondence Principle, and a brief description from Neal Gafter:
The principle dictates that an expression or statement, when wrapped in a closure ...
15
votes
18answers
2k views
What do you think was a poor design choice in Java?
Java has been one of the most (the most?) popular programming languages till this day, but this also brought controversy as well.
A lot of people now like to bash Java simply because "it's slow", or ...
15
votes
12answers
717 views
Should data structures be integrated into the language (as in Python) or be provided in the standard library (as in Java)?
In Python, and most likely many other programming languages, common data structures can be found as an integrated part of the core language with their own dedicated syntax. If we put LISP's integrated ...
14
votes
10answers
2k views
Career advice: PhD in theory of programming languages
I'm very interested in the theories of programming languages and going to apply a PhD in this topic, but I want to know more about the career after the graduate education. besides being a professor, ...
14
votes
3answers
820 views
Java and .NET: Why different sorting algorithms are used by default?
Just wondering why Java and .NET Framework uses different sorting algorithm by default.
In Java Array.Sort() uses Merge Sort algorithm by default and as Wikipedia.com says:
In Java, the ...
13
votes
16answers
3k views
What can be done to programming languages to avoid floating point pitfalls?
The misunderstanding of floating point arithmetic and its short-comings is a major cause of surprise and confusion in programming (consider the number of questions on Stack Overflow pertaining to ...
13
votes
8answers
1k views
Why is C++ still “hybrid”
On a related question, it has been clarified why C++ is not compatible with C in many aspects. However C++ is still a "hybrid"* language. And unfortunately, many programmers still consider C++ as a "C ...
13
votes
8answers
2k views
Why is x=x++ undefined?
It's undefined because the it modifies x twice between sequence points. The standard says it's undefined, therefore it's undefined.
That much I know.
But why?
My understanding is that forbidding ...
13
votes
5answers
730 views
Question about Creating a Scripting Language
Say, for example, I wanted to pay somebody to create a programming language or scripting language for me. What type of document would they need, in order to fully understand what it is exactly that I ...
12
votes
7answers
893 views
Why don't more languages support recursive/nested comments? [duplicate]
Possible Duplicate:
Why do most programming languages not nest block comments?
Most languages I've worked with don't have support for recursive/nested comments.
Is there any reason why ...
12
votes
4answers
791 views
Why exactly can't PHP have full unicode support?
Everybody knows, that PHP has problems with Unicode. Version 6 is effectively abandoned, because of Unicode implementation difficulties. But I wonder if anyone knows what are the exact reasons? ...
12
votes
3answers
608 views
How should I specify a grammar for a parser?
I have been programming for many years, but one task that still takes me inordinately long is to specify a grammar for a parser, and even after this excessive effort, I'm never sure that the grammar ...
11
votes
10answers
1k views
Function overloading? Yes or no [closed]
I'm developing a statically- and strongly-typed, compiled language, and I'm revisiting the idea of whether to include function overloading as a language feature. I realized that I'm a little bit ...
11
votes
4answers
2k views
What's wrong with JavaScript [closed]
There is a lot of buzz around Dart recently, often questioning Google motivations and utility of Dart as replacement for JavaScript.
I was searching for rationale of creating Dart rather than ...
11
votes
7answers
643 views
Are operators clearer to read than keywords or functions? [closed]
It's a bit subjective, but I'm hoping to get a clearer understanding of what factors make an operator clear to use vs obtuse and difficult. I've been considering language designs recently, and one ...
11
votes
9answers
874 views
XAML - Like/Dislike? [closed]
After bashing my head against the brick wall that is XAML, I've decided to come here and ask other people if they are as frustrated as I am.
So,
Do you like XAML? Please justify.
Is XAML the ...
11
votes
9answers
1k views
Greenspun's Tenth Rule, does every large project include a Lisp interpreter?
Greenspun's tenth rule (actually the only rule) states that:
Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of ...
11
votes
3answers
362 views
How to implement lazy evaluation of if()
I am currently implementing an expression evaluator (single line expressions, like formulas) based on the following:
the entered expression is tokenized to separate literal booleans, integers, ...
11
votes
2answers
838 views
Advantages and disadvantages of structuring all code via classes and compiling to classes (like Java)
Edit: my language allows for multiple inheritance, unlike Java.
I've started designing and developing my own programming language for educational, recreational, and potentially useful purposes.
At ...
11
votes
3answers
465 views
How does a static type system affect the design of a prototype-based language?
The Wikipedia article on prototype-based languages contains the following paragraph:
Almost all prototype-based systems are based on interpreted and dynamically typed languages. Systems based on ...
10
votes
8answers
928 views
Why aren't design patterns added to the languages constructs?
Recently I was talking with a colleague who mentioned that his company was working on adding the MVC design pattern as a PHP extension.
He explained that they wrote C code for adding Controllers, ...
