Questions tagged [language-design]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4
votes
0answers
63 views

Scopes vs objects — would a language make sense that voids the difference?

So there's this adage that says "Objects are a poor man's closures", which can equally well be reversed, which I understand to mean that they are equivalently expressive. What strikes me about the ...
1
vote
1answer
77 views

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

Looking at the syntax of the programming language C and others inspired by it, I cannot help but ask the question in the title. Mathematics, logic and other subjects have been existing for many ages ...
1
vote
2answers
96 views

Is lazy evaluation required for do-notation?

Do-notation is most famous by Haskell, which is also famous for having lazy evaluation. But is lazy evaluation a requirement for implementing do-notation? In principle, could do-notation be added ...
0
votes
1answer
71 views

Why in Declarative Programming variables are not reassigned?

I've read that a Declarative language is called "stateless". This means that we can imagine that internally every variable is a constant variable, and it never get reassigned ( in contrast with what ...
2
votes
3answers
99 views

Are there any programming languages which support user defined control structures?

For instance, the user would define a for each loop in their code as having a structure something like: foreach([variable1] : [variable2]){ [statements] } (...
1
vote
3answers
56 views

Is there a reason to NOT wrap preprocessor macros in parens?

I'm writing a design document for a macro expansion language that is specifically intended for arithmetic operations on integers. I've already determined that not wrapping macros with parens can lead ...
21
votes
0answers
563 views

Can a calculus have incremental copying and closed scopes?

A few days ago, I proposed the Abstract Calculus, a minimal untyped language that is very similar to the Lambda Calculus, except for the main difference that substitutions are ...
1
vote
0answers
66 views

Translation from Intermediate Language into 'three-address' machine instructions

I am unsure where to start with this. From what I understand so far, 'VAR(x)' corresponds to Rule 2, ':= VAR(x) ' refers to Rule 5 and '+ NUM (1) refers to link 3. ...
4
votes
1answer
133 views

What techniques could be used to support thread-local contexts and resources in a language?

I am interested in the subject of thread-local contexts, which is a feature that I use quite often in solutions, but seems to lack first-class support in any languages I have used. Quite often in ...
0
votes
1answer
32 views

extend ECMAScript by adding new keywords and syntax

I would like to extend ECMAScript by adding new keywords and syntax to it, for example: |variableName| stipulates a special kind of variable which I would like to be able to include in a normal ...
4
votes
1answer
653 views

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

In some programming languages type of variable goes before it's name. In another - name goes first and then type. Which version loads brain less and allow easier think about problem ?
0
votes
0answers
29 views

How can fuzzy logic be applied to computer language design?

Is fuzzy logic in any way applicable to general-purpose language design? If yes, then how would a computer language theoretically benefit from first order support of fuzzy logic?
8
votes
2answers
176 views

What would a language look like in which precise GC was implementable as a library?

Suppose you have some programming language with manual memory management. What features does this language need to have in order to be able to implement precise garbage collection as a library, and ...
1
vote
1answer
34 views

Was multiple inheritance ever implemented by adding redundant data members?

In discussions about why most languages which implement inheritance only implement single-inheritance, the question of the precise semantics of overlaps often comes up, and having redundant data ...
0
votes
1answer
58 views

Are there any languages without tokens?

I know a lot of computer languages and they all use tokens. E.g. in very early BASIC you could say LET answer = 42, which is composed of seven tokens, ...
5
votes
2answers
360 views

Why don't imperative languages like C or Go support Haskell-like parametric polymorphism?

Why don't imperative languages support parametric polymorphism as powerful as whats in Haskell and OCaml? More specifically if I call a function foo(x) that ...
1
vote
1answer
77 views

Can all optimizations be expressed in source code?

If someone compiled a program with all optimization settings enabled, would it be possible to create source code that, if it was compiled with all optimizations disabled, produced an identical binary? ...
0
votes
1answer
57 views

A systematic approach to creating a simple test parser

I need to create a simple text parser that replaces {tokens} with text from a table. The more complicated bit is the {?text?} ...
3
votes
1answer
123 views

Return destinations for an expression-oriented programming language

I am designing a programming language and I want to give everything the ability to return a value. For example, if I use a block as a right-hand side value, I can assign it to a lvalue: ...
0
votes
2answers
149 views

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

Could a programming language be designed so that there is an inheritance relationship between string and character (both of ...
24
votes
7answers
2k views

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

Looking for insight into decisions around garbage collected language design. Perhaps a language expert could enlighten me? I come from a C++ background, so this area is baffling to me. It seems ...
5
votes
1answer
333 views

Lazy concatenative functional language

Can the idea of concatenative programming languages be extended to call-by-need evaluation strategy? I see some problems that I will explain with few examples. I will use a prefix instead of a ...
1
vote
1answer
108 views

Metaprogramming taken to an unnecessarily high level- how can a program write not just other programs, but a programming language? [closed]

So basically, automated language-oriented programming. I've tried finding info on this concept, but have had some trouble, probably because my brain is having a bit of trouble grasping the subject ...
0
votes
1answer
303 views

The ultimate virtual machine

It seems to me that one way computer science could be divided up, is into three domains: What is efficient for humans to represent and comprehend What is efficient for computers to represent and ...
1
vote
0answers
59 views

Languages with Multiple Arbitrary Return Values

I am designing a DSL for writing numerical simulations. I am working on a specific issue related to returning values from functions, and I am wondering if any other existing language solves the same ...
11
votes
4answers
1k views

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

While creating a client for a web API in C#, I ran into a problem regarding null as a value where it would represent two different things: nothing, e.g. a ...
10
votes
1answer
897 views

Types as first class Citizen

Coming from a C++ background I don't understand why one needs types / type expressions as first class citizen? The only language I know that supports this feature is Aldor. Does anybody have some ...
4
votes
4answers
768 views

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

I just found out something really quite extraordinary. While looking through Stackoverflow, I came across a question about removing goto from a php function. PHP ...
0
votes
0answers
28 views

How to design context-free grammars generating the languages with twice as many a’s as b’s? [duplicate]

The problem is designing context-free grammars generating the following languages. The set of strings over the alphabet Σ = {a, b} with twice as many a’s as b’s. I found a solution but I don't know ...
11
votes
3answers
951 views

Automatic Downcasting by Inferring the Type

In java, you must explicitly cast in order to downcast a variable ...
4
votes
2answers
480 views

What is the point of delimiters and whitespace handling

I see that language specifies reserved words, delimiters and whitespaces in the lexer section. Are delimiters just like reserved identifiers in the punctuation space or they have additioinal function ...
25
votes
3answers
3k views

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

I've found several open source visual programing tools like Blockly and friends, and other projects hosted at Github, but could't find any that work directly with the abstract syntax tree. Why is ...
6
votes
1answer
203 views

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

Question: As I'm working on a Hindley-Milner typed lambda calculus, in order to make it usable I need to add some types such as list and pairs. The way I currently do it is, I have an ...
8
votes
3answers
959 views

Why are strings immutable in some languages?

String is an immutable class in Java. An immutable class is simply a class whose instances cannot be modified. Why does the Java programming language choose to make objects of class String immutable?
1
vote
2answers
230 views

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

We're creating our own programming language for a subject. And we're confused whether to add the names of the functions we want to have in our language (like our own version of print) in the BNF ...
5
votes
1answer
397 views

Examples of context sensitive syntactic constructs (statements)

So, I am implementing a context sensitive syntactic analyzator. It's kind of an experimantal thing and one of the things I need are usable syntactical contructs to test it on. For example, the ...
-1
votes
1answer
43 views

How is a procedure application a control structure?

In scheme, a procedure application is considered as a control structure. Why is this?
1
vote
0answers
60 views

DML , ML with restricted dependent types

Refering to this paper Dependent ML: An Approach to Practical Programming with Dependent Types Have defined datatype 'alist ( int ) Its not clear why they have used int as a parameter rather than a ...
2
votes
2answers
95 views

Functional programming with branches that have no order?

I was wondering if there is any programming style in which the outcome does not depend on the order of statements or groups of statements such as guards. Vaguely, I imagine this would leave room for ...
6
votes
3answers
1k views

How did it happen that Algol 60 was an improvement on its successors?

The original statement referred to by this question is: The more I ponder the principles of language design, and the techniques which put them into practice, the more is my amazement and admiration ...
0
votes
0answers
23 views

procedures and immutable data to simulate return values

Let's say I have a programming language that allows procedures, i.e., methods without return values, and immutable data-structures, so no sideeffecting inside a procedure. Is it possible to simulate a ...
1
vote
1answer
73 views

What is the rationale behind implicitly widening integer types in numeric operations?

Languages such as Java and C specify implicit widening of integer types for numeric operators, especially arithmetic operators, to a minimum of 32 bits. What is the rationale behind doing this? My ...
0
votes
0answers
156 views

Recursive macros and termination of assembler

A debate has arisen in the course of using an assembler (which does a bit of preprocessing first, but is mainly a static assembler): This particular assembler allows recursive macros to be defined, ...
2
votes
2answers
871 views

How do global variables and automatic variables with the same name interact?

Suppose I define a global variable and I define an automatic variable within a function definition with the same name as the aforementioned global variable. What would happen to the global variable ...
3
votes
1answer
169 views

Top-down typing strategy - is there a name for this?

In most statically typed languages, each expression has an intrinsic type. E.g. in Java, 3 is an int, 3.0 is a double, ...
5
votes
1answer
127 views

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

We've developed an esoteric language. In this language, a program contains a static amount of code, and a static amount of storage space. However, parts of the program can recurse, so the interpreter ...
1
vote
2answers
172 views

Terminology - the reason for symbol reuse in programming languages

What is the term in programming language creation that is the rationale for symbol reuse? Though potentially confused with overloading, it is not so much the application of symbol reuse, but the ...
1
vote
0answers
55 views

Variable argument placement in methods

Imagine that we have a base class number that has implemented a integer and floats, but not complex numbers and that we would like to extend it to also support ...
0
votes
0answers
308 views

How to generate intermediate code in more than 1 pass in compiler design?

I'm taking a compiler-design class where we have to implement our own compiler (using flex and bison). In dragon book by V.Aho et al. They have mentioned backpatching to backpatch forward references ...
8
votes
2answers
309 views

How to bridge theory and implementation for while loops?

I'm working on my own little programming language for educational purposes, and I've run into a little bit of a problem. There are a few different solutions for it, but all of them seem inelegant - ...