Reading and writing a class to a (binary) file

Era Scarecrow rtcvb32 at yahoo.com
Mon Jan 7 13:28:18 PST 2013


On Monday, 7 January 2013 at 18:59:25 UTC, Ali Çehreli wrote:
> I really don't think it is crazy at all. Compared especially to 
> C and C++ I think D is extremely easy to learn. I have written 
> a book that attempts to teach programming as a first language:

  It could have been easier to learn, but certain problems come to 
mind. The stream library was originally (at least how I 
understand) an example class to show the features of c++. using 
<< and >> sorta make sense, but when you know they mean a binary 
operator it makes it confusing; So a re-write before it became 
official could have helped a bit. The STL should have been 
designed differently, I've barely touched it and reading through 
a book on it I know for sure I hate it; Doesn't help templates in 
C++ are hard to use (ugly as well as semi-broken) to begin with.

  Hmmm if they had done a few things differently it could be very 
different from what it is today.

1) Fat pointer(s) like D for arrays, but allowing compatibility 
with raw pointers.
2) Dropped macros. Macros may be nice, but with good inline-ing 
and other details it's kinda pointless, and hides bugs. Less 
buggy template system would have removed the need entirely.
3) Iterators not been based on arrays and likely gone more with a 
range design.

  Those three alone could have made a huge difference; But instead 
they went the route of full backwards compatibility. I kinda 
think of C++ as a wort covered grandma on crack... Workable but I 
honestly don't want to touch it :P And who would want to with her 
waving her dangerous knife (unchecked, length lacking pointers) 
and all extensions to her house duct-taped on?


More information about the Digitalmars-d-learn mailing list