# Tag Info

Accepted

### Visual programming tools, why don’t they work with the AST directly?

Many of these tools do work directly with the abstract syntax tree (or rather, a direct one-to-one visualisation of it). That includes Blockly, which you've seen, and the other block-based languages ...
Accepted

### Automatic Downcasting by Inferring the Type

Upcasts always succeed. Downcasts can result in a runtime error, when the object runtime type is not a subtype of the type used in the cast. Since the second is a dangerous operation, most typed ...
• 14.1k
Accepted

### Does it make sense to have both the concept of 'null' and 'Maybe'?

The null value as a default present everywhere is just a really broken idea, so forget about that. You should always have exactly the concept that best describes ...
• 28k
Accepted

### Types as first class Citizen

First class types enable something called dependent typing. These allow the programmer to use values of types at type level. For example, the type of all pairs of integers is a regular type, while the ...
• 435
Accepted

### Why is the object destructor paradigm in garbage collected languages pervasively absent?

The pattern you're talking about, where objects know how to clean their resources up, falls into three relevant categories. Let's not conflate destructors with finalizers - only one is related to ...

### Why are strings immutable in some languages?

This issue is strongly connected to the notion of what it means to be an instance of a class. In strict Object-Oriented terms, a class has an associated invariant: a predicate which always holds true ...
Accepted

### Why would you introduce the goto statement into a modern language?

There are two kinds of programmers: Those who for whatever reason never, ever use goto, and go to any lengths to avoid it, and those who use goto in one of the very rare situations where it is the ...
• 24.9k
Accepted

### Why are struct and class essentially the same in C++?

Bjarne Stroustrup writes in his The Design and Evolution of C++ book (item 3.5.1): At this point, the object model becomes real in the sense that an object is more than the simple aggregation of ...
• 2,952

### Why would you introduce the goto statement into a modern language?

The goto in itself isn't "evil", it is just easy to misuse. A famous paper by Knuth is "Structured Programming with goto statements", ACM Computing Surveys 6:4 (dec ...
• 13.6k
Accepted

### Safe way to explicitly define new types instead of using Algebraic data types for my functional language

You're on the right track: people have come up with the same way to do this. The general concept is known as abstract types. With the Church encoding, the type of a pair of elements of types $a$ and \$...

### Why isn't there a .= operator? (or ->= etc)

IMO, the biggest reason is that identifiers are not first class values in programming languages and "." is not a real operator like + or ...
• 1,370
Accepted

### Can a language be Turing Complete if its only provision for unlimited code/memory is through recursion?

Given your very strict interpretation of limited memory size, limiting also the size of integers, one consequence is that it is not possible to play encoding games with integers (such as Gödel ...
• 19.1k

### Why would you introduce the goto statement into a modern language?

Most algorithms and forms of business logic can fit nicely into the control structures that are built into modern languages, in large measure because such structures were designed to fit the needs of ...
• 1,107

### Why are strings immutable in some languages?

Things like strings and dates are naturally values. In C++ terms, we expect them to have a copy constructor, an assignment operator, and an equality operator, but we never expect to take their address....
• 616

### Which is easier for human perception: type of variable before or after its name?

I don't think there is any research (with good methodology) on this. The language I'd most expect to have actually thought about this and made an empirically-based decision is the Quorum programming ...
• 11.8k

### Why is the syntax of some programming languages very much not according to earlier conventions?

Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer ...
Accepted

### What is the point of delimiters and whitespace handling

Now, is it right that only identifiers and literals have to be separated by delimiters or whitespace? How do I ensure that? If by "right" you mean it is the case in every programming ...
• 11k

### Why are strings immutable in some languages?

Java was designed to allow execution of subsections of a program's code in security constrained environments. The way this requirement was implemented was by setting a "SecurityManager" on a thread ...
• 201
Accepted

### Examples of context sensitive syntactic constructs (statements)

Here are three context-sensitive syntaxes actually found in programming languages. I don't believe I've ever seen a language which has types, names and values distributed as per your example, but it ...
• 11k

### Visual programming tools, why don’t they work with the AST directly?

At least two reasons: Because source code is a much more concise representation. Laying out an AST as a graph would take up a lot more visual real estate. Programmers prize having as much context ...
• 140k

### Lazy concatenative functional language

It can be done. Here's a presentation explaining the language and how the compiler works (so far). You can play with an asm.js version at http://hackerfoo.com/eval.html
Accepted

### Can String be a subtype of Character in a programming language?

Character and String are conceptually very, very different. Google for "inheritance vs. composition" - you seem to think that Character and String should be connected via inheritance, but in reality a ...
• 24.9k

### How to bridge theory and implementation for while loops?

I think you're missing the notion of continuation. Although your compiler may not rely on that notion, as a compiler designer with a functional language as source or intermediate (or target) language, ...
Accepted

### How to bridge theory and implementation for while loops?

So I managed to solve this issue today. The code for my while loop: ...
• 499

### Why is the object destructor paradigm in garbage collected languages pervasively absent?

In a nutshell Finalization is not a simple matter to be handled by garbage collectors. It is easy to use with reference counting GC, but this family of GC is often incomplete, requiring memory leaks ...
• 19.1k

### Should names of built-in funtions be part of BNF grammar?

If your language has a small set of functions and there is no mechanism for adding other ones, then you could include the function names as keywords. But that's not a very likely scenario, unless your ...
• 11k

### Why is the object destructor paradigm in garbage collected languages pervasively absent?

The object destructor pattern is fundamental to error handling in systems programming, but has nothing to do with garbage collection. Rather, it has to do with matching object lifetime to a scope, ...
• 17.3k

### Functional programming with branches that have no order?

Here's the problem: You always need some way to resolve ambiguity when there are overlapping clauses There is no easy syntactic way to ensure that clauses don't overlap. So, if you can think of a ...
• 29.1k