March 25, 2004
C <dont@respond.com> wrote:

> Pet rock, flock of seagulls, the brat pack .... spandex....whats not to love! :)

ARGH!!!! :-) And you forgot Thomas Dolby, Ultravox, and Duran Duran!

Actually, the 80s were my hey-day, many fond memories of... "stuff" I did back then <G>

> hehe no debugger though.  You can use windbg if ur familiar with asm , also the IDDE on the CD has some debugging capabilities.  To get source interaction i think the linker needs to create .pdb files ( dont quote me though ).

No problem. I'm just beginning to look into D, and am looking for what might be a workable set of development tools. So far, Emacs looks ok, although the emacs mode I got looks like it's basically just syntax coloring -- better than nothing, but I want more intelligent tools, epsecially class browsing similar to Class View in Visual Studio.

DIDE looks interesting but I haven't spent enough time with it.

-- 
dave
March 25, 2004
C wrote:
> I usually get this error when forgetting to 'new' something.  But i feel your pain, this single oversight could cause hours of searching , almost nullifying the reduced development time of using D :/.  I think someone mentioned something about the error messages getting beefed next release <crosses fingers> .
> 
> OT, id like to learn about the math they use for astrononmy ( this.getHE=mass*sunHU*(1/(pow(pow(1.9,(uint)orbit),2))); ) , is there a good book you can recommend for a complete newb ?  Is it possible I can take a look at your code ?
> 

I just played with numbers until it looked mostly-right. That isn't an actual formula they use for astronomy. (It's supposed to be "heat units" that the planet gets from the sun, so I used an inverse square law, but I probably should multiply by 1/2 surface area or something instead of mass...)

The only actual normally-used formulas I used were for sphere volume and surface area, and even then I was just forcing volume to equal mass. (real radius=pow((volume*3)/(4*PI),1/3); this.surfaceArea=4*PI*radius*radius;)(This doesn't need to be perfect, I'm just playing around)

Mass distribution isn't accurate either, mmm... The sun is supposed to be 99 or 98% of the mass in the solar system, or something, I think. I've got it at 50% ATM.

Oh, and I'm
March 25, 2004
Dave Sieber wrote:

> J C Calvarese <jcc7@cox.net> wrote:
> 
> 
>>Like Larry suggested, sprinkling printf's all you code is probably the
>>best way to track down the problem:
>>
>>    printf("Reached line 10\n");
>>    ...
>>    printf("Reached line 30\n");
>>    ...
>>    printf("Reached line 50\n");
>>
>>You could also use assert to make sure what you think is true, is
>>true. 
> 
> 
> PMJI, but as I am just taking a first look at D, does this mean that there is no debugger at this time? I did the above back in the 80s when I first learned C. I'm not sure I want to go back to that decade again :-)
> 

Yeah, I just finished modifying a debug.py script that I wrote a while back for a C program... It makes a copy of all the source files and then inserts printf statements containing the filename and line number on (almost) every valid line (in the copies, which are in a subfolder of the project folder). Then I compile the copies (it also copies the compile.bat and debug.bat for me), and run them and watch it to see where it dies. It's slightly simpler with D though, because I don't have to use cumbersome workarounds to make the printfs actually get shown if the app dies.

I had to make it understand classes and extern (didn't have extern in the C program it was written for), but it works now. And so I've tracked down the error...

---------
spacesim.d:179
spacesim.d:180
spacesim.d:228
spacesim.d:229
Error: Access Violation
----------

Lines 228-230:
----
foreach (int i, Planet planet; planets) {
	planet.cycle();
}
----

Apparently I made a mistake in the constructor so it didn't initialize all of the Planet references in Planet[] planets.

P.S. It'd definitely be nice to have a compiler flag which inserts printfs like these throughout the code, in order to have a constant execution trace running while the program runs, for finding this sort of thing, and any other conditions which don't normally produce enough information to easily track down (Perhaps stack overflows, running out of memory, etc? I haven't wound up with any of those yet in D, though, so I don't know how well they may be handled).

Oh yeah, I discovered a curiousity while doing this.
----
printf("spacesim.d:%i
",204);		real massleft=mass-mass/2;
----

This *works*, and does so exactly the same as:
----
printf("spacesim.d:%i\n",204);		real massleft=mass-mass/2;
----

Apparently, in the first example, the line break in the middle of the string is included as part of the string!

Fascinating. :P

-SL
March 25, 2004
SL wrote:
> Apparently, in the first example, the line break in the middle of the string is included as part of the string!

That's part of the spec.  D string literals span lines.

 -- andy
March 25, 2004
Andy Friesen wrote:

> SL wrote:
> 
>> Apparently, in the first example, the line break in the middle of the string is included as part of the string!
> 
> 
> That's part of the spec.  D string literals span lines.
> 
>  -- andy

Nice. I hadn't noticed that in the spec.
March 25, 2004
> DIDE looks interesting but I haven't spent enough time with it.

Yes DIDE is awesome ;).

Emacs also has a rudimentary code browser by using c-tags.  M-x speedbar brings up a nifty interface.

C

On Thu, 25 Mar 2004 07:06:52 +0000 (UTC), Dave Sieber <dsieber@spamnot.sbcglobal.net> wrote:

> C <dont@respond.com> wrote:
>
>> Pet rock, flock of seagulls, the brat pack .... spandex....whats not
>> to love! :)
>
> ARGH!!!! :-) And you forgot Thomas Dolby, Ultravox, and Duran Duran!
>
> Actually, the 80s were my hey-day, many fond memories of... "stuff" I did
> back then <G>
>
>> hehe no debugger though.  You can use windbg if ur familiar with asm ,
>> also the IDDE on the CD has some debugging capabilities.  To get
>> source interaction i think the linker needs to create .pdb files (
>> dont quote me though ).
>
> No problem. I'm just beginning to look into D, and am looking for what
> might be a workable set of development tools. So far, Emacs looks ok,
> although the emacs mode I got looks like it's basically just syntax
> coloring -- better than nothing, but I want more intelligent tools,
> epsecially class browsing similar to Class View in Visual Studio.
>
> DIDE looks interesting but I haven't spent enough time with it.
>



-- 
D Newsgroup.
March 26, 2004
C <dont@respond.com> wrote:

> Yes DIDE is awesome ;).

It looks promising, for sure. The interface needs some work, but I couldn't use it for serious programming as long they are using arrow-key mode for editing. I will keep my eye on it.

> Emacs also has a rudimentary code browser by using c-tags.  M-x speedbar brings up a nifty interface.

It seems that speedbar doesn't yet know how to read a D source file?

Speedbar has improved a lot, but I find it inadequate for real C++ work. In fact, I've pretty much given up on Emacs as a programming editor, but for old-school C-style work it's quite handy. I'm using it now for my D explorations, just little programs I am trying out, not even up to make files yet :-)

-- 
dave
March 26, 2004
> The interface needs some work
What parts do you think ? Ill pass it along ;).

> arrow-key mode for
> editing.

Arrow-key mode ?

> It seems that speedbar doesn't yet know how to read a D source file?

Yea i noticed that after I posted.  I thought they were updating c-tags for D support but it doesnt look like its done yet.


> but I find it inadequate for real C++ work.

Sacriledge!!  What do you consider a 'good' IDE, and what features make it so good ?  I use emacs all the time, you get so comfotable with it after a while its hard to be anywhere near as productive with another.

C

On Fri, 26 Mar 2004 02:54:13 +0000 (UTC), Dave Sieber <dsieber@spamnot.sbcglobal.net> wrote:

> C <dont@respond.com> wrote:
>
>> Yes DIDE is awesome ;).
>
> It looks promising, for sure. The interface needs some work, but I couldn't
> use it for serious programming as long they are using arrow-key mode for
> editing. I will keep my eye on it.
>
>> Emacs also has a rudimentary code browser by using c-tags.  M-x speedbar
>> brings up a nifty interface.
>
> It seems that speedbar doesn't yet know how to read a D source file?
>
> Speedbar has improved a lot, but I find it inadequate for real C++ work. In
> fact, I've pretty much given up on Emacs as a programming editor, but for
> old-school C-style work it's quite handy. I'm using it now for my D
> explorations, just little programs I am trying out, not even up to make
> files yet :-)
>



-- 
D Newsgroup.
March 26, 2004
Hey andy I couldnt get to http://ikagames.com/andy/d/streams.d , has it been moved ?

C

On Thu, 25 Mar 2004 06:56:06 -0800, Andy Friesen <andy@ikagames.com> wrote:

> SL wrote:
>> Apparently, in the first example, the line break in the middle of the string is included as part of the string!
>
> That's part of the spec.  D string literals span lines.
>
>   -- andy



-- 
D Newsgroup.
March 26, 2004
C wrote:
> I usually get this error when forgetting to 'new' something.  But i feel your pain, this single oversight could cause hours of searching , almost nullifying the reduced development time of using D :/.  I think someone mentioned something about the error messages getting beefed next release <crosses fingers> .

Also look for lines like:
	assert(obj != null);
or
	assert(obj == null);

This has bitten me a couple of times.  Unfortunately, what happens here is that == and != are the compare-by-value operators.  Thus, what you are really saying is:

	assert(obj.member1 == (cast(WHATEVER)null).member1 &&
	       obj.member2 == (cast(WHATEVER)null).member2 &&
	       obj.member3 == (cast(WHATEVER)null).member3 ... );

Of course, this will segfault (a.k.a. "Access Violation") when it tries to read the first member of the "null" object.  So what you really need instead is:
	assert(obj !== null);
or
	assert(obj === null);
which are the compare-by-pointer operators.