Newest Questions

2 votes
1 answer
540 views

Semantics on `with` keyword in C# for (heap-based) records

I have a question about a C# language design. Let's have a following code: ...
TN.'s user avatar
  • 129
-5 votes
2 answers
320 views

How can an assembler provide suggestions for misspelt named registers with Levenshtein distance, as it cannot know token is supposed to be a register?

Here is an example program in PicoBlaze assembly language illustrating and explaining the problem: ...
FlatAssembler's user avatar
9 votes
4 answers
3k views

Is it plausible to let modulo-by-zero have a well-defined output value, provided that my language is C-like?

By mathematical definition, for every nonnegative integer n and every positive integer d, it holds that the modulo ...
Dannyu NDos's user avatar
  • 1,101
0 votes
1 answer
337 views

Why don't assemblers, even those that support arithmetic expressions in compile-time constants, tend to support the ternary conditional `?:` operator?

So, as per my previous question, I added the support for the ternary conditional operator ?: into my PicoBlaze assembler written in JavaScript for compile-time ...
FlatAssembler's user avatar
1 vote
1 answer
156 views

In the old Angular, why did `[ngSwitch]` go into square brackets, but `*ngSwitchCase` was preceded by `*`? Wouldn't `*ngSwitch` make more sense?

In the old versions of Angular (before the @if, @for, and @switch), why did ...
FlatAssembler's user avatar
10 votes
1 answer
331 views

What's the current state of the art for inferring/checking integer range types?

I'm putting together a small language, and I'd like its type system to include bounded integer types, where for any expression e and integer literals $l,h$, the ...
Antal Spector-Zabusky's user avatar
7 votes
1 answer
406 views

What problems do applicative functors solve, as an abstraction relative to monads and arrows?

TL;DR This site is of course particularly interested in the language designer's and implementor's perspective so, following What is an arrow and what powers would it give as a first class concept in a ...
D. Ben Knoble's user avatar
2 votes
0 answers
196 views

Should comparison operators check whether their arguments are the same object?

I'll focus on the == operator in C++. Its usual declaration signature for overloading is: ...
Dannyu NDos's user avatar
  • 1,101
2 votes
1 answer
545 views

Why weren't the WebAssembly directives `load` and `store` made more future-proof by requiring an additional argument specifying which linear memory?

So, WebAssembly is planning to add the support for multiple linear memories (something like x86 sections). And some WebAssembly directives (such as data) are made ...
FlatAssembler's user avatar
3 votes
1 answer
204 views

How is the `wasm2c` tool from the WebAssembly Binary Toolkit capable of converting WebAssembly code doing unaligned access into C?

My AEC-to-WebAssembly compiler often outputs WebAssembly code doing unaligned access, which is valid in WebAssembly (it's just not guaranteed to be as fast as aligned access, and, on ARM, it usually ...
FlatAssembler's user avatar
6 votes
0 answers
249 views

In ARM assembly, why is the bitwise OR operation called "ORR" (with double 'r'), rather than simply "OR"?

So, I've been studying the basics of the ARM assembly (and daydreaming about making a compiler which outputs it) and I can't help but notice that the mnemonic doing the bitwise OR operation in ARM ...
FlatAssembler's user avatar
0 votes
1 answer
384 views

Are there any programming languages that operate solely via side-effects?

Out of curiosity I checked how Google AI would respond to a similar question. The bot seemed clever enough to understand the question, but responded that functions in this case would have no return ...
Osr Workshops's user avatar
1 vote
2 answers
318 views

Decimal point as a binary operation [closed]

I wonder if anyone has tried implementing the decimal point as a binary operation a.b = $f(a, b) = a+b/10^{1+floor(log_{10} b)}$ That would simplify the PL design, and add new possibilities. For ...
Марат Рамазанов's user avatar
77 votes
2 answers
31k views

How do modern compilers choose which variables to put in registers?

C has the register keyword, originally designed as a hint to the compiler that a variable should be placed in a register rather than on the stack. However this is ...
CPlus's user avatar
  • 10.3k
6 votes
6 answers
1k views

Language constructs to reduce inadvertent interface implementation in purely structural type systems?

In a structural type system there may be cases where an inappropriate object is passed to a function because it implements the interface by chance. For example (in some hypothetical structurally typed ...
Kyohei Kaneko's user avatar
17 votes
4 answers
3k views

Why did C99 have to add the underscored keywords for _Bool _Complex _Imaginary but not for inline or restrict?

C99 introduced the following keywords: _Bool _Complex _Imaginary ...
CPlus's user avatar
  • 10.3k
1 vote
2 answers
284 views

How does the GNU Assembler deal with the directives for changing the syntax from AT&T to Intel or vice versa if those directives are in if-branching?

GNU Assembler, when targetting x86, has directives .att_syntax and .intel_syntax for switching between Intel Syntax and AT&T ...
FlatAssembler's user avatar
13 votes
2 answers
806 views

What optimizations are possible with unsequenced operators?

In C, most binary operators do not specify which operand will be evaluated first: ...
CPlus's user avatar
  • 10.3k
6 votes
1 answer
1k views

Why does the `target` attribute in HTML require a string starting with an underscore, such as `"_blank"`? Why not simply `"blank"`?

To specify in HTML that an <a> link needs to opened in a new tab or a new window, you use the following syntax: ...
FlatAssembler's user avatar
4 votes
1 answer
310 views

Are there OO languages which implement objects as persistent data-structures?

I am an object-oriented developer professionally, but I have researched functional programming and (believe that) I understand the key principles which to varying degrees are applied in FP languages. ...
Kyohei Kaneko's user avatar
6 votes
4 answers
535 views

Do any notable programming languages other than Fortran mark line continuation at the beginning of the following line?

In the first high-level language (FORTRAN), lines of text would by default be treated as individual statements, except that a card which contained something other than an asterisk or C in column 1 and ...
supercat's user avatar
  • 2,252
1 vote
1 answer
303 views

C specification's "sequenced before" and "pair-wise relation"

Paragraph 5.2.2.4 of ISO 9899:2024 says Sequenced before is an asymmetric, transitive, pair-wise relation between evaluations executed by a single thread... What does the pair-wise relation mean? Is ...
Black Monk's user avatar
-1 votes
1 answer
284 views

Strongest criticisms of object-oriented languages? [closed]

Linus Torvalds has famously attacked the object-oriented language C++, but he didn't offer many specifics about why, besides saying C++ uses "inefficient abstracted programming models". What ...
Geremia's user avatar
  • 109
1 vote
3 answers
283 views

What to do with productions that have multiple LHS?

In the C language, a function call has a parameter list of assignment-expressions defined as: ...
DannyNiu's user avatar
  • 353
3 votes
1 answer
1k views

Strings and arrays in Project Valhalla

My understanding of Project Valhalla's impact on arrays and Strings (please let me know if this is off): arrays will still be reference objects but an array of ...
BPS's user avatar
  • 133
3 votes
1 answer
193 views

Alternatives to ANTLR 3 for LL(1) Grammar verification

I'm developing an expression language using a LL(1) recursive descent parser. Technically it's actually LL(2) since I need an extra lookahead in one place. I'm using ANTLR 3 (ANTLRWorks) to verify ...
Nexus's user avatar
  • 31
26 votes
3 answers
7k views

Why do many programming languages use the symbol of two vertical parallel lines `||` to mean "or"?

Why do many programming languages use the symbol of two vertical parallel lines || to mean "or"? Is it because two switches connected in parallel form a ...
FlatAssembler's user avatar
0 votes
3 answers
209 views

Distinguish identifier reference and definition

I have the following prototype grammar that I intend to use to test a home-made LR(1) parser. During the process of writing it, I realize that there's a potential ambiguity with regard to the function ...
DannyNiu's user avatar
  • 353
-1 votes
2 answers
414 views

If in computer science, compare-and-swap is known as "compare-and-swap," why are the C/C++ functions named atomic_compare_exchange_*?

In computer science, compare-and-swap is known as, well, "compare-and-swap" and often abbreviated as "CAS." Why are the functions in the standard C library and C++ library named <...
Paul J. Lucas's user avatar
3 votes
2 answers
270 views

Alternatives for concept of sub-modules

I imagine that I would like to have some form of sub-module concept in my language. Where the exposed types and functions of the sub-module is accessible for the parent module, but not for other ...
Jonas's user avatar
  • 585

15 30 50 per page
1
2 3 4 5
30