Slashdot Mirror


User: WalterBright

WalterBright's activity in the archive.

Stories
0
Comments
66
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 66

  1. The D Programming Language on High Integrity Software · · Score: 1

    already has, as part of the language, Design by Contract and unit testing. The D Programming Language. These provide the robustness capabilities, but while having the power of a C++ like language.

  2. Re:full C compatability? on C, Objective-C, C++... D! Future Or failure? · · Score: 1
    You can delete objects explicitly to get prompt deletion.


    Yes, a gc can be forced.

  3. Re:delete object; on C, Objective-C, C++... D! Future Or failure? · · Score: 1
    Do any stray pointers to it just dangle, or does something null them out? Are references through them caught, or a quiet error?

    There's no way to detect dangling pointers if you explicitly delete a gc'd object. So, be sure there aren't any if you're using delete explicitly, just as if you were doing free() in C.


    If the GC finds the pointers later does it throw an error, ignore it, or end up doing something wrong?

    Ignore it.

  4. Re:full C compatability? on C, Objective-C, C++... D! Future Or failure? · · Score: 1
    what you do if you want RAII on objects you return from a function (auto can't be returned, or be an out parm, right?).


    You'll need to use the delete on those.



    What is the D equivalent to a shared_ptr of iostream (or a auto_ptr of the same)?

    Not necessary in D, use the gc to manage routine memory.


    What would a library use to hold objects that might be heavy weight objects (network sockets maybe, or 3D textures stored on a graphics card)? Is there some idiom for it?

    Depends on the situation, but one idiom that works well is to create an RAII object that holds the resource, and create that in the user code, not the library.


    Oh, and is there a weak reference for use in caches or the like? (yeah, ok, so it always looks so good in manuals, and I've never gotten around to using them for caches, but I have used it in a few places for things like "call the timeout function in 20 seconds if this request is still alive")

    There's currently no support for weak references.


  5. Re:Shenanigans on C, Objective-C, C++... D! Future Or failure? · · Score: 1
    There are several ways:
    • Don't pass gc'd pointers to C code, use malloc() for them.
    • Tell the gc about the pointer (it has a function to do this).
    • If the C code is statically linked in, the gc will find the pointer in the stack or in static data.
  6. D is a native compiler on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    not a translator. It doesn't emit C code. It emits compiled object files.

  7. Re:Google incompatible on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    Googling for "D Programming Language" or "Programming Language D" works rather well.

  8. Re:Shenanigans on C, Objective-C, C++... D! Future Or failure? · · Score: 1
    One of the things that makes HotSpot kewl is that it moves around memory as it does collection; as a result long-lived objects get compacted together, taking advantage of cache loads. This can't be easily done in GC if it's not allowed to fool with your pointers safely.

    This is very possible to do with D, and the only reason it isn't doing it right now is I haven't spent the time on the GC to make that happen.

  9. where's my check? on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    Its all a conspiracy by computer manufacturers. If that's true, they haven't let me in on the conspiracy, and none of them have offered me any money to make D slow :-)

  10. Re:Success is Elusive on C, Objective-C, C++... D! Future Or failure? · · Score: 1
    While the odds against D have been daunting, it is well on the exponential growth/adoption curve. The D newsgroup (news.digitalmars.com) has over 25,000 postings in it, and the downloads of the language increase substantially month by month. There's now a gnu version of the compiler, and a growing list of third party libraries and projects for it (see these, for example).

    The real question is, when are you going to write a book on D? :-)

  11. GNU version of D on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    David Friedman has integrated the D frontend with GCC.

  12. Re:Summary on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    It turns out that D's nested functions handle quite nicely the macro use of factoring out performance critical redundant code in a function. They are subject to inlining by the compiler, and so produce every bit as good code as a macro, without all the problems macros have (like no scoping, no declarations, side effects of parameters, etc.).

  13. D does have templates on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    see templates

  14. Re:full C compatability? on C, Objective-C, C++... D! Future Or failure? · · Score: 2, Informative
    D offers several ways to do allocation, gc is only one of them:
    • garbage collection
    • using C's malloc/free
    • stack allocation via alloca()
    • automatic stack allocation and cleanup (RAII technique)
    • static data
    • overloading new/delete on a per-class basis
    • writing one's own functions to allocate/release memory
  15. delete object; on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    D has this. One can specifically delete a GC-allocated object, and the GC will delete it immediately without running a collection pass.

  16. Re:wow on C, Objective-C, C++... D! Future Or failure? · · Score: 1

    I find that googling on "D programming language" or "programming language D" works well.