What Can You Do for Your Compiler? 0 ▲ Will Richardson 2 hours ago · 6 min read1208 words · Tech · hide · 0 comments And so, my fellow programmers: ask not what your compiler can do for you—ask what you can do for your compiler. — John F. Kennedy A friend and I were talking about the (somewhat) new consuming and borrowing keywords in Swift, which led to the question “what’s the point, can’t the compiler just work it out for me?” which I think is worth some interrogation. When I used to teach programming at university, one of the common pieces of confusion stemmed from strong typing. For someone who is new to programming, "5" (string) and 5 (integer) are not meaningfully different. Why can’t I do "5" + 5 and have the computer work it out? In some languages, the computer does work it out. We call that weak typing. If you ask to add two things together, the computer will first try and turn both into numbers, and use the result for the addition. You’ll probably be most familiar with this from JavaScript—more so with subtraction than addition—where 4 - "5" evaluates to -1, exactly how a beginner would… No comments yet. Log in to reply on the Fediverse. Comments will appear here.