OSNews article about C++09 degenerates into C++ vs. D discussion

Steve Horne stephenwantshornenospam100 at aol.com
Thu Nov 23 13:25:29 PST 2006


On Wed, 22 Nov 2006 09:20:17 +0000 (UTC), Boris Kolar
<boris.kolar at globera.com> wrote:

>== Quote from Steve Horne (stephenwantshornenospam100 at aol.com)'s article
>> Most real world code has a mix of
>> high-level and low-level.
>
>True. It feels so liberating when you at least have an option to
>cast reference to int, mirror internal structure of another class,
>or mess with stack frames. Those are all ugly hacks, but ability to
>use them makes programming much more fun.
>
>The ideal solution would be to have a safe language with optional
>unsafe features, so hacks like that would have to be explicitly marked
>as unsafe. Maybe that's a good idea for D 2.0 :) If D's popularity
>keeps rising, there will be eventually people who will want Java or
>.NET backend. With unsafe features, you can really put a lot of extra
>power in the language (opAssign, opIdentity,...) that may work or may
>not work as intended - but it's programmer's error if it doesn't
>(intimate knowledge of compiler internals is assumed).

Hmmm

C# does that safe vs. unsafe thing, doesn't it. My reaction was
basically that I never used the 'unsafe' stuff at all. I learned it,
but for anything that would need 'unsafe' I avoided .NET altogether.

Why?

Well, what I didn't learn is exactly what impact it has on users. As
soon as I realised there is an impact on users, I felt very nervous.

If code could be marked as unsafe, and then be allowed to use some
subset of unsafe features, I'd say that could be a good thing. But it
should be an issue for developers to deal with, not users.

D is in a good position for this, since basically unsafe blocks should
be highlighted in generated documentation (to ensure they get more
attention in code reviews etc).

Also, possibly there should be a white-list of unsafe blocks to be
allowed during compilation - something that each developer can hack
for his own testing builds, but for the main build comes from some
central source. Unsafe modules that aren't on the list should trigger
either errors or warnings, depending on compiler options.

-- 
Remove 'wants' and 'nospam' from e-mail.



More information about the Digitalmars-d mailing list