DeRailed DSL (was Re: compile-time regex redux)
Bill Baxter
dnewsgroup at billbaxter.com
Sun Feb 11 23:36:46 PST 2007
kris wrote:
> Walter Bright wrote:
>> kris wrote:
>>
>>> Walter Bright wrote:
>>>
>>>> The flashy stuff, though, is the stuff that piques peoples'
>>>> interests enough to give D a try.
>>>
>>>
>>> Bling is very much in the eye of the beholder, and often has the
>>> inverse effect?
>>
>>
>> If it is perceived as being *just* bling, it will have the reverse
>> effect. If you can show, however, that it solves otherwise intractable
>> or time-wasting problems, you get interest.
>
> Absolutely.
>
> If you can successfully do that for, say, dev managers, then so much the
> better. On the other hand, giving such ppl a reason to fear adoption
> would be a terrible mistake. As you probably know, commercial shops tend
> to be more than a bit conservative when it comes to code.
>
> Even companies perceived as progressive care deeply about ensuring the
> code is 'pedestrian' in nature. Google, for example, outlawed C++
> templates. They did this because their experience showed such code was
> unmaintainable, more often than not. In the hands of the masses, such
> tools are often used for creating a language within a language, and
> everyone's version has a personal stamp: MyDSL
Well, I'd like some real references before I'll believe Google has
"outlawed" templates. I found two links saying they aren't wild about 'em:
This one basically says they don't have a lot of them mostly because
they like to wrap their C++ with SWIG, and SWIG can't handle 'em well.
http://www.sauria.com/~twl/conferences/pycon2005/20050325/Python%20at%20Google.notes
This one says templates are hard to use and make for bad propeller-head
APIs:
http://www.manageability.org/blog/stuff/google-coding-cultures
But neither of those says it's "outlawed".
On the other hand Adobe is doing more and more with templates these
days. http://opensource.adobe.com/index.html
> And the overwhelming cost in
> software development today, for the type of companies noted above, is
> maintenance. For them, software dev is already complex enough. In all
> the places I've worked or consulted, in mutiple countries, and since the
> time before Zortech C, pedestrian-code := maintainable-code := less
> overall cost.
Good points. I've pretty much given up trying to do anything
interesting with C++ templates for much the same reason. With the
exception of Boost smart pointers, pretty much every mega-template
library I've tried to use has made me regret in the end, as I waste
hours staring at meaningless page long compiler error messages. Looking
at the source code is absolutely no help. And the template things I've
worked on myself have always turned into brick-wall affairs where there
just isn't a good way to get from point A to point B without a lot of
shenanigans.
But I don't think that's a condemnation of metaprogramming. That's a
condemnation of metaprogramming /in C++/, which was never designed for
such a thing. I'm hopeful that a design created with the task of
metaprogramming in mind will actually lead to code that's easier to read
and maintain than pages of repetitive boiler-plate.
I'm hopeful anyway. But to me it seems like what D's souped-up
templates have proved so far is that while features like static-if take
you a long way -- maybe so far as "making the simple stuff simple" --
anything beyond that still turns into spaghetti.
It's a step in the right direction, though. In C++ even the simple
stuff gives you spaghetti.
--bb
More information about the Digitalmars-d
mailing list