|
From: Dave H. <da...@ho...> - 2014-11-12 21:00:39
|
With the exception of Gnuplot, every parser I've seen strips out comments
first, then glues lines together. Shell, pfctl, you name it; it makes it
easy to temporarily comment out a line without having to worry about the
following line.
Except for Gnuplot; it does it backwards (IMHO). For example, when
playing with some line styles etc, I want to keep the original line "as
is", but merely commented out. Instead, I have to remove it bodily, and
make sure that there is a dummy line after it like so:
#
# Too small to be worth plotting.
# datafile using 1:($5) title 'Proxy', \
# datafile using 1:($6) title 'Pause', \
# Need a line after a commented continuation line.
#
plot blah blah with above lines removed
Most un-intuitive... Any chance that this can be fixed in 4.7, or at
least made an option for traditional users?
--
Dave Horsfall DTM (VK2KFU) "Bliss is a MacBook with a FreeBSD server."
http://www.horsfall.org/spam.html (and check the home page whilst you're there)
|
|
From: Hans-Bernhard B. <HBB...@t-...> - 2014-11-12 23:09:47
|
Am 12.11.2014 um 22:00 schrieb Dave Horsfall: > With the exception of Gnuplot, every parser I've seen strips out comments > first, then glues lines together. Then, with all due respect, you may not have seen enough parsers yet. C and all languages derived from it do it like gnuplot (even for // comments). Make does it like gnuplot. > Most un-intuitive... Any chance that this can be fixed in 4.7, There's not going to be a 4.7. |
|
From: Elias A. <eli...@gm...> - 2014-11-13 12:17:52
|
Hi,
I would like to support the OP's proposal. I have also run into this
issue and found it annoying.
On 11/13/2014 12:09 AM, Hans-Bernhard Bröker wrote:
> Am 12.11.2014 um 22:00 schrieb Dave Horsfall:
>> With the exception of Gnuplot, every parser I've seen strips out comments
>> first, then glues lines together.
>
> Then, with all due respect, you may not have seen enough parsers yet. C
> and all languages derived from it do it like gnuplot (even for //
> comments). Make does it like gnuplot.
I think you are correct in terms of how the parsers work, but the
effect for the user is quite different in the two languages. This is
because newlines are just whitespace in C, but statement terminators
in gnuplot.
Let me construct two arbitrary examples. For C let's use
printf("%s\n%s\n",
"foo",
"bar");
and for gnuplot
plot [0:2*pi] [-2:2] \
cos(x), \
tan(x)
Now in C there is no problem in commenting out one of the arguments
using “//”:
printf("%s\n%s\n",
// "foo",
"qux",
"bar");
does what you want. But in gnuplot
plot [0:2*pi] [-2:2] \
sin(x), \
# cos(x), \
tan(x)
does not do what I want, and
plot [0:2*pi] [-2:2] \
# cos(x), \
sin(x), \
tan(x)
is an error.
It is true that in C
printf("%s\n%s\n",
//"foo", \
"qux", \
"bar");
has the same problem, but why would you write it like that in the
first place? Conversely, how do you write the gnuplot example so that
it is easy to comment out one of the functions?
I am not saying that it is easy to implement a more user-friendly
behavior (I would not know, having never written a real-life parser).
But it would be a good thing, and the situation is certainly not the
same as in C.
To be fair, bash and python (to pick two more languages where newline
terminates a statement) do have problems similar to gnuplot's. But I
do not remember that I have ever actually run into the problem with
these two. In gnuplot, I often have plot commands with several lines
and would like to be able to comment one of them out quickly.
>> Most un-intuitive... Any chance that this can be fixed in 4.7,
>
> There's not going to be a 4.7.
So what is the future of gnuplot (or its version numbers) then? Will
4.6 be the final release? Or will there be a 5.0? Or will it,
somewhat like TeX, asymptotically converge to 4.7? Interesting
questions certainly, but I am not sure they are relevant to the OP's
point.
Elias
|
|
From: Ethan M. <eam...@gm...> - 2014-11-13 19:58:45
|
On Thu, Nov 13, 2014 at 4:17 AM, Elias Assmann <eli...@gm...> wrote:
>>
>> There's not going to be a 4.7.
>
> So what is the future of gnuplot (or its version numbers) then? Will
> 4.6 be the final release? Or will there be a 5.0?
You can find packaged release candidates for version 5 on SourceForge.
-rc3 is very recent and will probably be the final version, with formal
release of gnuplot 5.0 at about year's end.
Release notes here:
http://gnuplot.sourceforge.net/ReleaseNotes_5_0_rc3.html
|
|
From: Elias A. <eli...@gm...> - 2014-11-17 10:29:32
|
On 11/13/2014 08:58 PM, Ethan Merritt wrote: > You can find packaged release candidates for version 5 on SourceForge. > -rc3 is very recent and will probably be the final version, with formal > release of gnuplot 5.0 at about year's end. That's great to hear. Gnuplot 4.6 brought a lot of nice new features, I am sure (without having looked at those release notes) that gnuplot 5.0 will be even better. Elias |
|
From: Dave H. <da...@ho...> - 2014-11-17 18:51:58
|
Odd; I never saw the OP's reply, so I'll reply this way instead.
On Thu, 13 Nov 2014, Elias Assmann wrote:
> > Am 12.11.2014 um 22:00 schrieb Dave Horsfall:
> >> With the exception of Gnuplot, every parser I've seen strips out comments
> >> first, then glues lines together.
> >
> > Then, with all due respect, you may not have seen enough parsers yet.
> > C and all languages derived from it do it like gnuplot (even for //
> > comments). Make does it like gnuplot.
And with all due respect in turn, I don't think you know anything of my
programming background. In the past 40 years or so, I've used something
like over 40 languages, and that's counting all versions of FORTRAN as
one, all assemblers as one, all LISPs as one, all BASICs as one, all
ALGOLs as one, etc.
Oh, and I have written parsers, compilers, etc.
> >> Most un-intuitive... Any chance that this can be fixed in 4.7,
> >
> > There's not going to be a 4.7.
I thought I saw a reference to it on this very list, but from later mail I
guess it could've been 5.0 instead.
Here's a couple of practical examples of why I think Gnuplot is doing it
wrong (in the sense of not making it easy for the programmer, which last I
looked is the computer's job).
My script that plots my daily health readings:
# Dropped Weight, Girth, BMI and BMR etc until they change.
# datafile using 1:(@WEIGHT) lt 8 title 'Weight (kg)', \
# datafile using 1:(@GIRTH):(@GIRTH-2):(@GIRTH+2) \
# with errorbars lt 7 title 'Girth (± 2cm)', \
# datafile using 1:(bmi(@WEIGHT)) \
# with lines lt 13 title 'BMI (kg/m^2)', \
# datafile using 1:(bmr3(@WEIGHT))/100.0 \
# with lines lt 3 title 'BMR/100 (Cal/day)', \
# datafile using 1:(@SYS-@DIA)*10/@HR \
# with lines lt 9 title '(Sys-Dia)/HR', \
# datafile using 1:(avg(@SYS, @DIA)*10)/@HR \
# with lines lt 5 title 'µ(Sys,Dia)/HR', \
# Broken parsing needs a dummy line here.
#
plot \
datafile using 1:(@SYS) lt 1 pt 1 title 'Sys (Hg)', \
datafile using 1:(@DIA) lt 1 pt 2 title 'Dia (Hg)', \
datafile using 1:(@HR) lt 2 title 'HR (bpm)', \
datafile using 1:(@SYS-@DIA)*@HR/100.0 \
with lines lt 7 title '(Sys-Dia)*HR/100', \
datafile using 1:(avg(@SYS, @DIA)*@HR/1000.0) \
with lines lt -1 title 'µ(Sys,Dia)*HR/1000', \
1/0 lt -1 notitle # Dummy so I can move above around
My script that plots my daily spam load:
#
# Too small to be worth plotting.
# datafile using 1:($5) title 'Proxy', \
# datafile using 1:($6) title 'Pause', \
# Need a line after a commented continuation line.
#
# Note that "User unknown/missing" doesn't trend, hence no lines.
#
# I also dropped HSR; my inbound mail is around 100/day, so the HSR
# correlates with Spam anyway.
# datafile using 1:(hsr($8, $7)) lt 3 title 'HSR', \
#
# And Banner went out in sympathy.
# datafile using 1:($3) lt 9 title 'Banner', \
#
# XXX Should call 0.1 "epsilon" or something.
plot \
datafile using 1:($8-$7) lt rgb "green" title 'Rcvd', \
datafile using 1:($2) lt rgb "red" title 'Reject', \
datafile using 1:(max($7, 0.1)) lt rgb "dark-pink" title 'Spam', \
datafile using 1:(max($4, 0.1)) lt rgb "yellow" with impulses title 'User', \
datafile using 1:($9) lt rgb "cyan" title 'Sent'
The terminally-curious can see the results over at
www.horsfall.org/gnuplot.html (updated whenever).
Given that the purpose of a computer is to make humans' lives easier, I
would really like the ability to comment out a line /in situ/, and put it
right back again.
--
Dave Horsfall DTM (VK2KFU) "Bliss is a MacBook with a FreeBSD server."
http://www.horsfall.org/spam.html (and check the home page whilst you're there) |