3 ms·
There are infinitely many Rust and Python programs, just as there are infinitely many English sentences. Search is a really weird way to talk about programming
by pharmakom 3y ago
There are infinitely many Rust and Python programs, just as there are infinitely many English sentences. Search is a really weird way to talk about programming.
- maxbond 3y agoI'm gunnuh address this because I think these are interesting nitty gritty details, but note that these are metaphors expressed in a shared vocabulary that happens to be technical, let's not get too caught up in how many Rust programs there are, that's a more literal interpretation than I intended. If you cap the number of tokens, the are fewer Rust programs. If you prefer, things that may be done implicitly in Python must be done explicitly in Rust - there are fewer valid choices when constructing a program; or equivalently, as you write a Python program, the options for your to proceed fan out faster. Really we aren't searching the whole space of programs though. We understand that adding no-ops to a program doesn't move us out of the equivalency class of that program (unless we're actually using those for timing or another side effect, of course, but then they are no-ops in name only). We're only searching through programs that reasonably solve the problem at hand. Maybe that space is infinite, I don't think so. I think of programming as being a fuzzy beam search (among other ways I sometimes think about programming). Your salience may vary, feel free to drop in a metaphor of your choosing there.
- pharmakom 3y agoWe can model programming as search, but programming as humans do it is more like design than search. I mean this in the qualitative and experiential sense. I don’t sit in front of the screen as candidate programs flash by until I see the one that I want. I also don’t edit by AST transformations from one valid program to another, like edges in a graph. I really don’t see the possible program space as all that relevant.
- maxbond 3y ago> I also don’t edit by AST transformations from one valid program to another, like edges in a graph. I don't really see how else you would edit a program? That's what you're doing when you type at your IDE, right? But I think you're understanding how I think of it, feel free to take it or leave it. I'm not gunnuh die on a hill of insisting my way of thinking of it is right, it's just right for me. > I really don’t see the possible program space as all that relevant. In my example, I fell into a silently invalid state. In a more constrained environment, I wouldn't have. It's easier to go bowling with the bumpers turned on, and if your goal was to make as many strikes as possible (rather than to be sporting), surely you'd only ever bowl with the bumpers. It's a Murphy's law thing. The more invalid states you have, the easier it is to get mired there.
- pharmakom 3y agoMost programmers (including myself) are editing unstructured text and after that text is written the editor will tell them if it’s valid code or not. Edit: I cannot reply, but there are structured program editors out there you may find interesting!
- maxbond 3y agoYes, of course I do too, I live on the same planet, but that's an unstructured interface to changing the AST. (You can reply to comments when the reply button is hidden by clicking the link to go directly to the post. I consider it a polite request by dang to consider whether a conversation is getting too heated, which I don't think it is here at all. Cheers, I'll try to check those editors out.)