Hacker Newsnew | past | comments | ask | show | jobs | submit | yatac42's commentslogin

> but we shouldn't forget that this kind of failure can only happen starting from an ambiguous grammar specification

I don't think that's true. The following CFG is unambiguous:

  S ::= A S | A
  A ::= 'a' | 'a' 'b'
Yet if we translate this 1-to-1 to a PEG (without changing the order of the alternatives), it's not going to match any input with 'b's in it, so it doesn't match the same language.


This grammar is difficult to adapt to ordered choice, having 4 possible variants that mostly define different languages from each other and from the "same" grammar with traditional parsing.

It's a formally very different problem from spontaneously and arbitrarily disambiguating an ambiguous grammar, but in practice it causes the same kind of suffering and it's likely to be a more common issue.


Note that they're actually citing "Mitchell, Webb et al." in the paper.


Also footnote 5: "We originally used Microsoft Word for this but it kept putting the entire document into 8pt Times New Roman whether we wanted it to or not."


> A lot of these games with fancy anti cheat protection the cheat tools basically just tell the server "spawn me a vehicle right here" and the server just does it.

Citation needed. I'd be quite surprised if it were common for servers of professional games to trust the client in that sense (i.e. allowing it to decide game logic like what gets spawned where).

As far as I'm aware the most common types of multiplayer cheats are

* wall hacks, which you could probably prevent by not sending the client any information about objects that the player can't see, but that would require the server to calculate the line of sight for every player/object, * and aim bots, which I don't think you could prevent at all on the server side since they don't rely on the bot having access to any information that the player isn't supposed to have. They just rely on the bot being better at aiming. I suppose if you did all rendering server side and only sent the rendered graphics to the client (i.e. streaming), that would make it harder for the bot because it'd now have to do image recognition to find the target, but that just makes it harder, not impossible. Plus, game streaming wasn't well received for a reason and anyway, I don't think that's what you had in mind when you talked about "not trusting the client".


Look up BF2. Cheat tools would just disable limits locally on ammo requests, vehicle requests, artillery strikes, and so on. Server didn't check anything. It had fancy anti-cheat tech. Which was bypassed by just writing and restoring executable memory changes faster than the anti cheat detected.

Things are certainly not always as professional as they appear to be.

Visibility test is definitely feasible against wallhacks, it's not that expensive.

Aimbot is an assist cheat, which technically does not violate the physical rules of the game, so you are right that it's more difficult to detect. One solution to detect this class of cheating is to record the player's movement, and rely on a combination of outlier scores and outlier movement behavior to detect abuse. It's not watertight, but neither are any of these client side anti-cheat detection schemes.


> re2 uses a DFA-based system instead that just doesn't support the kinds of regexes that catastrophically backtrack

There are certain fearures that are harder or impossible to implement with RE2's approach, but it's not true that it doesn't support the kind of regex that would catastrophically backtrack using a backtracking engine.

`(.*a)*b` would be a (silly) example of a regex that can catastrophically backtrack using backtracking engines and re2 supports it just fine without backtracking.


If it's actually a _regular_ expression, by definition re2 will support it. Of course if by "regular expression" you mean pcre (with things like subpatterns) then this can actually match a many context-free languages as well, and if you're doing that then you probably want a proper parser anyway instead of trying to roll one yourself.


> If it's actually a _regular_ expression, by definition re2 will support it.

Hmmm, kinda sorta. Regular languages are closed under complement and intersection, but RE2 doesn't support them. They are difficult to implement efficiently, particularly with respect to building the regex. There are some issues on the RE2 issue tracker about this.

Of course, you could say that you could always rewrite a regex using complement or intersection to an equivalent regex that doesn't use those operations. While true, such a feat is usually quite tricky. So treat this comment as adding more clarity as opposed to me trying to correct you perhaps. :-)

Complement and intersection are not implemented in any "general purpose" regex engine that I know of. You tend to find them in more specialty projects like redgrep[1] or in libraries specifically devoted to the construction and manipulation of DFAs. (RE2 doesn't have such a thing, only a lazy DFA, because full DFAs are too expensive to build in the "general purpose" context.)

[1]: https://github.com/google/redgrep


And perhaps more relevantly, the regex from the article also works fine in RE2.


> > music I've purchased

> They really ought to stop using "buy"/"purchase" metaphorically to mean something more like "one time fee for an indefinite lease that ends upon account termination."

That doesn't really apply to buying music though, does it? If Amazon banned my account, that wouldn't prevent me from listening to the MP3s I've bought from them. It would only prevent me from re-downloading them from their servers if I somehow lost all of my local copies.

But if I buy a CD from a physical store, they also don't give a me another copy for free if I lose it (even without account termination entering into it), so I'm not really any worse off with the digital download.


I don't see why this is being downvoted. Music is the one digital good I feel the most confident purchasing because I know I'm getting a drm-unencumbered standard format like MP3 or AAC. I have all my music purchases backed up like I do my family photos. Yes, I also listen to my purchases on cloud services like YouTube Music, but if YouTube banned me tomorrow I would lose zero songs.


> But if I buy a CD from a physical store ...

This is literally the nature of physical vs digital goods.

We can, and should, do better for customers than the current systems from Steam and Amazon (among others) allow.


Which current systems?

For games on Steam and movies basically anywhere, the current system is that after I buy the game/movie, I can watch/play it for as long as I have access to the account. If I lose the account or the service shuts down, I'm fucked. That sucks.

For games on GOG or MP3s basically anywhere, the current system is that I buy it and then I can play the game/music forever as long as I don't lose the downloaded files. If I do lose the files, I can still redownload them as long as the service is still operating and I still have access to the account.

The second system seems fine to me.


> For games on Steam and movies basically anywhere, the current system is that after I buy the game/movie, I can watch/play it for as long as I have access to the account. If I lose the account or the service shuts down, I'm fucked. That sucks.

Slight pedantic nit, some games on Steam are DRM-free (though this is in no way indicated, you can find a list online, though*), those you can back up and keep using even if your account gets banned.

* https://www.pcgamingwiki.com/wiki/The_big_list_of_DRM-free_g...


Good point, I've specifically mentioned Steam and Amazon.


Yes and buying music on Amazon (which is what the comment I originally responded to was about), you get system number 2, i.e. a DRM-free MP3 download.

Buying movies on Amazon is a different matter entirely, but the comment and my reply were specifically about music.


Nah. Being able to download a digital purchase at one point, but potentially being unable to download it again later on is a crap system.


I wouldn't say the source language is not meaningful. If you wrote an ahead-of-time JavaScript-to-WebAssembly compiler and benchmarked the WASM generated by that, it would probably be a lot slower than the WASM generated by the Rust compiler, no?


Has anyone compiled v8 to WASM so we can finally run JS in the browser? ;)


v8 is a JIT engine, WASM would not support it.

JavaScriptCore has been compiled to WASM though:

https://mbbill.github.io/JSC.js/

People usually ask why, the answer is usually for fun or for sandboxed plugins.


I imagine that, if one were feeling extremely masochistic, one could generate WASM, JIT-style, and load it as needed. The result may not perform well.


I assumed the JIT would emit WASM.


please don’t give them more ideas


An important difference between your add method and binary search is that the signature of your add method already implies the contract that the sum of the two integers must fit into an int because there simply is no correct value of the specified return type that could be returned otherwise.

There's nothing about the signature of an ordinary binary search method that would imply that it only works for arrays that have less than MAX_INT/2 elements.


True, but you can make the same case for the addition operator which might have a type annotation somewhere, but it's certainly not visible to most programmers.

Simply put, in many languages there is no addition operator which does mathematically correct addition and that is a sad state of affairs.


This is a modern phenomenon.

In the first few decades of electronic computers and programming languages, having an addition or any other arithmetic operation that would not signal correctly the overflow exceptions would have been considered as completely unacceptable.

Computers without the right hardware implementation appeared initially among the so-called minicomputers and microcomputers, i.e. the cheapest computers, which initially were intended for things like industrial control or peripherals for larger computers, where it was supposed that competent programmers will take care to use appropriate workarounds for the hardware limitations.

Unfortunately, this kind of implementation of the arithmetic operations, without appropriate means for detecting overflows, intended initially only for the cheapest products, has spread over the years to all CPUs.

Even if from time to time there are news about some horror story caused by a combination of weak hardware with the lack of appropriate software checks, it appears that there is no hope that this unfortunate hardware design fashion will ever be reversed.


The processors I've used all have an overflow flag that will tell you if an addition result exceeded the size of the register. But I'm not aware of any compilers that will use the flag, because it adds overhead that isn't wanted or needed 99.99% of the time.


> Simply put, in many languages there is no addition operator which does mathematically correct addition and that is a sad state of affairs.

I read a book on Clojure when it was fairly new containing a spirited defense of the fact that arithmetic operators like + and - always returned the correct result. This was slower, because they needed to do bounds checking, but the result was always correct. If you wanted faster arithmetic with bugs, you'd use the explicit operators +. or -. (or *. or, presumably, /. -- I'm not sure how division was handled).

Shortly after that, Clojure reversed its policy and + will give you fast addition with bugs.


None, I think. Best case you have somewhat graceful handling on out of memory, but that handling isn't going to give you the result of the addition.


> if this was true every company would be transparent

"Only assholes and sociopaths are transparent" does not mean "all assholes and sociopaths are transparent".


> I am fairly confident that people still use Apache Ant as build system

As in: there are still (older) projects around that haven't (yet) migrated away from Ant? Sure.

As in: Ant is still the go-to build system or at least still commonly used? No, not at all. When I create a new Java project in IntelliJ for example, I can choose between Maven and Gradle as the build system. Ant isn't even offered as an option.


If the `exit` variable were set to a string, `exit()` would be an error because you can't use `()` on strings. `exit` is a callable whose `__str__` method returns that message.

Note that this isn't specific to the REPL. Running `print(exit)` in a Python script will print the same message.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: