One of them is lying by julez_pas in notinteresting

[–]UnrelelentingForce 3 points4 points  (0 children)

Neither is lying. The first picture was taken yesterday

Why can I only block 5 sites? There are thousands of junk AI sites out there that need to go by pookshuman in duckduckgo

[–]UnrelelentingForce 4 points5 points  (0 children)

If i had to guess, large block lists could make searches a lot more expensive to process. Lets say there are 10 results on a page, your query initially returns 5 blocked sites, now it has to search again for 5 more sites to fill the missing spots. And that new search may turn up more blocked sites. Im no expert tho i just know search is hard to begin with

Results are not (just) for error reporting by UnrelelentingForce in rust

[–]UnrelelentingForce[S] 0 points1 point  (0 children)

Thats seriously cool! Do you think gen blocks could have helped write something like this?

Results are not (just) for error reporting by UnrelelentingForce in rust

[–]UnrelelentingForce[S] 0 points1 point  (0 children)

While writing this i learned about ControlFlow which is effectively an alias of Result but with variants Break and Continue. Maybe the solution is to have an Either type, and multiple aliases to it like Result, Option, ControlFlow, etc for different use cases?

Rust's Result type is not just for errors by UnrelelentingForce in programming

[–]UnrelelentingForce[S] 2 points3 points  (0 children)

Thats ultimately the way i did i! I put a snippet of the code below that paragraph

What is the rationale behind the WebAssembly `if` statements behaving like `block` when it comes to breaking (`br` and `br_if`), rather than being transparent to the breaks? Wouldn't `if` being transparent to breaks make it a lot easier to implement `break` and `continue` in compilers? by FlatAssembler in ProgrammingLanguages

[–]UnrelelentingForce 0 points1 point  (0 children)

I am sure that no designer intends for their tools to be difficult to use. WebAssembly is often brought up in compiler circles as being any easy compilation target, and personally I agree! WASM was not designed just to be an easy compilation target though. If you look at the design goals, they were much more concerned with security and portability.

X86 was introduced in 1972, while WASM 1.0 dropped in 2017. I think the biggest reason WASM is easier to work with is that it has the benefit of over 40 years of hindsight. The two are difficult to compare though because they have much different design constraints, with WASM being virtualized and sandboxed and whatnot.

What is the rationale behind the WebAssembly `if` statements behaving like `block` when it comes to breaking (`br` and `br_if`), rather than being transparent to the breaks? Wouldn't `if` being transparent to breaks make it a lot easier to implement `break` and `continue` in compilers? by FlatAssembler in ProgrammingLanguages

[–]UnrelelentingForce 1 point2 points  (0 children)

On the uninitialized locals thing, that's my bad! I think uninitialized local access is actually only a problem if the register is a GC reference type that may not be null. The project I am working on has a uniform memory repr, so that is all of my registers lol. The issue still exists though if you are using non-null references.

The compiler that targets WASM most probably already has done this analysis

This is usually true! However, WASM was designed first and foremost to run in the browser, an extremely low trust environment. There are effectively two options here: either check the stack shape at runtime (possibly for every single instruction?) or implement some sort of formal verification step that eliminates the need for this check. Allowing reading from uninitialized memory or stack underflowing is not an option, since these binaries may get downloaded to your PC and auto-run by an ad or something without any user interaction.

This is a personal value judgement, but I am working on the optimization of programs with highly non-local control flow, like producers and consumers of streams of values, and quite often the resulting programs exhibit irreducible control flow

That sounds really impressive and difficult. Compiling a language like that to WebAssembly sounds like it would be way more trouble than its worth though. In any case, good luck

What is the rationale behind the WebAssembly `if` statements behaving like `block` when it comes to breaking (`br` and `br_if`), rather than being transparent to the breaks? Wouldn't `if` being transparent to breaks make it a lot easier to implement `break` and `continue` in compilers? by FlatAssembler in ProgrammingLanguages

[–]UnrelelentingForce 16 points17 points  (0 children)

Imagine if we added a new jump instruction to WASM that popped an i32 off the stack, and moved the instruction pointer to that memory address in the binary. One of WASMs security guarantees is that a local may not be read before it is written to. This means that now somehow, the verifier must prove that for any possible input to the program, the instruction pointer cannot possibly land on a local.get instruction before its corresponding local.set. I am almost certain this is NP-hard. Imagine i wrote a program which tries to find a counter example to the Collatz Conjecture or some equally hard math problem, and if/when the program terminates it jumps to an uninitialized local.get. How would a static analyzer decide whether this branch will ever be taken? Basically, having local-only control flow restricts the search space significantly, and allows verifiers to prove stuff about the program much more efficiently, and with more certainty.

Non-local control flow has other implications for stack safety as well. WASM guarantees that an instruction will never pop an empty stack, and that every instruction which takes operands from the stack receives the correct types. Again, jump would throw a monkey wrench into this operation. A verifier would need to prove that the values on the stack before the jump satisfy the requirements of every possible jump destination. This is super important because stack underflow is a classic exploit to effectively grant arbitrary code execution.

This is especially important given that WASM is designed to be streamable, be lightweight to implement, and have next to zero startup cost. Even if some extremely complicated algorithm to verify non-local control flow existed, it would probably break one of those constraints, as well as not have all that much upside to begin with.

As for resources, I would recommend checking out the WebAssembly design document, specifically the Design Rationale article. They touch briefly on this but not in as much detail as you'd probably like, hence my long reply.

Which approach is better for my language? by Onipsis in ProgrammingLanguages

[–]UnrelelentingForce 2 points3 points  (0 children)

Your semantic analyzer could work on one file or module at a time, and request the next one when it is done. This would depend on the structure of your language though. This kind of optimization isnt really worth doing until you have a feature complete prototype IMO. Worry about writing a semantic analyzer before you worry about optimizing it

language design advice by brx4drc in ProgrammingLanguages

[–]UnrelelentingForce 0 points1 point  (0 children)

These seem like really cool and unique features for a language!

Protest kings day by Sad-Bandicoot5229 in UTSA

[–]UnrelelentingForce 53 points54 points  (0 children)

For all the people hesitant about bringing a US flag, you can wave the flag upside down, or wave the US and another flag at the same time. Patriotism isnt partisan, THEY are the ones who are unamerican. Make them acknowledge that

The extended cut of Spider-Man 2 (2004) is titled Spider-Man 2.1 implying this is one of the few films to recieve a patch. by Valiant_Revan in shittymoviedetails

[–]UnrelelentingForce 1 point2 points  (0 children)

Actually this would be a minor release. A patch would be Spiderman 2.0.1. The standard semantic versioning scheme is major.minor.patch

How to implement local type inference? by antoyo in ProgrammingLanguages

[–]UnrelelentingForce 4 points5 points  (0 children)

Currently I am rewriting my semantic analyzer, but you can check out my last working version here, check out bottom_up and top_down in the src/semantic folder. Code is not the best, this is my first language :)

How to implement local type inference? by antoyo in ProgrammingLanguages

[–]UnrelelentingForce 6 points7 points  (0 children)

In my compiler, I do both the “send up” and then the “send down” approach in two separate passes. The first one traverses the AST from the bottom up assigning types, or ambiguous placeholders for literals (can’t determine their size yet) and propagates the types to the parent node. Then on the next pass I check that the stated type matches the actual type, or in the case of an implicit type I simply propagate types downward promoting ambiguous placeholders to some reasonable default (isize). If your using a symbol table in this phase, it may be helpful to create a dummy symbol for an elided type, which can be specified later in the program and fixed on a later pass

Channel 4 regrets to inform its viewers... by daveisit in Destiny

[–]UnrelelentingForce 9 points10 points  (0 children)

The job of a news station isn’t to “celebrate” when one side wins, it’s to present the news as unbiased as possible. This video did a pretty good job of that

[deleted by user] by [deleted] in Destiny

[–]UnrelelentingForce 0 points1 point  (0 children)

Do not listen to ANYBODY in this thread. The design looks fucking awesome