Questions involving the design and structure of programming languages.

learn more… | top users | synonyms

38
votes
15answers
3k 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 ...
49
votes
12answers
5k 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 ...
53
votes
11answers
4k 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. ...
72
votes
20answers
9k 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 ...
58
votes
13answers
8k 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 ...
26
votes
15answers
2k 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> ...
29
votes
10answers
2k 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 ...
15
votes
16answers
5k 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 ...
11
votes
2answers
503 views

How easy should a language development framework be to use?

This is part of a series of questions which focuses on a project called the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. Another ...
6
votes
3answers
456 views

Is structural typing in a hierarchical model necessary?

This is part of a series of questions which focuses on a project called the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. Another ...
4
votes
3answers
719 views

Is it easier to write robust code in compiled, strictly-typed languages? [closed]

I'd like to read the opinion of experts on whether compiled, strictly-typed languages help programmers write robust code easier, having their backs, checking for type mismatches, and in general, ...
35
votes
9answers
11k 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 ...
62
votes
8answers
14k 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. ...
25
votes
7answers
2k views

Disadvantages of scoped-based memory management

I really like scope-based memory management (SBMM), or RAII, as it is more commonly (confusingly?) referred to by the C++ community. As far as I know, except for C++ (and C), there's no other ...
7
votes
4answers
1k views

Building a DSL: Scripted atop a general-purpose language or stand-alone?

I'm debating designing a domain specific language to simplify a given, obscure programming model. Part of the debate is whether to build it (as a script) atop an existing language/runtime (e.g. Java) ...
5
votes
5answers
2k views

why no native compiler of C# or other “productive” language? [closed]

I've been reading about D and Go and how they aim at being compiled to machine code yet be convenient (like garbage collection, no need to manipulate pointers unless needed) and I agree that there is ...
15
votes
2answers
2k views

In hindsight, is basing XAML on XML a mistake or a good approach?

XAML is essentially a subset of XML. One of the main benefits of basing XAML on XML is said to be that it can be parsed with existing tools. And it can, to a large degree, although the (syntactically ...
7
votes
10answers
1k views

A better way of doing Regex? [duplicate]

I really dislike regular expressions, each time I come back to it I seem to have to relearn it. It's also incredibly hard to maintain, modify and at a glance understand what it is doing. Has anyone ...
30
votes
10answers
7k views

If null is bad, why do modern languages implement it? [closed]

I'm sure designers of languages like Java or C# knew issues related to existence of null references (see Are null references really a bad thing?). Also implementing an option type isn't really much ...
35
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 ...
14
votes
9answers
3k views

Career advice: PhD in theory of programming languages [closed]

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, ...
10
votes
6answers
2k views

Are there any ultra high level languages out there? [closed]

Historically a HLL is something like C, Fortran or Pascal and a VHLL is something like Ruby or Python. I am familiar with the terms 4GL, 5GL, DSL and LOP, and those who aren't should read Wikipedia ...
14
votes
8answers
3k 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 ...
24
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 ...
4
votes
5answers
1k views

Scalability and Programming languages

What makes a language scalable ? I believe scalability is more about system design. It sounds really odd to me, to say that one language is more scalable than the another.
18
votes
3answers
774 views

Why is the rec keyword needed in F#?

In F# it is necessary to use the rec keyword. In Haskell there is no need to explicitly tell if a given function is recursive or not. Given the role of recursion in functional programming, the F# ...
3
votes
4answers
1k views

Why many programming languages have only 2 data-structures: arrays and hashes?

Many programming languages have only those 2 structures, and even some languages that have more structures still only provide special syntax for those 2; usually, [] and {}. Why is this? Is there ...
1
vote
5answers
498 views

'Other' Features in a programming language

Online (i cant remember where) i saw someone mention he wishes programming language has more built in features for tools like documentation and source control. Now i dont understand what needs to be ...
7
votes
6answers
881 views

Please explain the benefit(s) of using an XML-based syntax (e.g. XAML) instead of normal source code (e.g. WinForms)?

First off, please note that this question is not about WPF vs. WinForms. What are the highest-ranking benefits that led Microsoft to invent XAML in favour of the “old” approach of generating ...
36
votes
21answers
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 ...
7
votes
1answer
1k views

What's the problem with Scala's XML literals?

In this post, Martin (the language's head honcho) writes: [XML literals] Seemed a great idea at the time, now it sticks out like a sore thumb. I believe with the new string interpolation ...
3
votes
1answer
319 views

Is there a name for the 'break n' construct?

In a conversation earlier this week I was discussing certain language features, and I realized I don't have a good word / phrase to describe a particular feature. Some languages, such as PHP, have a ...
2
votes
1answer
378 views

Reasoning behind the syntax of octal notation in Java?

Java has the following syntax for different bases: int x1 = 0b0101; //binary int x2 = 06; //octal int x3 = 0xff; //hexadecimal Is there any reasoning on why it is 0 instead of something like ...
0
votes
2answers
1k views

Are there any languages that have both high- and low-level facilities? [closed]

Are there any languages that have both high- and low-level facilities? If not, is it feasible to create one? Why or why not? In theory, it would be very helpful to have a programming language that ...