Starting a for loop in Python is easy. You just type for x in y and you're off. You iterate over a list, or a string, or a range, and Python politely hands you back one item at a time. No index variable and no bounds checks. Compared to i++ from C/C++ or forEach from JavaScript, Python's version just works . For a long time, I treated for x in y as just a syntax that meant "loop over this thing,"…
A few weeks ago, I dusted off my “Build Your First REST API in Rust” workshop and took it to another borough. Hello, LIU Brooklyn! My workshops begin with a show of hands to see who has worked with Rust and REST APIs before. About 20 students attended this time, and the topics were new to nearly all of them! I’m hopeful they left feeling Rust was even a tiny bit more accessible. I’m grateful to my…
Earlier this month, I ran my first in-person workshop, “Build Your First REST API in Rust,” for the Association for Computing Machinery (ACM) at the City College of New York (CCNY). That’s a lot of acronyms, and it went well! It was a great group, very engaged, and I enjoyed chatting with several students afterwards. About 30 people attended, and we built a CRUD API together from scratch using…
At my first real software internship, the highlight of the summer was a 24-hour hackathon. My team and I sat in a conference room for way too many hours, hacking together a prototype. I barely remember the end goal. A chat something? What I recall most was the feeling of trying one JavaScript library after another, failing to get basic tabs to work. I felt helpless! Clearly I needed more JS…
Before we begin, let’s agree that “online” in this context means accepting bytes from localhost . Deal? Deal. You may recall that sometime last century I had the brilliant idea to boot a Flask server from inside Memphis. Trudging toward that goal exposed me to a ton of types and functionality I didn’t yet support. I even ran an interpreter inside an interpreter ! But it was a slog . Literally line…
Nary a week ago, I typed a harmless expression into my Memphis REPL: 4 == 4 == 4 . My REPL’s response? False . I’m glad it can speak its mind, but the gall! Apparently, you can’t just treat a chain of comparison operators like a tree of binary expressions. According to my BlueSky timestamps , it took me 13 minutes to figure this out. And I’m here today so you don’t make the same misunderstanding I…
This isn’t a how-to guide. Just a few things I’ve noticed while mentoring people 1:1 over the last two years. One-on-one mentorship wasn’t even part of my career plan. I viewed myself as a quiet builder and, hopefully, a good teammate. This journey started as most things do in my life: an experiment because I was curious. I had an itch for more 1:1 conversation and a hope that I could help a…
Think globally, act locally. Who knew this oft-touted phrase was referring to Python bytecode? Last time we acted on learning how local variables work , today let’s think about how global variables might work. I came into my own bytecode journey assuming that a “global” was no different than a “local,” it was just at the outermost scope of a module. And boy, was I mistaken. While the VM isn’t even…
Local variables are stored on the stack. This line tormented me for years. I could spout it in an interview, but I didn’t really know what it meant. I could pull up the diagram showing the stack growing upwards and the heap growing downwards. And I definitely didn’t want to think about what happened if they ever crossed. But to truly understand? I had to build it myself. This post explains how…
Crosscheck, my cross-engine testing framework for Memphis , had been sitting atop my writing to-do list for a while. Instead, I deleted it and replaced it. Memphis can now test itself across all engines. What does this mean? I can verify the treewalk interpreter and bytecode VM interpreter produce the same results (return value or symbol table entries) for a given snippet of Python. This…
My parser test suite was a house of cards I’ve never been prouder to see collapse. I found a pattern that worked, kept working, and then worked a little too well. Until rust-analyzer couldn't process my file anymore. Best practice says to refactor before your LSP craps out, but alas. Here's how I saved several thousand lines of test code in my Memphis parser. Designing an expressive parser test…
Happy March! This month I am putting a bow on my Q1 roadmap and continuing to unify the two Memphis execution engines. I chose an update post because I want to “build in public.” What follows is what has been on my mind! I don’t write advice posts (Why you shouldn’t use Vec ) or random technical overviews (Vectors vs. Slices in Rust: A Complete Guide) because I am unable to do either with a…
While I was hoping this website would build itself, it ended up taking a good amount of fine-tuning! I wanted to share how I built this blog and a few of the challenges I encountered. Background My setup for this website is: domain and DNS managed on GoDaddy code lives in a private GitHub repository (should I make this public?) static site written in React using Gatsby site deployed using the free…
Shortly after I shared my previous post , a helpful redditor pointed out that the typed integers I alluded to is known as the newtype pattern in Rust , a design that allows you to define types purely for compile-time safety and with no runtime hit. And here I thought I invented it! Alas. 😂 I wanted to share a few details about what challenge I encountered and how I solved it. The problem Like I…
I wanted to share some pretty cool stuff I’ve been learning about Python bytecode with you, including how I added support for nested functions, but my guy at the printing press said I needed to keep it under 500 words. It’s a holiday week , he shrugged. What do you expect me to do? Excluding code snippets , I bargained. Fine , he ceded. Do you know why we use bytecode in the first place? I just…
Lifetimes are a fascinating feature of Rust and the human experience. This is a technical blog, so let’s focus on the former. I was admittedly a slow adopter for leveraging lifetimes to safely borrow data in Rust. In the treewalk implementation of Memphis , my Python interpreter written in Rust, I hardly leverage lifetimes (by cloning incessantly) and I repeatedly elude the borrow checker (by…
A few months into development, I decided my north star for Memphis would be to run a Flask server entirely within my interpreter. I had no idea how much work this would entail, only that it sounded cool and would probably teach me a lot along the way. If I were making this goal today, I may pick FastAPI or nothing at all because that was silly of me. Python stdlib A big decision I encountered was…
I’m currently exploring two interesting topics for Memphis , my Python interpreter in Rust: building for WebAssembly and embedding CPython. With no major milestones to report this week, I thought I’d share some in-progress thoughts. For me, Memphis is been a project for expanding my conceptual understanding through practical experiments—hopefully, this post can do the same for you as we walk…
THE BIG CITY—From Scratch Enterprises LLC (ticker: FSE) announced its newest venture Monday, From Scratch Code (ticker: FSC). Members of the media gathered around the folding chair of its owlish founder, Jones Beach. Refreshments were not provided. Whispers circulated among the media contingent that this was the same desk which produced the not-a-non-profit, From Scratch Press (ticker: FSP). The…
My Python interpreter, Memphis , has a REPL (read-eval-print loop)! This is old news. As long as you made zero mistakes while interacting with the wise old owl 🦉, you could interpret to your heart’s content. Assuming you never wanted to evaluate the same statement twice, or if you did, didn’t mind retyping it. Also with zero mistakes. I was perfectly content with this REPL. Thrilled even. I had…
Take a quick glance at the code snippet below. Without thinking too hard, is get a function or a method? How about post ? Router::new() .route(“/one”, get(get_handler).post(post_handler)) .route(“/two”, post(post_handler).get(get_handler)) What did you decide: is get a function or a method? It appears to be both! And the same with post ! If you are familiar with API development in Rust, you may…