MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Another bizarre phenomenon

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51661] Re: [mg51598] Another bizarre phenomenon
  • From: DrBob <drbob at bigfoot.com>
  • Date: Wed, 27 Oct 2004 23:44:20 -0400 (EDT)
  • References: <200410270553.BAA24479@smc.vnet.net> <opsgiru3hniz9bcq@monster.cox-internet.com> <00f701c4bc64$09b89620$0200a8c0@NEWSONY>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

> Thanks for the tip. I've never suspected that comments could be a problem
> until the latest experience, because it would seem that the logic to handle
> them is so simple. But maybe not.........

It's not a matter of logic; the front end is buggy, that's all.

I never hear anything good about (* comments *), so I don't use them.

An advantage of "comments" is that they're stored in the function definition, so that when you use ? or ?? to look up the function, you can see the comments. (* comments *) are not stored.

test:=Module[{c=Pi},(* not stored *)
     "stored";c]
?test

I don't actually do this myself; I document my code in text cells.

Bobby

On Wed, 27 Oct 2004 13:32:11 -0700, Steve Gray <stevebg at adelphia.net> wrote:

> Dr Bob,
>
> Thanks for the tip. I've never suspected that comments could be a problem
> until the latest experience, because it would seem that the logic to handle
> them is so simple. But maybe not.........
>
> Steve
>
> ----- Original Message -----
> From: "DrBob" <drbob at bigfoot.com>
To: mathgroup at smc.vnet.net
> To: "Steve Gray" <stevebg at adelphia.net>; <mathgroup at smc.vnet.net>
> Sent: Wednesday, October 27, 2004 1:14 AM
> Subject: [mg51661] Re: [mg51598] Another bizarre phenomenon
>
>
>> Don't use (* comments *). They're not worth all the problems they
> engender.
>>
>> It's better to modularize the code so that it's self-explanatory and, when
> that's impossible, precede a Module with a text cell that describes the
> processing.
>>
>> If you really want comments inside a Module, Block, or other compound
> statement, put them in quotes and delimit them with semicolons, like this:
>>
>> Block[{a, b},
>>   "I'm gonna add a and b"; a+b
>> ]
>>
>> The "comment" is an expression like any other, but it doesn't do anything.
>>
>> This approach may have speed and memory consequences (possibly), but they
> will be very slight.
>>
>> Bobby
>>
>> On Wed, 27 Oct 2004 01:53:58 -0400 (EDT), Steve Gray
> <stevebg at adelphia.net> wrote:
>>
>> > I replaced a 3-letter symbol with another 3-letter symbol, looking at
>> > eachsearch and replacement. All seemed ok. Then I tried to execute the
>> > file and it went nuts. I somehow found that if I removed JUST ONE SPACE
>> > between the Module list of local symbols in a function definition line,
>> > and a comment on the same line, all was OK again.  Wow. This happened
>> > at least twice, identically. Any comments?
>> >
>> > Steve Gray
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> DrBob at bigfoot.com
>> www.eclecticdreams.net
>>
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: RandomReplacement
  • Next by Date: Prefix Notation
  • Previous by thread: Re: Another bizarre phenomenon
  • Next by thread: Re: Another bizarre phenomenon