I wish language developers would agree on the equals syntax

Today's post is short because I just want to rant about how different programming languages have different syntax for the equals sign. For some reason I've been running into this particular issue a lot the past week, and it's starting to drive me crazy.

Sometimes I envy people who only have to program in one language because they never have to worry about this problem. But those of us who program for the Web use so many different languages and sometimes we use one language to generate another — for example, I'm using PL/SQL to spit out HTML and JavaScript. So we're constantly running into the scourge of the un-equal equals.

What I'm talking about is the syntax for how a language uses the equals sign. For example, in PL/SQL we use := for assignment:

x := 7;

And then we can use the plain old equals sign for doing the logical equals:

if (x = 7) then...

Those of you who do any JavaScript and HTML will immediately see my problem. This is quite different from the equals syntax used in those languages. My poor little brain can't handle the constant context switching. So when I'm embedding HTML or JavaScript code inside my PL/SQL code, I invariably end up with a bunch of extraneous := like so:

v_href := '<a href="javascript:void(0)" mce_href="javascript:void(0)" onclick=''return launch("/portal/pls/portal/CMP.pkg_discoverer.show_viewer_iframe?p_disco_id=' || p_disco_id || '")''>';

Of course the PL/SQL editor doesn't know that's a syntax problem because it's treating the stuff inside the single quotes as a string in the PL/SQL syntax. So I get no help from my IDE — it's only when I compile and try to run my code in a browser that I see the problem.

It would make my life so much easier if all those big-brained people who create these programming languages would think about the poor lowly programmers like me. They should standardize key parts of language syntax, and they need to start with the equals sign. Imagine how much it would increase your productivity if you didn't have to think about which language you're in before typing out the appropriate variation of an equals sign.

Oh, and don't get me started on the quotation marks — you can see from my href sample above that PL/SQL uses the single quotes to delineate strings.┬áThe way you escape a single quote in PL/SQL is with another single quote instead of the forward slash used by JavaScript as the escape symbol.

Sorry about this rant. I'm just feeling grumpy from all the time I've wasted on these silly little syntax issues this week. But I'd love to hear what other cross-language syntax wackiness drives you crazy.

Editor's Picks