I’ve been learning about Rust’s async/await, specifically how it handles static vs. dynamic dispatch with Async Functions in Traits (AFIT). The core differences are surprisingly relatable to human and animals interaction. Here is how I’m breaking down the technical nuances: 1. Talking to a Friend (Static Dispatch) The compiler knows exactly who you are talking to at compile time. It can make inline calls and optimize specifically for that type. - The Vibe: Zero overhead, maximum efficiency, and perfectly predictable. 2. Talking to a Stranger (Dynamic Dispatch / vtable) We only know they satisfy the Human trait. We don’t know their exact type until runtime, so we use a vtable (the "tablet" in the meme) to look up where the functions live. - The Vibe: A bit more overhead for the lookup, but provides the flexibility to handle any type that implements the trait. 3. The 5-Minute Talk (Boxing the Future) Before Rust 1.75, making async traits "object-safe" for dynamic dispatch was a headache. Developers often had to "box" the return types, essentially putting the Future in a cage on the heap just to pass it around. The Vibe: It gets the job done, but you pay a "tax" in the form of heap allocation. #RustLang #Coding #Programming #WebDevelopment #SoftwareEngineering #Async
Rust async/await: Static vs Dynamic Dispatch with AFIT
More Relevant Posts
-
Why can’t you index a string in Rust? If you’ve ever written `my_string[0]` and hit a compiler error, you’re not alone. This isn’t a Rust limitation — it’s a deliberate design choice. Rust strings are UTF-8 encoded, which means: • Characters are variable-width • Indexing would be misleading and unsafe • Performance guarantees would break In my latest video, I explain: – Why Rust forbids string indexing – How UTF-8 actually works under the hood – The difference between `String` and `&str` – The correct and idiomatic ways to work with strings This is part of my Rust debugging series focused on real pain points developers face when transitioning to Rust. 👉 Video link in the comments. #Rust #RustLang #RustProgramming #SystemsProgramming #MemorySafety #UTF8 #SoftwareEngineering #Programming
To view or add a comment, sign in
-
If you’ve written Rust for more than 10 minutes, you’ve probably met this one: ❌ error[E0502]: cannot borrow as mutable because it is also borrowed as immutable Confusing? Frustrating? Absolutely 😤 But once it clicks, Rust starts making way more sense. In my latest video, I break down this infamous Rust error from first principles, without compiler jargon overload. 🎯 What this video covers: • What mutable vs immutable borrowing really means • Why Rust refuses to compile code that “looks correct” • Common real-world patterns trigger this error • How to restructure code instead of fighting the borrow checker • Mental models that help you avoid this error permanently This isn’t just about fixing one error — it’s about thinking in Rust. If the borrow checker ever made you stare at the screen questioning your intelligence… trust me, this video is for you 😄 📺 Watch the full video here: 👉 [link in comments] #Rust #RustLang #BorrowChecker #SystemsProgramming #ErrorHandling #Programming #SoftwareEngineering #LearningRust
To view or add a comment, sign in
-
"It allows all programming languages for smart contracts." The biggest barrier to Web3 adoption isn't just scalability—it's the language barrier. Developers shouldn't have to relearn how to code just to deploy a contract. Pi Squared is solving this with a Universal Settlement Layer (USL). The Innovation: • Universal Compatibility: Write smart contracts in Python, C++, Rust, or any language you know. • Internet Speed: Designed for instant payments and high-frequency AI agent transactions. • Proof of Proof: Using Zero-Knowledge technology to verify correctness without requiring a specific VM. If we want to onboard the next million engineers, we need infra that speaks their language, not the other way around. #PiSquared #ZK #Web3Dev #Infra
To view or add a comment, sign in
-
#FunFact my #CCastle compiler can now parse #HelloWorld … as long as type in exactly the right code. When you forget a ‘;’ after a statement— as I did, my test— it will give a pile of errors. So I was debugging the wrong code It’s always good to practice what you preach: use TDD, make many small steps, and learn from your mistakes. (PS debugging hello world is a lot easier then an experimental compiler) Learned something this week too: have to add “error recovery” to my grammar
To view or add a comment, sign in
-
🚀 𝗞𝗼𝘁𝗹𝗶𝗻 𝟮.𝟯 𝗶𝗻𝘁𝗿𝗼𝗱𝘂𝗰𝗲𝘀 𝗮 𝗰𝗹𝗲𝗮𝗻𝗲𝗿, 𝘀𝗮𝗳𝗲𝗿 𝘄𝗮𝘆 𝘁𝗼 𝗱𝗲𝘀𝗶𝗴𝗻 𝗔𝗣𝗜𝘀 𝗧𝗵𝗲 𝗼𝗹𝗱 𝗮𝗽𝗽𝗿𝗼𝗮𝗰𝗵 👇 𝘧𝘶𝘯 𝘵𝘳𝘢𝘤𝘬(𝘮𝘴𝘨: 𝘚𝘵𝘳𝘪𝘯𝘨) { 𝘭𝘰𝘨𝘨𝘦𝘳.𝘭𝘰𝘨(𝘮𝘴𝘨) 𝘢𝘯𝘢𝘭𝘺𝘵𝘪𝘤𝘴.𝘴𝘦𝘯𝘥(𝘮𝘴𝘨) } 𝗪𝗵𝗮𝘁’𝘀 𝘁𝗵𝗲 𝗽𝗿𝗼𝗯𝗹𝗲𝗺? • logger and analytics are hidden dependencies • The function signature doesn’t tell the truth • The compiler has no idea what this function needs • Correct usage depends on developer discipline 𝗞𝗼𝘁𝗹𝗶𝗻 𝟮.𝟯 𝘀𝗼𝗹𝘂𝘁𝗶𝗼𝗻: 𝗖𝗼𝗻𝘁𝗲𝘅𝘁 𝗥𝗲𝗰𝗲𝗶𝘃𝗲𝗿𝘀 👇 𝘤𝘰𝘯𝘵𝘦𝘹𝘵(𝘓𝘰𝘨𝘨𝘦𝘳, 𝘈𝘯𝘢𝘭𝘺𝘵𝘪𝘤𝘴) 𝘧𝘶𝘯 𝘵𝘳𝘢𝘤𝘬(𝘮𝘴𝘨: 𝘚𝘵𝘳𝘪𝘯𝘨) { 𝘭𝘰𝘨(𝘮𝘴𝘨) 𝘴𝘦𝘯𝘥(𝘮𝘴𝘨) } 𝗪𝗵𝗮𝘁 𝗰𝗵𝗮𝗻𝗴𝗲𝗱? • Dependencies are now explicit requirements • The compiler knows what must be available • The function cannot be called without Logger and Analytics • Wrong call sites are blocked at compile time 𝗜𝗺𝗽𝗼𝗿𝘁𝗮𝗻𝘁 𝗰𝗹𝗮𝗿𝗶𝘁𝘆 (𝗻𝗼 𝗵𝘆𝗽𝗲, 𝗷𝘂𝘀𝘁 𝗳𝗮𝗰𝘁𝘀) • Context receivers do not inject dependencies • They do not fix lifecycle or initialization issues • They do enforce correct usage 𝗢𝗻𝗲-𝗹𝗶𝗻𝗲 𝘁𝗮𝗸𝗲𝗮𝘄𝗮𝘆 🎯 Old approach relies on developer discipline. Context receivers let the compiler enforce correctness. 𝗧𝗵𝗮𝘁’𝘀 𝗞𝗼𝘁𝗹𝗶𝗻 𝟮.𝟯 — 𝗳𝗲𝘄𝗲𝗿 𝗮𝘀𝘀𝘂𝗺𝗽𝘁𝗶𝗼𝗻𝘀, 𝗰𝗹𝗲𝗮𝗿𝗲𝗿 𝗔𝗣𝗜𝘀, 𝘀𝗮𝗳𝗲𝗿 𝗰𝗼𝗱𝗲. #Kotlin #Kotlin23 #AndroidDev #CleanCode #SoftwareEngineering #Programming
To view or add a comment, sign in
-
-
New Project: Building a Logic-Driven CLI Game in Go 🛠️ I’ve just published a new repository featuring a Number Guessing Game built entirely in Go. This project was a deep dive into Go’s fundamental concepts, focusing on dynamic randomisation, user input handling, and efficient state tracking. Key Technical Highlights: - Language: Go - Core Logic: Leveraged math/rand for target generation and fmt.Scanln for real-time user interaction in the terminal. - State Management: Used the slices package to track guess history, preventing duplicate entries without penalising the user. - Architecture: Built around a seamless infinite for loop that manages the game state until the win condition is met. One of the most rewarding parts of this project was navigating the transition from Python to Go. Specifically, learning how Go handles utility functions via modules rather than built-in operators (like Python’s in keyword) gave me a much deeper appreciation for Go’s approach to memory and types. Try it out yourself: 1️⃣ git clone the repo 2️⃣ go build -o guessing_game 3️⃣ ./guessing_game Check out the full source code and documentation here: 👉 https://lnkd.in/en3JzUyy #GoLang #OpenSource #SoftwareEngineering #GitHub #BackendDevelopment #Coding
To view or add a comment, sign in
-
-
They say coding is 10% writing syntax and 90% solving puzzles. My first semester of Computer Science proved that to be true. For our final project, my team ('404 Not Found') decided not to just make a game, but to engineer one from scratch using C++ and Raylib. The best part wasn't just the code, but the synergy. I really enjoyed working with Umais Khan Khan and Muneeb Ur Rehman M. We turned late-night debugging sessions into a genuine team effort. While the backend was a group mission, I literally enjoyed the creative side! I designed the UI and created a special "Dessert Theme" (beige shade 🧁) alongside the Classic version so everyone can play the vibe they prefer. It looks nostalgic on the surface, but it’s powered by 850+ lines of raw logic working together—handling memory with manual arrays, collision detection, and seamless state management. Seeing those themes switch seamlessly on top of our code... that felt like magic. Key Technical Features: 🐍 4 Game Modes: Easy, Normal, Hard (obstacles), and a progressive Story Mode 🎨 Custom Themes: Player choice between Classic (Olive) & Dessert (Beige) 🧠 State Management: Seamless flow between Menu ↔ Gameplay ↔ Game Over states. 📐 Grid Logic: Custom coordinate systems for movement. Check out the Source Code & Architecture here: https://lnkd.in/dYrYPAss I’m posting this not because it’s the most complex game ever made, but because it represents my first big step into real software engineering. Tech Stack: C++, Raylib, and a lot of patience. #ComputerScience #FirstSemester #CPP #SoftwareEngineering #GameDev #StudentProject #Growth #Raylib #OpenSource
To view or add a comment, sign in
-
You can drive a car without knowing how an engine works. 🚗 In software, we do this every day. We write code, hit "run," and... magic happens. The compiler takes over, and we move on to the next task. For many, the compiler is a 𝗯𝗹𝗮𝗰𝗸 𝗯𝗼𝘅. 📦 It’s that "low-level" topic we often bypass in favor of learning the next trendy framework. After all, you don't need to understand Lexers or Parsers to ship a feature. 𝗕𝘂𝘁 𝗵𝗲𝗿𝗲 𝗶𝘀 𝘁𝗵𝗲 𝘁𝗵𝗶𝗻𝗴: Understanding the mechanics doesn't just make you "smarter"—it makes you a more 𝗰𝗼𝗻𝗳𝗶𝗱𝗲𝗻𝘁 𝗲𝗻𝗴𝗶𝗻𝗲𝗲𝗿. It turns "magic" into 𝗽𝗿𝗲𝗱𝗶𝗰𝘁𝗮𝗯𝗹𝗲 𝗹𝗼𝗴𝗶𝗰. When you stop treating your tools like mystery boxes, you start mastering your craft. I decided to lift the veil and document the process of building a programming language from scratch. No academic jargon. No gatekeeping. Just the core mechanics: 🔹 𝗧𝗵𝗲 𝗟𝗲𝘅𝗲𝗿: Breaking down your text into "tokens." 🔹 𝗧𝗵𝗲 𝗣𝗮𝗿𝘀𝗲𝗿: Creating a logical structure (AST) the machine can read. 🔹 𝗖𝗼𝗱𝗲 𝗚𝗲𝗻: Translating human thoughts into machine execution. Is it essential for your daily Jira tickets? 𝗣𝗿𝗼𝗯𝗮𝗯𝗹𝘆 𝗻𝗼𝘁. Is it one of the most rewarding deep dives you can take? 𝗔𝗯𝘀𝗼𝗹𝘂𝘁𝗲𝗹𝘆. If you’ve always treated the compiler as a "don't touch" zone, this guide is for you. 👇 𝗗𝗲𝗺𝘆𝘀𝘁𝗶𝗳𝘆 𝘁𝗵𝗲 𝗯𝗹𝗮𝗰𝗸 𝗯𝗼x 𝗵𝗲𝗿𝗲 : https://lnkd.in/ecbdfbin 💬 𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻: What is the one "Computer Science" topic you always skipped but secretly want to understand? Let’s talk below! 👇 #SoftwareEngineering #Programming #Compilers #CS101 #Coding #TechCommunity
To view or add a comment, sign in
-
Most bugs don’t come from logic. They come from bad data modeling. That’s what pushed me deeper into Rust enums 🦀 Instead of throwing strings, flags, or half-baked structs around, Rust forces you to describe reality: Some things are just a value Some have named fields Some wrap extra data All in one enum. Then Rust says: 👉 “Cool. Now handle every possible case.” No defaults. No silent failures. No “this should never happen” comments. Just compile-time honesty. This tiny outfit example reminded me why Rust feels different: the compiler is strict but the code becomes clearer and your intent is obvious to the next human reading it (including future you) Small example. Big mindset shift. If you’ve ever debugged a bug caused by “invalid state”… you already understand why this matters. #RustLang #SoftwareEngineering #LearningInPublic #Developers #Programming #RustDevelopers #RustEngineer
To view or add a comment, sign in
-
-
The one concept that separates "Coders" from "Engineers".. In a world of high-level frameworks and automated memory management, understanding Pointers can feel like a lost art. But if you want to write truly efficient code—or understand what’s actually happening under the hood in languages like C, Go, or Rust—you have to master the "Address." Most people get stuck when they see & and * appearing together. It’s the ultimate test of logic and mental mapping. Challenge for the Dev Community: Take a look at the code snippet in the image. What is the final value that gets printed? Is it the original value, the updated value, or does the syntax itself cause a crash? Drop your answer (A, B, or C) in the comments! No spoilers in the first line of your comment—let’s see who can get it right on the first try! #SoftwareEngineering #CodingChallenge #Programming #WebDevelopment #Pointers #TechCommunity
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development