15 karma · joined April 5, 2024
I find that CLI is a great way to model problems. When I find myself doing something that has graduated beyond a comfortable amount of PowerShell, Rust is there for me.
I have a template I've been evolving so it's super easy to get started with something new; I just copy the template and slam Copilot with some rough ideas on what I want and it works out.
https://github.com/teamdman/teamy-rust-cli
Just today used it to replace a GitHub stats readme svg generator thing that someone else made that was no longer working properly.
https://github.com/TeamDman/teamy-github-readme-stats
Decomposes the problem very nicely into incrementally achievable steps
1. `fetch <username>` to get info from github into a cache location 2. `generate <username> <output.svg>` to load stats and write an svg 3. `serve` to run a webserver to accept GET requests containing the username to do the above
Means that my stuff always has `--help` and `--version` behaviours too
New things are happening and it's exciting. "AI bad" statements without examples feel very head-in-sand.
More of a perspective from just trying to index crap on my own machine vs building a SaaS
A good ecosystem has lockfiles by default, python does not.
Is there something specific you are trying to point at?
Even still I couldn't quite get the result I wanted
Image link
https://chatgpt.com/share/67769bef-537c-800f-90ac-35a44747f0...
enum Animal {
case dog(name: String)
case cat(name: String)
case bird
func sound() {
switch self {
case .dog(let name):
print("\(name) says Woof!")
case .cat(let name):
print("\(name) says Meow!")
case .bird:
print("Tweet!")
}
}
}
and another with nesting enum Thing {
case first(x: Int)
case second
}
enum Outer {
case ok(Thing?)
}
let value: Outer = .ok(.some(.first(x: 42)))
switch value {
case .ok(.some(.first(let x))):
print("Matched with x = \(x)")
case .ok(.some(.second)):
print("Matched .second")
case .ok(.none):
print("Matched .none")
}https://capnproto.org/rpc.html led me to http://erights.org/elib/equality/index.html led me to http://erights.org/elib/equality/grant-matcher/index.html led me to (the submitted link) http://erights.org/elib/equality/grant-matcher/history.html
Programming languages are a moderately unambiguous way to describe procedures and transformations, but natural language can be more concise.
I wonder if language will drift and become more personalized with ai enabling easy translation between language islands
lifecycle {
prevent_destroy = true
}
https://developer.hashicorp.com/terraform/tutorials/state/re...> trying to get some old module to work in a new cloud environment where a bunch of assumptions about how things are done no longer apply
Square hole type energy. Just because you can coerce the code to run doesn't mean it's a good idea.
New environment, new assumptions, new code. Copy-paste what's relevant, but in a new project.
> getting totally confused because what they see in the code doesn’t match reality
Terraform compares state to detect drift? When reality doesn't match code, you clobber reality or you update the code.
> It Prevents Drift!
> This is true if and only if, you only ever, ever, ever, create code to change things in your environment.
It at least makes drift obvious, even if it requires attention for it to be addressed.
> code is, in my opinion, really not good at being documentation
Unlike comments, IaC "can't" be inaccurate after applying.
> But in my experience, the effort to keep your code up-to-date is a sink for engineering time.
If the code is out of date, it's because you made a click change and didn't update the code. When this happens, terraform tells you exactly what changed in simple scenarios, and in more complex scenarios you can use import blocks to rein things in.
> Yes it’s a clickbait headline. You clicked on it, didn’t you?
Got me good. The article is a good launchboard for discussion.
Overall, the IaC scene has plenty of room for growth. Terraform import blocks and code generation is helping reduce the problem of "I clicked in the portal now I gotta update the code" because you can sync both ways. Code updates infra, infra can be used to generate code.