|
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
|