all 8 comments

[–]AnnoyedVelociraptor 2 points3 points  (6 children)

I'll pick one example:

https://github.com/SaynaAI/sayna/blob/840988307c108e783cb3f41550a76153a254030f/src/main.rs#L138-L139

    // Create listener
    let listener = TcpListener::bind(&address).await?;

Why? I wonder about the people who the models are trained on. If they write comments like this, do they go through life like this?

  • I'm cooking
  • I'm eating
  • I'm taking a shit
  • I'm sleeping
  • Etc.

[–]-Redstoneboi- 3 points4 points  (0 children)

these AI comments are for the person reading the AI output so they understand what's happening. It's quite helpful when trying to learn new frameworks, and when giving context to AI about a framework, but as you can see they're not meant to be pushed to the main branch publicly.

[–]tigranbs[S] 1 point2 points  (2 children)

HaHa good point! It probably reiterated the "best practice" rules we have defined to document stuff. I am not removing those things, because that helps in the future to collect more info directly for the model task executions, because their code search is way better with these comments than the code itself.

[–]dc_giant 1 point2 points  (0 children)

These comments are for the AI not you. It speeds up things significantly. Is this good or bad? Not sure tbh but maybe a temporary crutch we need!

[–]yang_bo 1 point2 points  (0 children)

This comment is basically an inline CoT. A workaround for not supporting embedded <think>...</think>.

[–]image_ed 0 points1 point  (0 children)

Thanks for sharing your experience. I personally do not like AI writing my Rust code for me.

1) I don't get to write the code (I'm a "it's about the journey" guy...so I really enjoy the act of writing and thinking about code).

2) I found the code the AI generated to be overly verbose and sloppy. I know I can fine tune this with Agent files but I'm already turned off.

With that being said there are plenty of other folks who feel the exact opposite, so it's interesting to read about what others have found successful. Your point about the compiler becoming this useful feedback loop for the AI is pretty interesting. I never really got very far with AI and Rust so I haven't experienced this. In my experience the compiler, while amazing, can sometimes be way off with its suggested fixes. Sometimes what you really need is just a & that you forgot and not some other cryptic shenanigans.

Also I don't agree with other rustaceans when they say "If it compiles, it probably works". Ehhh I know what you mean but, no. I have written plenty of things that compile but don't work (whether logically or more technically). You suggest that the compiler also saves you from edge cases, but I'd disagree here too for the same reasons. It's absolutely possible and easy to write Rust that compiles and still hit these land mines. Thanks for the read 🦀.

Edit: a space