Student Z raises his hand in class. He says “Ok, so I guess I see a reason to do something with code other than run it. But I still think there's too much academic wankery in this field. Look at all these discussions of meaning and semantics. Who cares? Your average hacker doesn't bother with semantics, he just wants to get the job done.”
Well, obviously I'm setting up Student Z as a straw man, but how important are the semantics of a language? Are they simply a curiosity for ‘language lawyers’ and mathematicians to worry about, or are they a tool that is used daily by programmers?
6 comments:
I think it depends on the level of formalism of semantics you are talking about.
Granted, R5RS has a formal definition of it's semantics, and I own a copy of Denotational Semantics, but do I refer to them on a daily basis? Well, no, and not just because I'm not currently working in Scheme.
But in the less formal sense of semantics referring to what the language constructs and library routines mean -- what they do, what they require, and what they guarantee -- then yes, semantics are used on a daily basis by programmers. It's use is internalized from constant practice, so you don't go "what does (if ...) mean?" all the time, but you do think about (switching languages here) "Is 'if (foo != null && foo.bar == baz) {...}' safe, or will it blow up when foo is null?".
Another way to phrase the question for the student is:
"As a professional programmer, how pleasurable would be to go from language to language only having learned syntax, and never semantics, to any depth?"
The answer is simple:
"It would not be pleasurable. It would be painful."
Now the door is open.
The semantics of a programming language are somewhat important, and somewhere between a curiosity for language lawyers and a tool that is used daily by programmers.
I've been a professional programmer for 15 years and I have no formal qualifications in computer science.
I can recall exactly one instance where anything close to the "mathematics" of programming languages was directly useful to me. On the other hand, I learned from that experience that knowing about that stuff was sometimes useful and so learned some more.
That background knowledge has been helpful. It gives me a framework into which to fit new knowledge about programming.
I agreer with student Z that there is too much academic wankery, and that the average hacker just wants to get the job done. Average hackers can probably get away with that. Superior hackers will eventually find their way to commercially meaningful problems which (like the one I came across) they can't solve without some deeper thinking.
There again, it depends on the language. When I made my living as a C++ programmer I was a language lawyer and that was a daily survival skill.
As others said I think it has no *direct* relevance but it makes a huge difference to program in a language with well-thought semantics (like Scheme) compared to language with no clear semantics at all (you know which language I mean here).
@ECL to play Devil's Advocate: yes, there is a huge a difference between programming in a language with well-thought-out semantics vs the alternative...in all the cases I can think of right now there are many orders of magnitude more jobs available in the less well thought out languages than the better though out ones.
Why should that be?
I was talking to Simon Peyton-Jones after one of his presentations last year and I asked about the "software engineering" characteristics of Haskell. We hear a lot about the "computer science" properties of Haskell, but no so much about those properties which are more directly applicable to the grubby world of making a living in industry. One of those is the (potential) availability of programmers.
I don't expect that there ever will be a large number of Haskell programmers, as I believe that Haskell is just too hard. SPJ thinks that this is a red herring and that Haskell is merely too different. He contends that if one is introduced to early enough it comes very naturally. I suppose that there will be some truth in this, but I also suppose that only the mathematically minded minority of programmers will ever by comfortable with it.
On the gripping hand, I also believe that there are too many programmers writing too much code. We could get along just fine with fewer programmers working more efficiently and language choice has a part to play in that. But I don't see how to get there from here.
I am but a student in computer sciences, and a weak one at that, so I have absolutely no idea how things actually are in the real world out there. But when I see a question like "Are they simply a curiosity for ‘language lawyers’ and mathematicians to worry about, or are they a tool that is used daily by programmers?", what I think is : is there no third option ? I mean, something like "In the world as it stands today, they are more like an academic curiosity, but it might well be that the world would be better off if they were tools used by programmers in their day-to-day work".
I mean, when Dijkstra wrote GOTO statements considered harmful, a lot of programmers did use GOTO statements in their daily lives, and it doesn't look like most of them agreed with Dijkstra at the time (keep in mind, though, that I wasn't born yet, so this is more a speculation than a testimony). I really don't feel comfortable with arguments like "No one uses this, so this must be useless"...
Post a Comment