Readit News logoReadit News
GrantMoyer commented on What is “literate programming”? (2024)   pqnelson.github.io/2024/0... · Posted by u/joecobb
js8 · 10 days ago
Maybe I am weird, but I would like to see/program in a formal, yet fuzzy/modal language, which could serve as a metalanguage that describes (documents) the program. This metalanguage must have some kind of constructs to describe unknown things, or things that are deliberately simplified in favor of exposition. So basically eschew natural language completely in favor of fully formalized description, that could be manipulated programmatically.

However, I don't know what this metalanguage should be. I don't know how to translate typical comments (or a literate program) into some sort of formal language. I think we have a gap in philosophy (epistemology).

GrantMoyer · 9 days ago
> This metalanguage must have some kind of constructs to describe unknown things, or things that are deliberately simplified in favor of exposition.

Perhaps you're thinking of mathematics.

If you have to be able to represent arbitrary abstract logical constructs, I don't think you can formalized the whole language ahead of time. I think the best you can do is allow for ad-hoc formalization of notation while trying to keep any newly introduced notation reasonably consitent with previously introduced notation.

GrantMoyer commented on GitLab discovers widespread NPM supply chain attack   about.gitlab.com/blog/git... · Posted by u/OuterVale
naikrovek · 19 days ago
Plan9 had per-process namespaces in 1995.

One could easily allow or restrict visibility of almost anything to any program. There were/are some definite usability concerns with how it is done today (the OS was not designed to be friendly, but to try new things) and those could easily be solved. The core of this existed in the Plan9 kernel and the Plan9 kernel is small enough to be understood by one person.

I’m kinda angry that other operating systems don’t do this today. How much malware would be stopped in its tracks and made impotent if every program launched was inherently and natively walled off from everything else by default?

GrantMoyer · 15 days ago
Linux supports per-process namespaces too, and has tools like firejail to use them for sandboxing, but nonetheless sandboxing is not widely used.
GrantMoyer commented on I don't care how well your "AI" works   fokus.cool/2025/11/25/i-d... · Posted by u/todsacerdoti
raincole · 21 days ago
> It's like some cruel joke the universe decided to play on people who like to think hard and understand the systems around them.

Yeah. This cruel joke even has a name: The Bitter Lesson.

https://en.wikipedia.org/wiki/Bitter_lesson

But think about it: if digital painting were solved not by a machine learning model, but human-readable code, it would be an even more bleak and cruel joke, isn't it?

GrantMoyer · 21 days ago
> if digital painting were solved not by a machine learning model, but human-readable code, it would be an even more bleak and cruel joke, isn't it?

On the contrary, I'm certain such a program would be filled with fascinating techniques, and I have no dread for the idea that humans aren't special.

GrantMoyer commented on I don't care how well your "AI" works   fokus.cool/2025/11/25/i-d... · Posted by u/todsacerdoti
easterncalculus · 21 days ago
> I find it particularly disillusioning to realize how deep the LLM brainworm is able to eat itself even into progressive hacker circles.

That's the thing, hacker circles didn't always have this 'progressive' luddite mentality. This is the culture that replaced hacker culture.

I don't like AI, generally. I am skeptical of corporate influence, I doubt AI 2027 and so-called 'AGI'. I'm certain we'll be "five years away" from superintelligence for the forseeable future. All that said, the actual workday is absolutely filled with busy work that no one really wants to do, and the refusal of a loud minority to engage with that fact is what's leading to this. It's why people can't post a meme, quote, article, whatever could be interpreted (very often, falsely) as AI-generated in a public channel, or ask a chatbot to explain a hand-drawn image without the off chance that they get an earful from one of these 'progressive' people. These people bring way more toxicity to daily life than who they wage their campaigns against.

GrantMoyer · 21 days ago
I largely agree with this, but at the same time, I empathize with the FA's author. I think it's because LLMs feel categorically different from other technological leaps I've been exited about.

The recent results in LLMs and diffusion models are undeniably, incredibly impressive, even if they're not to the point of being universally useful for real work. However they fill me with a feeling of supreme dissapointment, because each is just this big black box we shoved an unreasonable amount of data into and now the black box is the best image processing/natural language processing system we've ever made, and depending on how you look at it, they're either so unimaginably complex that we'll never understand how they really work, or they're so brain-dead simple that there's nothing to really understand at all. It's like some cruel joke the universe decided to play on people who like to think hard and understand the systems around them.

GrantMoyer commented on Upcoming Rust language features for kernel development   lwn.net/Articles/1039073/... · Posted by u/pykello
meisel · 2 months ago
In my experience, C++ is a much more complicated language. The 8 ways to initialize something, the 5 types of values (xvalues etc.), inconsistent formatting conventions, inconsistent naming conventions, the rule of 5, exceptions, always remembering to check `this != other` when doing a move assignment operator, perfect forwarding, SFINAE, workarounds for not having a great equivalent to traits, etc. . Part of knowing the language is also knowing the conventions on top that are necessary in order to write it more safely and faster (if your move constructor is not noexcept it'll cause copies to occur when growing a vector of that object), and learning the many non-ideal competing ways that people do things, like error handling.
GrantMoyer · 2 months ago
Thanks for organizing for me my thoughts on why even a restricted modern subset of C++ is complicated.
GrantMoyer commented on People regret buying Amazon smart displays after being bombarded with ads   arstechnica.com/gadgets/2... · Posted by u/croes
geraldwhen · 2 months ago
Many with trade offs. I recommend the pocketbook 4. You can disable recommendations easily, and the unit mounts as a disk so you can read and write books as if it were an SD card.

No internet required. No sync software required. It’s quite nice!

GrantMoyer · 2 months ago
Ditto. It's also significantly lighter weight than competing readers (at least when I bought mine), has physical buttons, has color models, and has really good battery life possibly because it runs a custom Linux instead of Android.
GrantMoyer commented on Who needs Git when you have 1M context windows?   alexmolas.com/2025/07/28/... · Posted by u/alexmolas
GrantMoyer · 2 months ago
Like the author, I've also found myself wanting to recover an accidentally deleted file. Luckily, some git operations, like `git add` and `git stash`, store files in the repo, even if they're not ultimately committed. Eventually, those files will be garbage collected, but they can stick around for some time.

Git doesn't expose tools to easily search for these files, but I was able to recover the file I deleted by using libgit2 to enumerate all the blobs in the repo, search them for a known string, and dump the contents of matching blobs.

GrantMoyer commented on Bad Apple but it's played inside Super Mario Bros   tasvideos.org/8991S... · Posted by u/carlesfe
temperceve · 3 months ago
I'd love a laymane overview of what you've done here
GrantMoyer · 3 months ago
I'm not the author, but these video-in-game projects typically work with a few phases:

1. Get the game into a specific state by performing specific actions, moving to specific positions, performing specific inputs, etc. so that a portion of the game state in RAM happens to be an executable program.

2. Jump to that executable code such as by corrupting the return address in the stack with a buffer overflow

3. (optional) The program from 1 may be a simple "bootstrap" program which lets the player directly write a new, larger program using controller inputs then jumps to the new program.

4. The program reads the video and audio from the stream of controller inputs, decodes them, and displays them. The encoding is usually an ad-hoc scheme designed to take advantage of the available hardware. The stream of replayed inputs is computed directly from the media files.

GrantMoyer commented on `std::flip`   morwenn.github.io//c++/20... · Posted by u/ashvardanian
zahlman · 3 months ago
> Interestingly enough, most of these implementations only flip the first two parameters of whichever function they are passed, though it seems to be because most of them are based on the Haskell prelude, and handling arbitrary arity can be tricky in that language.

Probably because the use case for it with higher arity is hard to imagine. (Indeed, TFA gives only examples with binary operations.)

> Fortunately it is not just useless knowledge either: flip can be reified at will by copying the following C++17 implementation.

> [snip 114 lines of code]

Meanwhile, in Python:

  def flip(f):
      return lambda *args, **kwargs: f(*args[::-1], **kwargs)
(I leave keyword arguments alone because there's no clearer semantic for "flipping" them.)

The `toolz.functoolz.flip` implementation (being restricted to binary functions) is an even simpler one-liner (https://toolz.readthedocs.io/en/latest/_modules/toolz/functo...), though accompanied by a massive docstring and admittedly simplified through a heavyweight currying decorator (which accomplishes much more than simply getting a function that does the right thing).

GrantMoyer · 3 months ago
There's a somewhat easier way to implement 2-argument-function flip in C++ than the blog post provides:

  #include <functional>
  constexpr auto flip(const auto& f) {
    return std::bind(f, std::placeholders::_2, std::placeholders::_1);
  }
The best I could get the fully general version is still pretty obtuse though:

  // std doesn't have a template version of placeholders::_1, _2, etc., so we need to
  // define our own. 
  template <int I> struct placeholder{};

  template<>
  template<int I>
  struct std::is_placeholder<placeholder<I>> : std::integral_constant<int, I> {};

  // flip must be an object so that the function type can be deduced without needing
  // to explicitly specify its parameters' types.
  template<typename F>
  struct flip {
    const F f;
    
    // operator() deduces the argument types when the flip object is called, but really
    // all we need to know is the number of arguments. 
    template<typename... Args>
    constexpr auto operator()(Args... args) {
      return bind_reversed(std::make_integer_sequence<int, sizeof...(Args)>{})(args...);
    }
    
    private:
    // a helper function is needed to deduce a sequence of integers so we can bind all
    // the placeholder values.
    template<int... Is>
    constexpr auto bind_reversed(std::integer_sequence<int, Is...>) {
      return std::bind(f, placeholder<sizeof...(Is) - Is>{}...);
    }
  };

u/GrantMoyer

KarmaCake day2060April 3, 2024View Original