You can think bigger than that, as an example from the other day, I got it to a Display implementation for all of my error types in rust, it generated nice user friendly error messages based on context and wrote all the boilerplate around displaying them
Also got it to generate a function that generated a unique RGB colour from a user ID, did it first try and I could use it straight away
Both those things would’ve taken me maybe 15 minutes by hand but I can generate and proofread them in seconds
That said, I don’t use copilot I use chatgpt, it’s intentional when I use it not just being shoved in my face all the time which might help my opinion of it
Of course but presumably on occasion you do work in other languages? I work in all kinds of languages and so jumping between them it’s pretty handy to bridge the gap
I think you could definitely still get value out of generating simple stuff though, at least for me it really helps get projects done quickly without burning myself out
For small one off scripts it makes them actually save more time than they take to write (for example colleague had to write the permissions of a bunch of files recursively into an excel doc, chatgpt did 90% of that I did 9 and he did 1 lol)
I use it for writing functions and snippets all the time, at least in python and rust as long as you describe what you want it to do properly it works great
Example I used recently: “Please generate me a rust function that will take a u32 user id and return a unique RGB colour”
Generated the function, I plugged it in and it worked perfectly first time
Wouldn’t help if your chosen instance is down, same problem unless multiple other people are storing your code on their servers
Otherwise it kinda already is federated, you can have multiple remotes configured for a repo and push to both at once I’m pretty sure, then if one goes down you just use the other and sync later
“tells the user the current time” would be an excellent comment for a clock
I’m not the best at commenting my code, but generally I just try to think of what information I’d want to know if looking at this 10 years from now
Imo comments are best used sparingly, don’t bother commenting something that anyone with a basic understanding of programming would understand straight away by reading the code
Functions should generally be commented with what parameters are and what they’re for, plus what they output
use reqwest::Client;
// create a http client class that all other files can import
// so as to only create one instance globally
pub struct HttpClient {
client: Client,
}
impl HttpClient {
pub fn new() -> Self {
HttpClient {
client: Client::new(),
}
}
pub fn client(&self) -> &Client {
&self.client
}
}
Here’s an example where if I were to stumble onto this file 10 years from now, I might think wtf is this looking at it out of context, the comment explains why it exists and what it’s used for
(we’ll ignore the fact I totally didn’t just add this comment because I suck at commenting personal projects)
I think all apps should have those explanation screens of what’s not going to work if you deny X permission and why, especially in the case of an issue like this
It should request location access, and if it’s denied tell the user that it won’t be able to get the location data from images and give them a button to have it ask permission again
I’ve actively been told off at work on multiple occasions for putting too much effort into making my code reusable and extendable later down the line
(As of recently I’ve had to rewrite an entire project from last year because I gave up and just wrote a big blob of difficult to maintain code, then unsurprisingly the requirements changed)
What is the actual evidence trump wants to end democracy? I’ve only seen an out of context clip so far