January 18, 2004
In article <buebn8$h7d$1@digitaldaemon.com>, qw says...
>
>What if I want to put a class diagrams in a comment... (cool idea for
>an advanced IDE)
>

Cool idea, yes.
But an advance IDE will have a better way
that a static comment ;)

Ant


January 18, 2004
In article <bueds2$kdo$1@digitaldaemon.com>, Ant says...
>
>In article <buebn8$h7d$1@digitaldaemon.com>, qw says...
>>
>>What if I want to put a class diagrams in a comment... (cool idea for
>>an advanced IDE)
>>
>
>Cool idea, yes.
>But an advance IDE will have a better way
>that a static comment ;)

Who needs an IDE? You can always create and edit your D programs with Netscape web page editor. Put in any diagrams and text inbetween your code. Then compile as usual:

dmd mywebpage.html

For more info, see  http://www.digitalmars.com/d/html.html


January 18, 2004
Georg Wrede wrote:

>In article <bueds2$kdo$1@digitaldaemon.com>, Ant says...
>  
>
>>In article <buebn8$h7d$1@digitaldaemon.com>, qw says...
>>    
>>
>>>What if I want to put a class diagrams in a comment... (cool idea for
>>>an advanced IDE)
>>>
>>>      
>>>
>>Cool idea, yes.
>>But an advance IDE will have a better way
>>that a static comment ;)
>>    
>>
>
>Who needs an IDE? You can always create and edit your D
>programs with Netscape web page editor. Put in any diagrams
>and text inbetween your code. Then compile as usual:
>
>dmd mywebpage.html
>
>For more info, see  http://www.digitalmars.com/d/html.html
>
>  
>
The problem here is that you can't currently use HTML d code in a d IDE, meaning that you would need to maitain two copies of the code.

-Anderson

January 18, 2004
>The problem here is that you can't currently use HTML d code in a d IDE, meaning that you would need to maitain two copies of the code.

How about making <code> equivalent with +/ and </code> with /+ in the editor, as a first step. Second step would be to let the user view or not view what's outside the code tags. Third step would be to add an html viewer to the code window as a tab?

(Just some crazy ideas...)


January 18, 2004
Georg Wrede wrote:

>>The problem here is that you can't currently use HTML d code in a d IDE, meaning that you would need to maitain two copies of the code.
>>    
>>
>
>How about making <code> equivalent with +/ and </code> with /+
>in the editor, as a first step. Second step would be to let the
>user view or not view what's outside the code tags. Third step
>would be to add an html viewer to the code window as a tab?
>
>(Just some crazy ideas...)
>
>  
>
And as tags are understood (programmed in), they could replace the shown tags in code ie the obvious ones would be <b><i><u> <img>. But that does seem allot of work considering how many html tags there are.  I wonder if there's a free richtextbox-like-html control out there? Parhaps Mozilla Composer could be used as an active X object or something like that.

January 20, 2004
IMHO, dbc tells you "what," and comments tell you "why."

That is, dbc tells you what you expect at any given point in the program.  It tells you what is a bug and what is normal.  But it doesn't tell you why it is a bug.  Comments explain the algorithm in (hopefully) clearer terms than the code itself does.  Comments also help communicate non-obvious side effects in your program.  For example, you might see something like this:

	assert(enumVar == FOO || enumVar == BAR);
		/* myFunc() (foo/bar/myfunc.d) sets these values and
		 * ensures that no other values are possible */

So the assert() defines the interface, but the comment tells you why the interface makes sense.

Russ Lewis

Matthew wrote:
> I'm in the Kernighan/Pike/Dewhurst/etc camp that say that comments are often
> unnecessary and are, by and large, misused.
> 
> Given that D supports DbC as a language feature, and that most people are
> happy writing auto-documentation in their code, is there much need for
> comments in the code itself?
> 
> I'd be interested in seeing some examples from you both, demonstrating your
> points of view.
> 
> 
> 
> "Robert" <no@spam.ne.jp> wrote in message
> news:buaq0f$s4l$1@digitaldaemon.com...
> 
>>I don't agree.
>>Indeed, English comments may need in Europa.
>>But IMHO you'd better write it also in your own language,
>>especially for long comments.
>>Because at least the persons who use the language can read it
>>and they are easier to read it than English comments.
>>And more, some persons will write wrong English.
>>Wrong comments are very evil...
>>If they are written in two languages,
>>someone can check it.
>>
>>And, should we use english for comments in private programming?
>>Should we use it when nobody else Japanese reads it.
>>I think It's nonsense.
>>
>>
>>
>>"davepermen" <davepermen_member@pathlink.com> wrote in message
>>news:bua0t9$2i5r$1@digitaldaemon.com...
>>
>>>even for comments, i don't agree. we have a product at work on wich our
>>
>>company
>>
>>>system bases on. and its been written in the netherlands. just guess how
>>
>>good we
>>
>>>are at reading netherlandish comments in switzerland?!
>>>
>>>espencially a word read like it would mean dismiss in german actually
>>
>>means
>>
>>>accept. rather irritating:P
>>>
>>>no. you should always code in english. its todays babilon-language. just
>>
>>as
>>
>>>latin was a while ago.
>>>
>>>In article <bu9lcu$1vps$1@digitaldaemon.com>, Walter says...
>>>
>>>>
>>>>"davepermen" <davepermen_member@pathlink.com> wrote in message
>>>>news:btutlc$2cvh$1@digitaldaemon.com...
>>>>
>>>>>and the next.. what if linux would've been coded by the language of
> 
> the
> 
>>>>>developers? there we have finish, there we have french, there we have
>>>>
>>>>japanese,
>>>>
>>>>>there we have swiss-german, there we have klingon, there we have
>>>>
>>>>raetoromantsch,
>>>>
>>>>>there we have polish, etc..
>>>>>
>>>>>how about staying in english?
>>>>
>>>>The need to support international characters in strings is clear, and
> 
> in
> 
>>>>comments as well. For identifiers, it's arguable. But it's easy enough
> 
> to
> 
>>>>make it work in D, and many people want it.

January 20, 2004
In many cases you can include the why in the comment, as in:

    string_tokeniser(char_type const *psz, delimiter_type const &delimiter)
        : m_str(psz)
        , m_delimiter(delimiter)
    {
        stlsoft_message_assert("Delimiter of zero-length",
comparator_type::length(m_delimiter) > 0);
    }


"Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:bujp5j$7ta$1@digitaldaemon.com...
> IMHO, dbc tells you "what," and comments tell you "why."
>
> That is, dbc tells you what you expect at any given point in the program.  It tells you what is a bug and what is normal.  But it doesn't tell you why it is a bug.  Comments explain the algorithm in (hopefully) clearer terms than the code itself does.  Comments also help communicate non-obvious side effects in your program.  For example, you might see something like this:
>
> assert(enumVar == FOO || enumVar == BAR);
> /* myFunc() (foo/bar/myfunc.d) sets these values and
> * ensures that no other values are possible */
>
> So the assert() defines the interface, but the comment tells you why the
> interface makes sense.
>
> Russ Lewis
>
> Matthew wrote:
> > I'm in the Kernighan/Pike/Dewhurst/etc camp that say that comments are
often
> > unnecessary and are, by and large, misused.
> >
> > Given that D supports DbC as a language feature, and that most people
are
> > happy writing auto-documentation in their code, is there much need for comments in the code itself?
> >
> > I'd be interested in seeing some examples from you both, demonstrating
your
> > points of view.
> >
> >
> >
> > "Robert" <no@spam.ne.jp> wrote in message news:buaq0f$s4l$1@digitaldaemon.com...
> >
> >>I don't agree.
> >>Indeed, English comments may need in Europa.
> >>But IMHO you'd better write it also in your own language,
> >>especially for long comments.
> >>Because at least the persons who use the language can read it
> >>and they are easier to read it than English comments.
> >>And more, some persons will write wrong English.
> >>Wrong comments are very evil...
> >>If they are written in two languages,
> >>someone can check it.
> >>
> >>And, should we use english for comments in private programming?
> >>Should we use it when nobody else Japanese reads it.
> >>I think It's nonsense.
> >>
> >>
> >>
> >>"davepermen" <davepermen_member@pathlink.com> wrote in message news:bua0t9$2i5r$1@digitaldaemon.com...
> >>
> >>>even for comments, i don't agree. we have a product at work on wich our
> >>
> >>company
> >>
> >>>system bases on. and its been written in the netherlands. just guess
how
> >>
> >>good we
> >>
> >>>are at reading netherlandish comments in switzerland?!
> >>>
> >>>espencially a word read like it would mean dismiss in german actually
> >>
> >>means
> >>
> >>>accept. rather irritating:P
> >>>
> >>>no. you should always code in english. its todays babilon-language.
just
> >>
> >>as
> >>
> >>>latin was a while ago.
> >>>
> >>>In article <bu9lcu$1vps$1@digitaldaemon.com>, Walter says...
> >>>
> >>>>
> >>>>"davepermen" <davepermen_member@pathlink.com> wrote in message news:btutlc$2cvh$1@digitaldaemon.com...
> >>>>
> >>>>>and the next.. what if linux would've been coded by the language of
> >
> > the
> >
> >>>>>developers? there we have finish, there we have french, there we have
> >>>>
> >>>>japanese,
> >>>>
> >>>>>there we have swiss-german, there we have klingon, there we have
> >>>>
> >>>>raetoromantsch,
> >>>>
> >>>>>there we have polish, etc..
> >>>>>
> >>>>>how about staying in english?
> >>>>
> >>>>The need to support international characters in strings is clear, and
> >
> > in
> >
> >>>>comments as well. For identifiers, it's arguable. But it's easy enough
> >
> > to
> >
> >>>>make it work in D, and many people want it.
>


January 20, 2004
In article <buk3ar$nrn$1@digitaldaemon.com>, Matthew says...
>
>In many cases you can include the why in the comment, as in:
>        stlsoft_message_assert("Delimiter of zero-length",
>comparator_type::length(m_delimiter) > 0);

In most cases you _should_!


January 22, 2004
>> BTW, is it fixed? http://www.digitalmars.com/drn-bin/wwwnews?D/19978
>
>Yes.
>

It seems that is not fixed also in DMD 0.79.

The bug of struct with union is fixed indeed,
but that of union with struct is not.
The above should output five 0s.


1 2 3 4 5
Next ›   Last »