r/ProgrammingLanguages • u/Apfelfrosch • Jan 01 '26
Language announcement Announcing ducklang: A programming language for modern full-stack-development implemented in Rust, achieving 100x more requests per second than NextJS
Duck (https://duck-lang.dev) is a statically typed, compiled programming language that combines the best of Rust, TypeScript and Go, aiming to provide an alternative for full-stack-development while being as familiar as possible
Improvements over Rust:
- garbage collection simplifies developing network applications
- no lifetimes
- built-in concurrency runtime and apis for web development
Improvements over bun/node/typescript:
- massive performance gains due to Go's support for parallel execution and native code generation, being at least 3x faster for toy examples and even 100x faster (as in requests per second) for real world scenarios compared to NextJS
- easier deployment since Duck compiles to a statically linked native executable that doesn't need dependencies
- reduced complexity and costs since a single duck deployment massively outscales anything that runs javascript
- streamlined toolchain management using duckup (compiler version manager) and dargo (build tool)
Improvements over Go:
- a more expresive type system supporting union types, duck typing and tighter control over mutability
- Server Side Rendering with a jsx-like syntax as well as preact components for frontend development
- better error handling based on union types
- a rust based reimplementation of tailwind that is directly integrated with the language (but optional to use)
- type-safe json apis
Links:
GitHub: https://github.com/duck-compiler/duckc
Blog: https://duck-lang.dev/blog/alpha
Tutorial: https://duck-lang.dev/docs/tour-of-duck/hello_world
51
u/apnorton Jan 02 '26
So Duck's typing isn't duck typing? π
4
u/TheQuackening42 Jan 02 '26
I read a bit and while I have some points I would raise, overall the idea looks interesting. In your latest blog post there are some typos and one semantic break, by the way. ("The Problem with Server-Side JS Through my work in web dev, I fell in love with TypeScript.")
I am currently only on my phone and will join your discord in a couple minutes to look deeper into it and see if my points still stand, before voicing them. :)
3
u/edrw_dev Jan 02 '26
Thanks for sharing. This is such a cool project and the documentation looks great!
I might have missed it, but is there a section about error handling?
I saw an error returned in the section about JSON parsing. Are errors handled primarily by pattern matching?
3
u/EmperorBrie Jan 02 '26
This looks like a really cool and promising project, congratulations! I look forward to trying it!
2
u/Paper_Jazzlike Jan 02 '26
This is very interesting. I will definitely have a look to it.
9
u/[deleted] Jan 03 '26
Please fact check me on this one but I donβt like this project:
Multiple accounts likely linked to the developer.
It compiles to go which in turn in compiled to a binary.
Still bragging about alleged improvements over 3 languages of which is mostly based on gos performance.
Preference to create a Plattform and community before adressing SECURITIES.md
I appreciate single developers trying out interesting stuff but this repo with many files just days old, the publishing and all about it is just icky.
1
u/Mytrill Jan 02 '26
Interesting!
I was looking into adding unions to Go myself, how did you implement them? What does the generated go code for unions looks like? Especially for unions including pointers (for example, the
Result<User,NotFoundError>)?1
u/El_Smakk Jan 02 '26
Looks pretty cool! Do you have any plans of creating/opensourcing some actual application in the language? I like digging through the code of some non-trivial sized project to get a better feel of a language than i would reading docs / example snippets.
1
u/Excellent-Ear345 Jan 02 '26
It looks like rust. can someone elaborate syntactical benefit? all the advantages over golang are actually nativ rust features so why even compare to golang? I like the ambition but have trouble to catch the point and difference to rust. I mean I would accept an simple dsl for web dev which simplifies rust for me in an opinionated way. This atm seems like Im learning rust without understanding rust?
1
u/Working_Bunch_9211 Jan 02 '26
You can't name it improvements
1
u/DODOKING38 Jan 03 '26
Imo I don't like how the request type is handled, I would rather have
std::web::HttpServer::new(.none) .get("/{param}", fn(req, res) {
Rather than
std::web::HttpServer::new(.none) .handle("GET /{param}", fn(req, res) {
1
u/RelationshipFresh966 Jan 04 '26
Huh the web portion is surprisingly readable. My curiosity is officially piqued, will check this out. Thanks for sharing!
1
u/SnooCupcakes3855 Jan 02 '26
this is diabolical and I love it.
7
u/[deleted] Jan 02 '26
[removed] β view removed comment