Questions tagged [programming-languages]
Artificial languages for instructing computers to do steps of computation in order to complete tasks. They allow programmers to communicate with computers.
1,406 questions
2
votes
5
answers
1k
views
Why don't languages auto import everything based on namespace?
This is basically a continuation of "Why don't languages auto import everything?" but with a slightly altered premisse:
Say we have a language like C++ / python that uses namespaces to ...
35
votes
11
answers
13k
views
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
As developers, we often face the challenge of balancing meaningful variable names with code readability. Long, descriptive names can make code harder to read, while short names may lack context. For ...
3
votes
5
answers
1k
views
How are strings simultaneously objects and primitive data types in C#?
In C#, strings can be used like objects with methods, properties, and other features of objects. At the same time, strings are treated the same as primitive data types like int or float in numerous ...
1
vote
1
answer
723
views
Tagged pointers vs. fat pointers
I'm writing my own dynamic programming language. So far I've been using a tagged union for all values. Since this boxes primitive types needlessly, I've begun researching tagged pointers which seem to ...
0
votes
1
answer
186
views
Bytecode format and loading in language VMs
I am thinking about how to build a language VM. I have been able to get some of the basic constructs right, including jumps to functions within the chunk of bytecode that is currently loaded.
But now ...
0
votes
2
answers
318
views
Advantage of implicit/explicit declaration of global symbols (like functions)
In C and C++ we need to declare a function before its usage, if its definition comes after where it is called. (Well, there is also the "implicit declaration" rule in C, but it is rarely ...
0
votes
2
answers
772
views
Is there a language agnostic interface for programming language interop?
There are many packages for creating bindings of a library that's written in one language to be called from another language. Some programming languages also include such interop in the standard ...
1
vote
5
answers
846
views
Why don't languages auto import everything?
Why is there a such thing as import in programming languages? If a package does not exist, then trying to import it would cause an error anyway. So why don't languages just auto import ALL available ...
0
votes
1
answer
252
views
Is it true that variable type before name makes compiler work easier? [closed]
I have seen information that at least one of reasons why type placed before variable name is that it allows compiler easier evaluate size and type of variable. If so then how (what way) it eases this ...
0
votes
1
answer
309
views
How to decide when to increase the minimum supported C++ standard version?
I'm maintaining a library written in C++, which offers modern-C++ bindings for another API that's C-ish (it's this one, although I'm trying to make this question somewhat more general).
Now, when I ...
0
votes
1
answer
758
views
How is it possible to store the AST nodes location in the source code?
I created a simple parser in Rust and defined the AST like this:
enum Expression {
Number(i32),
BinaryOperator(Box<Expression>, Operator, Box<Expression>),
Identifier(String),
}...
0
votes
0
answers
715
views
Haskell where clause: is it more than just a matter of taste?
The traditional (Scheme, Pascal) way to structure code is this:
declare outer function
declare inner function
body of inner function
body of outer function
The where clause in Haskell moves ...
2
votes
2
answers
515
views
Can access modifiers be completely replaced with programming to interfaces?
If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed ...
13
votes
8
answers
6k
views
How do compilers work in a language that doesn't allow recursion?
I'm recently learning the programming language, and I wonder how compilers work when the language itself does not allow recursion, like how the compiler or the runtime checkers makes sure that there ...
-2
votes
4
answers
274
views
Block structured iteration and recursion
Programming languages traditionally have blocks that specifically cater to controlling iteration.
There is the simple while-loop:
while (i < 3) {...};
Then there is the more complicated for-loop:
...
2
votes
4
answers
921
views
Could a language allow for persistent allocations without heap?
Is it possible in theory to have a programming language that allows for object lifetimes that exist beyond the current scope but without using heap?
As a little background, in embedded development it ...
4
votes
3
answers
1k
views
Why does HTML collapse whitespace?
I've been trying to better understand (at least at a high level) why the early versions of HTML were designed the way they were. Most of the decisions make sense; I can deduce (at least at a high ...
1
vote
5
answers
2k
views
Do state machine based programs have a processing loop - or even exist?
Short Version
If we had an application based on a state machine - transitioning between states to run the application: is repetition, and in fact the entire state machine, based on the presence of an ...
0
votes
1
answer
309
views
Excessively verbose and cryptic comparisons in Java
I don't know if this is the right place to ask more of a "philosophical" question.
The more I code in Java, the more I have to bear with Comparable<T>. And the more I bear with this ...
1
vote
2
answers
1k
views
Implementing libraries for a programming language
Many programming languages have an implementation language (mostly a system language like C) which is used to implement important parts of the core of the language. Besides the libraries are written ...
3
votes
2
answers
847
views
Is there a simple algorithm for generating unit tests given a function's code? [closed]
Given the abstract syntax tree (AST) of each line of a function's code, I am asked to generate code for that function's corresponding unit tests, similar to what Microsoft's IntelliTest tool does here:...
2
votes
1
answer
186
views
Is there a language implemented as a neuron network?
Does there exist some language whose execution model is implemented as a neuron network, or maybe as some other type of a network/grid (e.g. network of finite automata)? That is, specifically, without ...
8
votes
2
answers
2k
views
How does the GLL parsing algorithm work?
I'm very interested in the topic of parsers, especially in the topic of parser combinators like Superpower. The problem with them is that the grammars that they can work with are a bit limited. For ...
-2
votes
1
answer
173
views
Is it a good idea to implement a software application in C# and then convert it to Python? [closed]
My project is about an automatic HTML documentation generator. The final product can't be in C# because of some organizational and legal constraints.
To my experience, Python is harder to debug than C#...
0
votes
1
answer
396
views
Benefits of using a tokenizer/lexer before parsing for recusive descent parser
I am trying to build a static program analyzer for a proprietary progamming language for a school project, and am currently trying to implement the parser from scratch.
I was wondering, what are the ...