标签:#c
找到 30449 篇相关文章
Method Values vs Method Expressions in Go: A Distinction Worth Knowing
Book: The Complete Guide to Go Programming Also by me: Hexagonal Architecture in Go — the companion book in the Thinking in Go series My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub You are wiring an HTTP router. You have a Server struct with a handler method, and you want to register it. So you write mux.HandleFunc("/users", srv.ListUsers) and it works. You never stop to ask what srv.ListUsers actually is as an expression. It is a method value. Go took the method, bound it to srv , and handed you back a plain func(http.ResponseWriter, *http.Request) . That binding is the thing doing the quiet work in half the handler wiring you write. There is a second form the Go spec gives you, and most Go developers never type it on purpose: the method expression, Server.ListUsers , which produces a function that takes the receiver as its first argument. Same method, different shape, different use. These two live in the Go spec and they are worth telling apart, because the compiler will happily let you reach for the wrong one. The two forms, side by side Start with a small type and one method. type Greeter struct { prefix string } func ( g Greeter ) Say ( name string ) string { return g . prefix + " " + name } A method value binds the receiver now: g := Greeter { prefix : "hello" } say := g . Say // method value, receiver g is captured fmt . Println ( say ( "ana" )) // "hello ana" say has type func(string) string . The receiver is gone from the signature because Go already stored g inside the closure. Call it later, from anywhere, and it still remembers g . A method expression leaves the receiver open: say := Greeter . Say // method expression, no receiver yet fmt . Println ( say ( g , "ana" )) // "hello ana" say here has type func(Greeter, string) string . The receiver became the first parameter. You supply it at the call site, every time. Same method name. g.Say reads the value g ; Greeter.Sa
Memorizing session transcripts isn't useful
How to Survive 3 Years in North Korea as a Foreigner
Costco Is the Anti-Amazon
Factories Are Just Rooms
America, 1926: What a Forgotten 100-Year-Old Report Says About Who We Are
Best Simple System for Now
Jamesob's guide to running SOTA LLMs locally
While you’re watching the World Cup, the feds may be watching you
It's a big year for America. It's the semiquincentennial, otherwise known as America250, and the United States is cohosting the World Cup. But spectators at these events - and the millions of people who live in the cities hosting them - may not realize that they, too, are being watched. From Kansas City to New […]
Battery startups see 'crazy' demand to smooth power surges in data centers
AI coding is addictive. Engineers are paying the price
Orus
Claude for investing in perpetuals Discussion | Link
How Fighter Jets Lock on (and How the Targets Know) (2014)
This slim camera has a transparent LCD screen for a viewfinder
Despite the fact that smartphones have become impressively capable shooters, standalone point-and-shoot cameras are enjoying a renaissance. The tiny Kodak Charmera is still wildly popular, while influencers are scrambling to find aging Canon cameras on eBay. Godox, a company best known for its photography lighting products, is the latest to join the simple camera craze, […]
Give Smart People the Tools to Do Smart Things
I finally got my Trump phone
Where's the Trump phone? We're going to keep talking about it every week. One year on, our phones have finally arrived. 12 months, 16 days, 21 hours, and 54 minutes after I first heard about Trump Mobile's T1 Phone 8002 (gold version), I'm finally holding one in my own hands. That's right, The Verge's Trump […]
Using OpenTofu's Exclude Flag to Isolate Performance Bottlenecks
How many failed startups have you launched?
I think I just launched my 14th. No, buying a domain and doing nothing with it doesn't count. To count as a startup you: - You launched a website or - You turned on Stripe payments or - You formed a LLC or Corp - You started paid advertising - You got 1+ paying customer - You raised $1+ dollar from outside funders
Cloudflare Details Unified Data Platform Where Billing Workloads Account for 53% of Queries
Cloudflare details Town Lake, an internal unified data platform, and Skipper, an AI analytics agent unifying access to operational, billing, security, and business data. The platform processed ~91K billing queries, with billing forming majority usage. Built on a lakehouse architecture using Trino, Iceberg, R2, and DataHub, it enables governed cross-system analytics and natural language access. By Leela Kumili