Re: Miscellanous Language Ranting (was Re: For performance, write it in C - Part 2, comparing C, Ruby and Java)
- From: Charles Hoffman <nothinghappens@xxxxxxxxx>
- Date: Mon, 31 Jul 2006 01:44:48 +0900
On Sun, 2006-07-30 at 03:47 +0900, M. Edward (Ed) Borasky wrote:
I don't think I've ever needed lexical closures.
Oh no ohh no... I think Chad hit it pretty well on the head with "well
you don't *need* switch statements." There are plenty of things in
programming languages you don't *need*, but once you've gotten into
them, you find yourself missing them when you have to do without them.
The programming I get paid to do is largely in PHP and ActionScript 2.0
for Flash; once I got the hang of using anonymous functions in
ActionScript, which are (or at least try to be) lexical closures, I
found my life getting a lot easier. For writing very event-driven code,
such as responding to a GUI and responding to callbacks generated by
remoting, anonymous functions, (despite a strong orthodoxy in much of
the Flash community against their use) can be a great way to write
smaller, clearer code.
I submit to you that you use lexical closures all the time and don't
even know it. You mention below that you've written Java, and I presume
you've written other object-oriented stuff. Guess what? Objects are
full of closures. The methods of an object are closures on the object
itself. If they weren't, you wouldn't be able to access instance
variables from them. Unless they started making everything global, and
then you may as well write in Fortran IV.
A working programmer needs to know C, plus whatever languages are used
in his or her shop. Regardless of what the designers and communities for
those other languages intend(ed) them to be, they are in fact occupying
an economic niche. They are special-purpose languages by that definition.
I only kinda-sorta know C; the university I went to didn't use it as one
of its main teaching languages at the time (CS I and II were done in
Java, CS III in Ada 95, and I took a Programming Languages course that
used Scheme quite heavily). I picked up a little of C in an Operating
Systems course, just enough to do some programming assignments involving
POSIX threads in Linux. I've yet to have need of C in my paid work, but
should the occasion arise, I'll learn it then.
Enough languages these days have inherited so many characteristics from
C, and C itself is a nice small-enough language with excellent
literature on it, that I don't think it will be a major problem for any
reasonably experienced programmer to learn it when needed, and for the
same reason, I don't think anyone really *needs* to know C unless
they'll be working on certain kinds of projects such as a Linux kernel
module to drive some special device (the company I work at has a project
going on currently that includes just that, and also involves Java, PHP,
and ActionScript 3.0, and of course the usual amount of SQL).
In this sense, Ruby is on the edge of becoming a special-purpose
language as the engine underneath Rails.
So? C has already become something quite like a special-purpose
language as the engine underneath *nix. And why not? Writing Unix is
what C was pretty much invented for. This doesn't imply that you can't
do plenty of other things with it, nor that no one doesn't do other
things with it, but a large amount of C's usage today falls in a certain
niche. Probably the biggest part of C's importance is the influence it
has had on other languages and on programming in general. I think it
would be just fine if Ruby followed a similar trajectory.
--ch--
.
- Follow-Ups:
- References:
- Re: For performance, write it in C - Part 2, comparing C, Ruby and Java
- From: William James
- Re: For performance, write it in C - Part 2, comparing C, Ruby and Java
- From: M. Edward (Ed) Borasky
- Re: For performance, write it in C - Part 2, comparing C, Ruby and Java
- From: Chad Perrin
- Re: For performance, write it in C - Part 2, comparing C, Ruby and Java
- From: M. Edward (Ed) Borasky
- Re: For performance, write it in C - Part 2, comparing C, Ruby and Java
- From: Chad Perrin
- Miscellanous Language Ranting (was Re: For performance, write it in C - Part 2, comparing C, Ruby and Java)
- From: M. Edward (Ed) Borasky
- Re: For performance, write it in C - Part 2, comparing C, Ruby and Java
- Prev by Date: Re: Proof if a File exsists
- Next by Date: Re: Miscellanous Language Ranting (was Re: For performance, write it in C - Part 2, comparing C, Ruby and Java)
- Previous by thread: Re: Miscellanous Language Ranting (was Re: For performance, write it in C - Part 2, comparing C, Ruby and Java)
- Next by thread: Re: Miscellanous Language Ranting (was Re: For performance, write it in C - Part 2, comparing C, Ruby and Java)
- Index(es):
Relevant Pages
|