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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
42 views

How do function inlining and TCO affect call stack?

I've just accidentally came across this answer about inlined functions and I'd like to know how this affects call stack. But I can't add comments because I don't have enough rep so I decided to ask ...
b3rry's user avatar
  • 3
0 votes
1 answer
94 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 ...
mydoghasworms's user avatar
4 votes
1 answer
311 views

What is the problem with whitespace in C that Ruby allegedly repeated?

I'm reading the book The Secret Life of Programs by Jonathan E. Steinhart. In it, he mentions in passing: many consider the handling of whitespace in Ruby to be a replay of of a mistake in the ...
tsvallender's user avatar
0 votes
2 answers
113 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 ...
Ma Joad's user avatar
  • 101
3 votes
3 answers
291 views

Is there a programming language other than Java, C#, and Go which includes null with its static object types?

I was reading the excellent book by Axel Raushmayer, Tackling TypeScript. In this section of Chapter 7, the author makes the interesting claim In many programming languages, null is part of all ...
Ray Toal's user avatar
  • 1,305
-1 votes
2 answers
183 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 ...
danijar's user avatar
  • 826
-1 votes
1 answer
194 views

Languages with PHP-like traits?

PHP have what it calls "traits" which despite the name is not like traits in Rust, Scala or other languages. In many other languages with support for traits, a trait create a is-a relation. ...
Fred's user avatar
  • 449
0 votes
5 answers
446 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 ...
user1345541's user avatar
-1 votes
1 answer
79 views

Is it a good idea to let keywords have different lexical rules from names of types, variables, functions, etc? [closed]

For example, keywords have a special prefix. Objective-C has @interface, @implementation, but that's for compatibility with C. It inherits all the C keywords of course, with no @. How about a language ...
Eugene's user avatar
  • 117
0 votes
1 answer
198 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 ...
Ya Y's user avatar
  • 29
1 vote
5 answers
667 views

Why do many programming languages lack standard vector types?

Many languages such as C or even C++ or C# or Java have no natively supported vector (SIMD) types or functionality. In such languages, one would have to either use non-standard extensions or third-...
user16217248's user avatar
  • 1,113
0 votes
1 answer
89 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 ...
einpoklum's user avatar
  • 2,488
0 votes
1 answer
102 views

Are indirect implicit type declerations dangerous?

In the case of kotlin, rust and many other programming languages... There are variables with direct implicit type declarations... Where you can see the type of a variable at the same line where it's ...
user avatar
0 votes
1 answer
191 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), }...
Iter Ator's user avatar
  • 111
3 votes
1 answer
247 views

Do the maintainers of JavaScript remove features?

Really dumb question. I really like the new feature called "optional chaining" in JavaScript, and it's used in quite a few places in my front end code. However, I am concerned that whoever ...
Rongeegee's user avatar
  • 167
0 votes
0 answers
205 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 ...
ceving's user avatar
  • 381
0 votes
2 answers
82 views

I've a doubt regarding Environment Model of execution

I came across Environment Diagrams,it is described below Whenever Python needs to work with an object, that object is stored in memory; and, additionally, Python also needs a way to associate names ...
Dennis's user avatar
  • 19
2 votes
2 answers
375 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 ...
Ondrej Bozek's user avatar
8 votes
5 answers
7k views

Is code written inline faster than using function calls?

I wrote some script in Python that creates a giant 2D matrix (1000x1000 or bigger) and fills it with random numbers. And after that, it goes through every element of the matrix and changes the number ...
devdevdove's user avatar
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 ...
csxyyyyy's user avatar
  • 151
-3 votes
1 answer
211 views

Managing a project with an unfamilar programming language

Is there any common wisdom for managing a software project in an unfamiliar programming language? Most software projects go for safety and use some mainstream language but some opt for a niche ...
Gergely's user avatar
  • 131
-2 votes
4 answers
219 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: ...
Steve's user avatar
  • 7,148
4 votes
2 answers
1k views

Multidimensional vs nested arrays

A seemingly basic question here. Is there anything you can do with multidimensional arrays that you can't do with nested arrays? Many languages have been designed with both facilities and syntactical ...
Steve's user avatar
  • 7,148
1 vote
4 answers
497 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 ...
Jeff's user avatar
  • 129
1 vote
2 answers
207 views

What does "legacy signature" mean?

I see the term legacy signature a lot in the documentation of programming languages. For example in the php documentation : Passing the separator after the array (i.e. using the legacy signature) ...
Hicham Jerdaoui's user avatar
1 vote
3 answers
554 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 ...
Mathew Alden's user avatar
0 votes
0 answers
184 views

What is it about kdb/q that makes the grammar not suitable for ANTLR style parser generators?

I want to build a code analysis tool for personal use when programming in kdb/q. In order to do this, I need to be able to parse q code into an AST. I have never written a parser before. ANTLR4 seems ...
Chechy Levas's user avatar
1 vote
5 answers
642 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 ...
Ian Boyd's user avatar
  • 24.5k
3 votes
2 answers
345 views

Moderate discussion on choice of programming language

Assume you have a small set of suitable programming languages (e.g., Python, C++, Julia), a clearly defined task (development of software services in the context of computational sciences), and a team ...
Unis's user avatar
  • 165
0 votes
1 answer
201 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 ...
Thomas Herondale's user avatar
-1 votes
2 answers
235 views

Why do most AST trees use classes instead of vectors

I've noticed that most AST tree implementations use classes for nodes instead of something like a vector. I want to ask, why do most people use classes? Are there issues to using vectors to make AST ...
StandingPad Animations's user avatar
1 vote
2 answers
505 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 ...
Student's user avatar
  • 133
0 votes
2 answers
201 views

Do lexers have to go word by word or can they go line by line

So I'm trying to write a interpreter with a lexer. Currently, it adds a token line by line and does some more processing later on. But when I look at sources online, they all seem to go word by word ...
StandingPad Animations's user avatar
1 vote
2 answers
394 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:...
David Johnson's user avatar
0 votes
3 answers
651 views

Is it possible to make a compiler for any dynamic/script/interpreter language

Logically, not based on how cost we will spend or how much we will hire programmers to do it. Can we (Is it possible to) make a compiler for any dynamic/script/interpreter language, like Lua, Python, ...
Zaher Dirkey's user avatar
2 votes
1 answer
170 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 ...
Al Berger's user avatar
  • 269
2 votes
1 answer
99 views

Hot reloading anonymous functions in a custom scripting language

I am implementing anonymous functions (lambdas) in a scripting language that supports hot reloading. The language currently supports passing user defined functions (pointers) to plugin functions which ...
korri123's user avatar
  • 141
4 votes
2 answers
1k 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 ...
SuperJMN's user avatar
  • 413
3 votes
4 answers
897 views

Do all dynamically typed languages not support function overloading?

I have noticed that JavaScript and PHP and Python do not support function overloading. Do all dynamically typed languages not support function overloading? If the answer is yes, then why is that?
William's user avatar
  • 65
-2 votes
1 answer
145 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#...
user366312's user avatar
0 votes
2 answers
154 views

Technology choice reasoning

I am tasked with making a program that will roughly have the same steps as a program that a former has written. The program that I'm trying to imitate doesn't seem to be open for extension, otherwise ...
lukaabra's user avatar
0 votes
1 answer
278 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 ...
Meowmi's user avatar
  • 101
13 votes
5 answers
2k views

How can I simulate a "negative" type system?

In my experience, all languages I know have a sort of "positive" type system. What I mean by "positive type system" is that when you are writing the source code, you always specify ...
user avatar
4 votes
5 answers
4k views

Why don't languages like C have NAND operators?

I know that some languages like APL have a dedicated NAND operator, but I'm thinking about languages like C, C++, Java, Rust, Go, Swift, Kotlin, even instruction sets, etc. since these are the ...
Ky -'s user avatar
  • 525
-2 votes
2 answers
121 views

How are futures and speculations evaluated differently?

In Practical Foundation of Programming Languages 38 Futures and Speculations A future is a computation that is performed before it is value is needed. Like a suspension, a future represents a value ...
Tim's user avatar
  • 5,415
0 votes
1 answer
182 views

How can I tell if a library's execution model is the same as or different from the execution model of its base language?

https://en.wikipedia.org/wiki/Execution_model says A programming language consists of a grammar/syntax plus an execution model. The execution model specifies the behavior of elements of the language. ...
Tim's user avatar
  • 5,415
-1 votes
3 answers
782 views

Why are constants declared with `let`?

A few weeks ago, I went on Udemy course on Swift, the instructor mentioned that constants are called let in Swift because it's standard in OOP (JavaScript uses it for example). I know this may seem ...
Laurens van Oorschot's user avatar
1 vote
1 answer
146 views

How to manage versioning for changes that only affect some pieces of a package?

I'm designing a new language and the package-management system for it (something like NPM, Cargo, Pip, Gem, Cpan, Cabal, NuGet or the like). I'm trying to decide what's a good way to handle the ...
Blue Nebula's user avatar
-9 votes
1 answer
128 views

Are the stone-dead PHP mailing lists really how PHP developers and the PHP community communicate? [closed]

I've been looking at this for a long time: https://news-web.php.net/ Almost every single mailing list has the last messages sent to them in the year 2000-2003. That's 17-20 years ago! It would be an ...
user14756437's user avatar
3 votes
1 answer
144 views

Choosing the design of a scientific DSL: purely or impurely functional?

My aim is to create a language specific to the scientific field (which would be used mainly in the field of machine learning and physics) which would be based on the functional paradigm, a paradigm ...
Foxy's user avatar
  • 219

1
2 3 4 5
28