[Thread Prev][Thread Next][Index]

Re: [ferret_users] go-script missing last newline



Hi Billy,

| I'm not sure if I agree, although it would not do any harm to
| execute such lines.
| 
| I think of a script exactly like a series of typed commands, and  
| indeed I often make my scripts from the .jnl files from interactive  
| sessions. But a typed command is not executed until a RTN is given,  
| and that is the same rule that is applied to a script. Ferret is not  
| treating scripts any differently than interactive typing [. . .]

I know that argument very well and I agree it has logical
consistency.  But, I also know it's sometimes a bit of nuisance
in practice.  In such a case, I think my argument wins:

  - The proposed logical inconsistency would do no harm (0 point);
  - The nuisance would go away  (+1 point).

The total score is positive.  Therefore I win!

The problem is that in many editors, newlines are invisible,
and this sometimes leads to a subtle bug.  Right before I wrote
the last message, I had been scratching my head as I didn't
understand why my label statement didn't print the string
(I thought the coordinates I specified had been wrong), until
I discovered that the label statement didn't have a trailing
newline.  Then I recall I had a similar problem when csh or
something had a similar problem.  (That was a long time ago.
I don't think the problem exits now.)

Having said that, the current behavior is as inconsistent as
the proposed one.  If the treatment of newlines is really
logical, we would be seeing

  yes? go tmp.jnl
  yes? world
  helloworld
  yes?

See?  Since tmp.jnl consists of "say hello" without a trailing
newline, after the GO statement Ferret should be waiting for
the current statement (the SAY statement) to finish.  Then,
when you type the string "world" and a newline, the current SAY
statement would read "say helloworld" with a trailing newline.

Anyway, I'm not presenting this argument to support the proposed
change.  My point is rather that we should embrace inconsistency
if benefits of doing so outweighs its harm.

Cheers,
Ryo


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement