logoalt Hacker News

falcor8404/04/20251 replyview on HN

Yeah, I suppose you're right and I'd love to understand more. Do you imagine a modality of programming a computer in an abstract (pictorial? diagrammatic?) way that fully bypasses the current need to form statements?


Replies

yencabulator04/04/2025

Let's try this as an example.

    fn foo() -> Result<u32, MyError> { ... }

    let x = foo();
    match x {
        Ok(num) => println!("foo is {num}");
        Err(error) => eprintln!("no foo for you: {error:?}");
    }
So I have in my head a thing that has the name "x" and a spatial connection to that area of the source code where foo is called.

x is a Result<u32, MyError> and in my head that's a vague abstract shape with the "potential" to be either the uint32 shape (in my mind, a "brick" of a certain size) or a MyError shape (vague blob and since I know it's an enum it also has its own "potential" to be multiple shapes; it kind of has the branchiness of a tree without being tree-shaped; this is all abstract and concepts, not concrete shapes).

When "x" meets the "match" the "x" shape splits into its "potential" shapes, and "num" has the uint32 brick shape.

None of this has anything to do with visual programming like Scratch. It's just that I never say in my head words like "x has value of what foo returns" or "num is an uint32"; those just are.

Does that make any sense to you?

show 1 reply