I built a type-safe .NET casting library powered by AI. It works disturbingly well.
Posted by Zorokee@reddit | programming | View on Reddit | 90 comments
I built ArtificialCast, a type-safe .NET casting library powered by AI.
It works disturbingly well.
No reflection. No hand-written mappers. Just types, structure, and inference.
You can build full workflows with zero logic—and they pass tests.
It’s clean. It’s typed. It’s dangerously convenient.
And yes, it absolutely should not exist.
More context is in the readme in the github repo
TadpoleNo1549@reddit
this is one of those ideas that feels wrong and right at the same time, type safe + zero logic is insanely powerful, but also kinda scary in terms of hidden complexity, curious how it behaves at scale or with edge cases, that’s usually where things get interesting, feels like something that would need strong guardrails or a runable-style workflow around it to stay predictable
MrTheums@reddit
This is fascinating! The concept of AI-driven type-safe casting raises intriguing questions about the future of software development. The "dangerously convenient" aspect highlights a key tension: while automating complex tasks like type mapping offers significant productivity gains, it also introduces a potential for subtle, hard-to-debug errors stemming from the "black box" nature of the AI's inference.
The lack of a readily inspectable source of truth, as mentioned in the top comments, is a critical consideration. The reliance on type information and prompts for behavior necessitates rigorous testing and validation strategies to mitigate the risk of unexpected behavior. Understanding how the AI handles edge cases and complex type hierarchies is crucial for ensuring reliability. A formal verification process, perhaps incorporating techniques from formal methods, might be beneficial in providing a higher degree of assurance.
Finally, the implications for maintainability deserve attention. While initial development might be expedited, long-term maintenance could be challenging if the AI's internal decision-making process isn't well-documented or easily understandable. A balance needs to be struck between leveraging the power of AI for rapid prototyping and ensuring the long-term viability and maintainability of the resulting codebase.
bianceziwo@reddit
For fun, here's the system prompt:
Robot_Graffiti@reddit
Oh my god, the "prompt engineering" evident in the source code tells a story.
A story about how you were on the verge of tears, breaking down and begging that stupid machine to stop outputting arrays for types that don't have arrays in them.
PM_ME_UR_ROUND_ASS@reddit
lmao those prompts read like a developer slowly loosing their sanity "NEVER OUTPUT ARRAYS" is basically the programmer equivalent of yelling at a brick wall
ammonium_bot@reddit
Hi, did you mean to say "losing"?
Explanation: Loose is an adjective meaning the opposite of tight, while lose is a verb.
Sorry if I made a mistake! Please let me know if I did. Have a great day!
Statistics
^^I'm ^^a ^^bot ^^that ^^corrects ^^grammar/spelling ^^mistakes. ^^PM ^^me ^^if ^^I'm ^^wrong ^^or ^^if ^^you ^^have ^^any ^^suggestions.
^^Github
^^Reply ^^STOP ^^to ^^this ^^comment ^^to ^^stop ^^receiving ^^corrections.
Robot_Graffiti@reddit
In this case it could be both, their sanity is loosed and then lost
ammonium_bot@reddit
This is the superior bot.
Zorokee@reddit (OP)
I have never ever suffered quite that much before qwq
Hottage@reddit
I look forward to more
BIGPISSdriven development.lolimouto_enjoyer@reddit
AI in a nutshell.
ProgramTheWorld@reddit
Thanks, I hate it /s
SmartE03@reddit
Now this is cutting edge innovation
FearlessNotCareless@reddit
the only way to get uncensored information will be to abolish the money capitalist culture. until then nothing is true real or factual its all lies for a payment ... abolish money and get everything for free all your life or be its subject subjected to its manipulation.... no truth or equality until money is banned and illegal its up to us to kill capitalism subjugation.... humanity will never be as free as it can be until then.
SchlaWiener4711@reddit
That pretty much sums up everything.
dario_p1@reddit
Looks like it really loves arrays
Vast-Percentage-771@reddit
This is incredible
TheBrainStone@reddit
What are we gonna bet that this will actually end up in some enterprise level software?
antiduh@reddit
Hi, my startup has a 100M users and we based our entire web stack on BIGPISS by representing user requests as type transforms. We're having trouble scaling, we currently use about one cpu per user and my boss doesn't like the EC2 costs.
Can you make it faster?
TheBrainStone@reddit
Just throw two users into one object and map them at the same time! Halves the CPU usage and is scaleable! Just throw in more to save more on costs.
amakai@reddit
Feature request: Convert a type into NFT on a blockchain.
cdb_11@reddit
https://github.com/zhuowei/nft_ptr
amakai@reddit
I'm convinced, take my ~~money~~ crypto!
Farados55@reddit
We need to present this to the committee, ASAP
mlitchard@reddit
BIGPISS coin dropped
Robot_Graffiti@reddit
This is already the ideal tool for that use case; in its current form it will carry out the request using the strategy "let's not and say we did"
TheAussieWatchGuy@reddit
I love you, welcome to Costco.
Zorokee@reddit (OP)
Didn't expect an Idiocracy reference, but it tracks
Kok_Nikol@reddit
What a silly license...
Unupgradable@reddit
That license file is the best license I've ever read
CornedBee@reddit
Blooming_Baker_49@reddit
Interesting. I'm trying to think of an actual real world case where it could be used. Maybe to make a quick program that could crunch through a bunch of dirty data and you only need a rough back of the envelope for output?
kg7qin@reddit
Feed it data from your company ERP.
Then take the responses and generate pretty colorful reports.
Management will eat it up and before you know it you'll be promoted.
zapporian@reddit
Would strongly recommend feeding it into corporate LLM code / data transformation infrastructure.
(chatgpt 4o unironically thinks this would be a good idea, if asked...)
zapporian@reddit
Chatgpt 4o fully approves!
desmaraisp@reddit
Absolute comedy gold right there. The whole thing is super funny.
As an aside, how did you do the type metadata collection without reflection? Source generated?
Zorokee@reddit (OP)
Glad it's getting laughs, hopefully also some existential dread
I generated the type metadata with NJsonSchema
https://github.com/Zorokee/ArtificialCast/blob/main/src/ArtificialCast/ArtificialCast.cs - Line 74
MCPtz@reddit
🤣
Farados55@reddit
I guess it really liked making everything an array 🧐
zman0900@reddit
Technically everything is just an array of bits
balukin@reddit
Love the warranty disclaimer. The vibe is strong with this one.
revnhoj@reddit
"Transform anything into anything. No mapping logic. Just types and vibes."
so.. javascript?
ocodo@reddit
love that.
aleenaelyn@reddit
This actually kinda does give me an idea. Suppose you are the owner of a web service API that produces data. Apart from your standard interface, you could offer an interface that takes a JSON description and returns an object populated with data. You'd use the LLM to produce the mapping between what you actually have and the custom data format the consumer wants. The mapping would be cached so it's repeatable; the LLM produces the mapping but isn't involved in any further transactions.
Yodo9001@reddit
How specific are the types? As I understand it, types and their values form a spectrum in theory (assuming you can define arbitrary types). If there is only single way of composing the functions that obeys their typings, then this composition must be correct right?
UK-sHaDoW@reddit
Have you got VC funding yet? You should get VC funding.
fukijama@reddit
VC++ funding
epostma@reddit
That would be VC# funding, in this case, I think?
EliSka93@reddit
Have you read the README?
I think OP is too self aware for VC funding.
Mickenfox@reddit
But that would only make VC funding even funnier.
Imagine making a joke library and getting $10M for it.
Graumm@reddit
You had me at first. Dangerously convenient as you say.
Automapper is already unfortunate because of how runtime reflection makes it hard to understand what it’s mapping to what, but at least it has rules. This is even more unknowable!
CoreParad0x@reddit
Schrodinger's type mapping. It it exists both in a state of fucked up and not fucked up until observed.
klaxxxon@reddit
Still fits AutoMapper as well.
Lceus@reddit
I recoiled at the powered by AI part of the title. But now I'm converting to BIGPISS and the privilege of awaiting type casts.
Iggyhopper@reddit
Madness, but expected.
LLM does really well with structured formats. I had it do the work of a couple regexes in only a few minutes vs several replace-with queries.
KaguBorbington@reddit
Have your read the readme?
LiftingRecipient420@reddit
You're likely replying to an llm bot with a prompt meant to promote and positively respond to AI posts.
Iggyhopper@reddit
Beep boop.
KaguBorbington@reddit
Oh I can see it now. God damn in getting sick of LLMs lmao
Iggyhopper@reddit
I didnt RTFM.
Shit.
Ill accept my punishment.
VanillaCandid3466@reddit
Not only should it not exist, I shouldn't like it this much either ...
NotScrollsApparently@reddit
I absolutely love that the request > response example just outright gives the wrong result lol
drfrank@reddit
"Sci-Fi Author: In my book I invented the Torment Nexus as a cautionary tale"
SanityInAnarchy@reddit
I think this sums it all up:
Coffee_Ops@reddit
This is a thing of beauty and I love you for it.
kintar1900@reddit
This is horrifying. Well done! :D
Venthe@reddit
My friend, this is honestly great. Hats off
ElectronWill@reddit
haha, amazing 😆
cherrycode420@reddit
Not 100% sure, but this kind of Licensing on a Public Repository might actually break the GitHub ToS because afaik every Public Repository must be able to be forked.
Not a Lawyer and not caring tho, just wanted to mention it!
Zorokee@reddit (OP)
Falls under a Source Available license, so it should be okay. Not a lawyer tho
beephod_zabblebrox@reddit
every gh repo must be legally forkable afaik. there was a recent controvercy about this
LiftingRecipient420@reddit
Can you link any further info about this?
Zorokee@reddit (OP)
See here
beephod_zabblebrox@reddit
i think it was related to winamp? i might be wrong
Zorokee@reddit (OP)
I added a clause that aligns the license with GitHubs' TOS
h2bx0r@reddit
nice dash bro
dude wrote the post using AI too
Zorokee@reddit (OP)
Layered satire - thought it would be funny
Farados55@reddit
All hail BIGPISS!
darchangel@reddit
What's the licensing? I want to take a BIGPISS
bogz_dev@reddit
kiss my BIGPISS
nekomata_58@reddit
Every day we stray further from god.
Mayion@reddit
Don't use it. Study it. Cite it. Fear it.
based
tsereg@reddit
How do I invest?
tushonkaenthusiast@reddit
My company already hired 3 BIGPISS interns before they got to the license on the README
Zeeterm@reddit
I like the license.
Zorokee@reddit (OP)
Didn't really feel like MIT was the correct license for that... thing
STSchif@reddit
This is incredible, I absolutely love the write up.
chacchaArtorias@reddit
Alright this got me, great job lmao.
Selentest@reddit
Absolute madman
jeenajeena@reddit
Take my star!
The readme is worth reading in its entirety. Kudos.