Programming language designers and users talk a lot about the “height” of language features; some languages are considered to be very “high level” and some are considered to be very “low level”. A “high level” language is generally speaking one which emphasizes the business concerns of the program, and a low-level language is one that emphasizes the mechanisms of the underlying hardware. As two extreme examples, here’s a program fragment in my favourite high-level language, Inform7:
Continue reading
Category Archives: Language design
ATBG: Warnings vs errors
NOTE FROM 2021: This article was originally posted on the Coverity Development Testing blog, as part of the “Ask The Bug Guys” series. Those blogs have been taken down; I’ve copied the original content here.
Living with unchecked exceptions
Hey there fabulous readers: I’d like to get your opinions on unchecked exceptions.
Before you run off down to the comments and start typing a short novel, I want to make sure that we’re all on the same page here. Continue reading
Even more video
Here’s another portion of the video interview that I shot over Christmas at Coverity headquarters in San Francisco.
In this bit I talk about the history of C#, how C#’s safety system is definitely a step in the right direction but not by any means a panacea, the most common defect patterns we find in C# code, the basic workflow for using the Coverity static analyzer, and finally a plug for this very blog. That’s a lot to fit into seven minutes!
What is “duck typing”?
Seriously, what is it? It’s not a rhetorical question. I realized this morning that I am totally confused about this.
First off, let me say what I thought “duck typing” was. I thought it was a form of typing.
So what is “typing”? We’ve discussed this before on this blog. (And you might want to check out this post on late binding and this post on strong typing.) To sum up:
ATBG: method type inference with multiple interfaces
Today on the Coverity Development Testing Blog‘s continuing series Ask The Bug Guys, I take a question from an “Eric L”, who is confused about one of the subtle rules of method type inference despite having written the rule himself. My colleague Jon takes a question from a beginner C programmer about memory allocation.
As always, if you have questions about a bug you’ve found in a C, C++, C# or Java program that you think would make a good episode of ATBG, please send your question along with a small reproducer of the problem to TheBugGuys@Coverity.com. We cannot promise to answer every question or solve every problem, but we’ll take a selection of the best questions that we can answer and address them on the dev testing blog every couple of weeks.
ATBG: interfaces and increments
On today’s episode of the Coverity Development Testing Blog series Ask The Bug Guys we have two posts. I take on the question does explicit interface implementation violate encapsulation? and my colleague Jon follows up on my previous posting about increment operators to discuss the precedence of the increment operator and bonus, the meaning of local static in C/C++.
As always: if you have a question about some aspect of C, C++, C# or Java programming language design, or want to share an interesting bug that bit you in one of those languages, please send it (along with a concise reproducer of the problem) to TheBugGuys@Coverity.com. We cannot promise to answer every question or solve every problem, but we’ll take a selection of the best questions that we can answer and address them here every couple of weeks.
ATBG meets math from scratch
In a nice bit of synchronicity my article this week on Ask The Bug Guys, our continuing series on the Coverity Development Testing Blog, is about the differences between the C, C++ and C# interpretation of the ++ operator[1. And of course everything in there applies equally well to the -- operator.] So read that first, and then it will make perfect sense why the increment operator on my Natural class from last time is simply:
public static Natural operator ++(Natural x)
{
if (ReferenceEquals(x, null))
throw new ArgumentNullException("x");
return Add(x, One);
}
As always, if you have a question about a bug in a C, C++, C# or Java program please email it to TheBugGuys@coverity.com along with a concise reproducer of the problem if possible. We can’t answer every question but we’ll pick a sample of the most interesting ones a post an analysis on the dev testing blog.
Next time on FAIC: multiplication.
Verbatim identifiers
In C# you can preface any identifier or keyword with the @ symbol to make it a verbatim identifier. This allows you to use what would normally be reserved keywords, like for as identifiers, should you need to.
I’m occasionally asked why it is that any identifier can be made into a verbatim identifier. Why not restrict the verbatim identifiers to the reserved and contextual keywords?
Continue reading
ATBG: string extensions and const fields
I love bugs. (No, not like that.) It’s always interesting to see how things go wrong; as a language designer I want to learn how to make languages less bug-prone, and as a creator of static analysis tools, I want to learn how to detect hard-to-find-but-real bugs.
Continue reading