Steve Yegge's rant on The Next Big Language
Charles D Hixson
charleshixsn at earthlink.net
Tue Feb 13 18:03:13 PST 2007
BCS wrote:
> Reply to Frits,
>
>> BCS wrote:
>>
>>> Reply to Jarrett,
>>>
>>>> Generators, on the other hand, are just plain cool. I think they
>>>> can be done using something like StackThreads.
>>>>
>>> I'm missing somthing here: what is a generator?
>>>
>> A generator is like a function, but after it "returns" it can be
>> "called" again and it will resume where it left off. Local variables
>> are
>> preserved, and execution resumes after the statement that caused the
>> return.
>> They're basically an automated method for creating an iterator object
>> out of an opApply-like function.
>> In Python, you create them by using 'yield' instead of return. Python
>> tutorial section on generators:
>> http://docs.python.org/tut/node11.html#SECTION00111000000000000000000
>>
>
> I should be burned at the stake for this...
>
> | struct
> | {
> | // all needed variables
> | int at=0;
> | | int go() // fn with no local variables
> | {
> | switch(at)
> | {
> | case -1:
> | assert(false);
> | | case 0:
> | | //stuff
> | | at=1; return value; case 1:
> | | // more stuff
> | | at=2; return value; case 2:
> | | // more stuff
> | | }
> | at = -1;
> | return value;
> | }
> | }
>
>
Which kind of proves what I've been seeing as the point, i.e.,
D is a complete language, and it's POSSIBLE to do anything
computable in it. That doesn't mean it's easy, or worth
doing, if you have to do it within the D syntax.
The things that people have been saying are all things that
are POSSIBLE to do in D...but frequently the techniques for
doing them are so cumbersome or error prone that the only
reasonable choice is to avoid them.
If one believes that a particular technique is desirable, then
one wishes to have it reasonably easy to use. Thus, because
MANY people have thought that templates are a good idea (esp.
Walter), lots of work and improvement has been done on them.
Much less work has been done on advanced run-time features,
which aren't typically used in, at a guess, embedded systems.
(Well, those don't even like garbage collectors, so it's
some other purpose that's at the center of focus for D. It
doesn't seem to involve graphics or databases. Those are
"available", but only in rudimentary form, and largely as a
side effect of having C routines be callable.
N.B.: I'm not asserting that everyone is interested in some
one particular thing, but merely that the "center of gravity"
of interest is in an area with certain characteristics.
Presumably as it becomes "well developed" more out-lying areas
will experience more development.
But just contrast D's approach with that of Python. Python
has long boasted "Batteries Included!". I don't know if it's
still on the home web page, but it was for many years. Or
Perl's proclaiming of CPAN. I've never used it, but I'm still
well aware of claims that programs don't need to check that
libraries are available locally. As long as there's a net
connection, they'll be downloaded automatically. (That may be
overselling...but that's the way I've heard it advertised.)
D, OTOH, is more like Ruby. Libraries aren't available by
default, and lots of the ones that are in the repositories
aren't maintained any more and have suffered from bit-rot. As
a result Ruby has Rails programmers, and Python has Python
programmers, and Perl has Perl programmers. (OK. That
statement's a bit too strong. But that's the tendency.)
D is starting from the language model of C and C++. In many
ways this is good, but I'm not sure to what extent...
N.B.: In the commentary about languages I left out Java,
because that was driven by large corporations. Still, it's
worth noting that much of Java's success was due to the large
libraries it has of routines that can be counted upon to work.
Phobos is more analogous to the libraries that came with the
Fortran compilers around 1970. (Well, less extensive, but
more tuned to the basic tasks.)
P.S.: Partially this note is due to my current frustration
due to the release of Tango, which won't work with Phobos, and
therefore means that I can't depend on any particular library
being installed with a D compiler...with the libraries being
so different that the same code can't be used with both.
More information about the Digitalmars-d-announce
mailing list