Aug. 26th, 2005

maradydd: (Default)
[livejournal.com profile] elwe linked this, which rocks so hard I just had to share.
maradydd: (Default)
The PostgreSQL query analyzer -- the piece of the backend which transforms the SQL queries you write into structured information which the planner can optimize and the executor can, uh, execute -- has a number of functions which are all named vaguely like "make_op()". (Think make_op(), make_array_op(), make_scalar_array_op(), &c.) This family is, predictably, used to generate record-specialized arithmetic functions, e.g., "add column A in this row to column B in the same row". There are about six of them, and they all return a pointer to an Expr struct.

I need to create a new make_op() function, so of course I looked at the definition of this struct type. I was vaguely horrified to see
typedef struct Expr
{
     NodeTag type;
} Expr;
WTF, mate? Where's all that column identifier information? For that matter, where's the fucking operator?

So I took a closer look at one of the make_op() functions (make_scalar_array_op(), for those of you playing along at home) and noticed another declaration: ScalarArrayOpExpr *result;. The return statement? return (Expr *) result;.

Can you say "even more horrified"? My God. If they wanted to cast through a void*, they could have just cast through a void* and had done with it. libgdome2 at least has the decency to do that, though they're actually doing it via glib, which buries its void* casting through enough layers of typedef indirection that to the uninitiated (read: people who haven't bothered to dig through all that source) it almost looks like there's some type safety going on.

To the PGDG's credit, the comments say that this is mainly for purposes of documentation (i.e., tracking where nodes are getting generated, or something like that, I guess). But they also refer to Expr as a "superclass". BAD NAUGHTY PGDG. NO BISCUIT.

I can understand the desire to give C some kind of type checking/safety. But this is the third time I've seen it (not counting C++), and the second time I've seen it done badly. (Zend, we will let you live. This time.) "Badly," in this case, means "in a way that suggests some kind of typesafety, but is only providing an illusion."

I fear they are losing the substance for grasping at the shadow.
maradydd: (Default)
It wouldn't be a stretch to say that this journal has gotten awfully technical in the last year or so. This is largely because, well, my interests have become a lot more technical in the last year or so; I've always been girl-who-makes-stuff, and more and more these days, the Stuff that I make is code rather than, say, fiction or clothing. I think about it a lot, and by extension, I write about it a lot.

When I write about technical subjects, I try to be as accessible as I can, because most of y'all aren't technical people. I'm very glad that you're not, just for the record; I value having technical friends, but I also value having a wide range of friends from all walks of life. I don't try to dumb things down, but I do find myself spinning out more long-winded explanations where a word or two of jargon would convey the same information to a smaller set of people. This is actually pretty useful to me, as well, because it forces me to think about what I'm doing in explicit detail -- it's the principle of The Best Way to be Sure You've Learned Something is to Teach It.

I wonder, though, whether it's useful to anyone else. Do people actually read the posts where I'm rabbiting on about the current code project? Do they make sense? Would you rather I wrote about the non-work things going on in my life instead? (Be warned, though, this journal might get kinda quiet if that was all I talked about. Some day I will have a life again, but that won't be for another few months.)
maradydd: (Default)
Want very much to go see The Last Dance tonight. Want $4500 more, though.

</sellout>

Profile

maradydd: (Default)
maradydd

September 2010

S M T W T F S
   1234
567891011
12131415 161718
19202122232425
26 27282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags