Discussion:
TODO - COPY_PIPMAK_TERMINAL_TO_STDOUT
Aidan Gauland
2008-11-21 21:04:18 UTC
Permalink
Hello,

I've addressed the To Do item "Add a way to enable the
COPY_PIPMAK_TERMINAL_TO_STDOUT flag at run time", and committed my changes
(which add to the Pipmak reference). But it would good to have somebody else
(I'm looking at you Christian ;) ) look at the documentation, to make sure
that someone other than the programmer who made the changes can understand them.

And does anyone else want Pipmak's error messages to go to stderr as well?
I'm still thinking of an easy to make Pipmak do this.

-Aidan
Christian Walther
2008-11-22 10:19:21 UTC
Permalink
Post by Aidan Gauland
I've addressed the To Do item "Add a way to enable the
COPY_PIPMAK_TERMINAL_TO_STDOUT flag at run time", and committed my changes
(which add to the Pipmak reference).
Cool, thanks!
Post by Aidan Gauland
But it would good to have somebody else
(I'm looking at you Christian ;) ) look at the documentation, to make sure
that someone other than the programmer who made the changes can understand them.
Looks fine to me (but then I'm a programmer too). Personally I
wouldn't have seen a need to mention the internal variable name
(CpyTermToStdout), but I guess it doesn't do any harm.

Some nitpicky comments about the rest:

- Checking the argument with lua_isboolean() is not necessary, as
every Lua value has a boolean value (nil and false are false,
everything else is true). By that check, you're unnecessarily
forbidding use of anything but strictly true and false. I don't think
it hurts much in this case though, as this function probably isn't
ever called with a more complex expression than "true" or "false".

- For argument checking (assuming that you want to stop Lua execution
and not just proceed with a warning), it's better to use the auxiliary
functions that call lua_error() than just printing a message to the
terminal, such as luaL_error(), luaL_typerror(), luaL_checknumber()
etc. (they're not documented, but their source in lauxlib.c is simple
enough), so that the user gets an indication of where in their code
the error happens.

- I personally would have used something more human-readable than
"PmkTerm" to mark the output. (What the heck is a "Pmk"? :) )
Post by Aidan Gauland
And does anyone else want Pipmak's error messages to go to stderr as well?
I'm still thinking of an easy to make Pipmak do this.
What exactly do you mean by error messages? Those that go through
errorMessage()? They generally mean that Pipmak doesn't run at all,
and since Pipmak runs for me, I never see them anyway. Those on the
terminal? We already have them on stdout, thanks to your addition. And
since Pipmak isn't a noninteractive tool that I call in a shell script
or something, I see no need to differentiate between stdout and
stderr. So, no, I personally don't.

-Christian
Aidan Gauland
2008-11-22 21:54:02 UTC
Permalink
Post by Christian Walther
- Checking the argument with lua_isboolean() is not necessary, as
every Lua value has a boolean value (nil and false are false,
everything else is true). By that check, you're unnecessarily
forbidding use of anything but strictly true and false. I don't think
it hurts much in this case though, as this function probably isn't
ever called with a more complex expression than "true" or "false".
- For argument checking (assuming that you want to stop Lua execution
and not just proceed with a warning), it's better to use the auxiliary
functions that call lua_error() than just printing a message to the
terminal, such as luaL_error(), luaL_typerror(), luaL_checknumber()
etc. (they're not documented, but their source in lauxlib.c is simple
enough), so that the user gets an indication of where in their code
the error happens.
I agree with you on both points. I didn't know Lua had those error reporting
functions.
Post by Christian Walther
- I personally would have used something more human-readable than
"PmkTerm" to mark the output. (What the heck is a "Pmk"? :) )
Post by Aidan Gauland
And does anyone else want Pipmak's error messages to go to stderr as well?
I'm still thinking of an easy to make Pipmak do this.
What exactly do you mean by error messages? Those that go through
errorMessage()? They generally mean that Pipmak doesn't run at all,
and since Pipmak runs for me, I never see them anyway. Those on the
terminal? We already have them on stdout, thanks to your addition. And
since Pipmak isn't a noninteractive tool that I call in a shell script
or something, I see no need to differentiate between stdout and
stderr. So, no, I personally don't.
Hmmm, good point. I didn't think about Pipmak not being a non-interactive
program.

Loading...