A gentle critque..

Ben Cooley Ben_member at pathlink.com
Mon May 15 08:08:42 PDT 2006


In article <e49b0t$11f0$1 at digitaldaemon.com>, Walter Bright says...
>
>Derek Parnell wrote:
>> May I repeat a portion of my post please ...
>> 
>>     "a new utility that can **help** us automate
>>      translation of C/C++ headers into D source code"
>> 
>> I know that 100% automated translation is not practical. However, as
>> DigitalMars already has a C/C++ parser that works, I was thinking that a
>> tool based on that parser to created a best-effort translation and
>> highlighted that which needs human effort might be a useful addition to the
>> D tool set. Whatever you have now as a C/C++ parser has got to be better
>> than writing a new one from scratch. I'm not asking for the source code for
>> that parser, just a tool that would output something that could be tweaked
>> into D code by either (or both) another tool or person.
>
>One of my concerns about me writing such a tool is that people will have 
>too high expectations of it, and when it fails to deliver 100% automated 
>conversion, it'll give the rest of D a bad image.
>
>The first thing someone new to D will do is try to run the converter 
>across all their C header files. The converter will fail miserably. 
>They'll just dismiss D as a buggy piece of ****.

Hi Walter,

Great work on D, by the way!  I guess this post is just frustration that I will
never actually be able to use it except in some smaller projects.

About parsing headers.. I'm sure people would feel the same way about any C or C
plus plus compiler. If it couldn't parse headers, it wouldn't be particularly
useful.  It's a tough row to hoe.. but well there you are when you decide to
write an alternative to C and C plus plus.  The ability to  integrate easily
with all the existing code out there is crtitically important.

Speaking from personal scenario, the requirement that I wrap several hundred
thousands of lines of existing code is a non-starter.  It was difficult enough
the first time I did it.. having to place extern "C" { } around all my C headers
transitioning over to C plus plus in the 80's and 90's and fix various
ideosyncracies between the C and C plus plus parsers.  It's just completely
impossible now.

I would suggest that a standard C and C plus plus compiler and parser be
integrated into D, and that it not "convert" files, but just parse them directly
without modification.  If the equivalent C or C plus plus construct is not
available in D, D should provide a way of accessing that construct as a foreign
object.  

If this were possible, I could simply begin to add D modules to my code base and
start the gradual transition.. as I once did long ago with my C plus plus code.

I would also like to add that the ability to clearly define certain regions of
code as pointer or type safe is very nice in languages like C#.  Programmers
discretion and code policies help in large projects.





More information about the Digitalmars-d mailing list