Newest Questions
877 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:
...
-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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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:
...
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 ...
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 ...
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 ...
0
votes
1
answer
383
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 ...
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 ...
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 ...
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 ...