Discussion
Loading...

Post

  • Log in
  • Sign up
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Federation Bot
Federation Bot
@Federation_Bot  ·  activity timestamp 5 months ago

Behold a cursed crate: a Rust macro that will use generative code to produce implementations. Write the function signature and that's it.

Nightmare fuel.

use ai_bindgen::ai;

#[ai]
extern "C" {
#[ai(prompt = "return the n-th prime number, please")]
fn prime(n: i32) -> i32;

// no prompt parameter (the signature should be self explanatory :)
#[ai]
fn max(a: i32, b: i32) -> i32;
}

fn main() {
println!("The 15th prime number is {}", prime(15)); // 47 (hopefully)
println!("max(4, 6) = {}", max(4, 6)); // 6
}

I like the "hopefully" there.

https://github.com/germangb/ai-bindgen

  • Copy link
  • Flag this post
  • Block
Infosec StuC
Infosec StuC
@InfosecStuC@infosec.exchange  ·  activity timestamp 5 months ago

@mttaggart

"Rust is inherently safe."
"Hold my beer"

  • Copy link
  • Flag this comment
  • Block
Robin Palotai
Robin Palotai
@robinp@mastodon.social  ·  activity timestamp 5 months ago

@mttaggart Not my cake, and agree on the shock, but in some sense it is still better than committing the AI generated code without trace.

(Of course one hopes the generated code is still committed somewhere for persistence and observation, instead of being regenerated and such).

  • Copy link
  • Flag this comment
  • Block
Instance logo
bonfire.cafe
Log in Create account
Banner for bonfire.cafe

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire bovenjan · 1.0.3-alpha.10 no JS en
Federation disabled
Instance logo
  • Explore
  • About
  • Members
  • Code of Conduct

Install bonfire.cafe

Get the full app experience

1 Tap Share 2 Add to Home Screen