Posts

Showing posts from October, 2025

Why Indirection Is the Price of Polymorphism, With Assembly You Can Read

Image
  Polymorphism lets you call methods through an interface without knowing the concrete type at compile time. The CPU and the ABI do not understand interfaces, traits, or virtuals. They only understand bytes, fixed register widths, and stack slots. That mismatch is the root cause of why runtime polymorphism uses indirection. In this extended version I will show concrete assembly flavored examples so you can see exactly where size knowledge matters, how vtables and fat pointers are used, and what gets passed in registers or on the stack. I will use x86-64 System V ABI conventions where practical. Exact assembly will vary by compiler and flags, but the patterns are stable. The goal is to make the invisible visible. A tiny ABI checklist before we start The ABI decides how arguments are passed and where return values land. On x86-64 System V: Integer or pointer arguments are passed in RDI, RSI, RDX, RCX, R8, R9, then the stack. Floating arguments use XMM0..XMM7. The caller align...

The Next Level AI Language: Beyond Prompts, Toward Precision and Stability

Image
  Artificial intelligence today feels both miraculous and maddening. It can write essays, generate code, and simulate human conversation with astonishing fluency—but the moment you start relying on it for real work, cracks appear. The same model that solves your problem one day may misinterpret your instructions the next. A subtle change in phrasing can turn a correct response into a hallucination. For all its intelligence, modern AI is unstable, unpredictable, and fundamentally unaccountable. This is not just an inconvenience. It’s a structural flaw that limits AI’s role in critical systems. Banks, medical institutions, aerospace companies, and governments cannot deploy an AI that “usually” gives the right answer. They need determinism, reproducibility, and verifiable logic. The current generation of LLMs—text-predictive, stochastic, and opaque—cannot provide that. The next level of AI will require not just a better model, but a new kind of language designed to control it. The...

Understanding Cell and RefCell in Rust: Interior Mutability for Real Work

Image
  Rust’s ownership and borrowing rules keep your programs safe by pushing many errors to compile time. Sometimes, though, code needs to mutate internal state even when it is behind a shared reference. Think of caches, lazy initialization, graph structures with shared ownership, and objects that must expose a read only API while quietly tracking metrics inside. The standard tool for this is interior mutability. In practice, two core types power this pattern in single threaded code: Cell and RefCell. This post explains what they are, how they differ, when to use each one, and how to apply them in realistic examples. We will go step by step, show common pitfalls, and close with a quick comparison to other options like Mutex, RwLock, and atomic types. What interior mutability means Normally, if you have &T you cannot change T. Only &mut T permits mutation. Interior mutability flips this by allowing controlled mutation through a shared reference, while still preserving high l...

Mastering Prompt Engineering: How to Think Like an AI and Write Prompts That Never Fail

Image
Introduction: Why Prompt Engineering Is a Moving Target   Prompt engineering itself doesn’t evolve rapidly - but the models it depends on change all the time. Every new generation of large language models comes with new reasoning layers, expanded context windows, modified decoding defaults, and new forms of safety alignment. These shifts alter how models interpret, prioritize, and execute instructions. A prompt that produces clean, reliable output one week might start producing verbose or inconsistent results after a silent update. The role of a prompt engineer is therefore not just to write good prompts, but to detect, analyze, and adapt to these changes. Successful practitioners treat prompt design as an ongoing process of experimentation rather than a fixed discipline. Understanding the Core Ideas Behind Prompt Design At its core, prompt engineering is about communication - bridging human intent and machine interpretation. A good prompt does three things clearly: defines who th...

From Zero to Killer Neovim on Fedora 42 (Rust-Edition)

Image
 If you want a vanilla-leaning Neovim that feels stock but has full language features, debugging, tests, Git, fuzzy search, completions, keybinding help, AI, statusline, spell-check, and developer fonts —this is it. We’ll use native LSP , Treesitter , lazy.nvim for plugin management, and a short, readable config. Rust is first-class; Python, TypeScript/CDK, and Bash get the same baseline.   1) System prerequisites (Fedora 42) # Core editor + search tools + build deps sudo dnf install -y neovim git ripgrep fd-find curl wget unzip cmake gcc-c++ make python3 python3-pip nodejs npm # Rust toolchain via rustup (recommended) sudo dnf install -y rustup rustup toolchain install stable rustup default stable rustup component add rustfmt clippy # rust-analyzer (prefer rustup component if available; else use Fedora package) rustup component add rust-analyzer || sudo dnf install -y rust-analyzer # Optional: shells/linters/formatters used later sudo dnf install -y shellcheck shfmt ...