Loading ...
Sorry, an error occurred while loading the content.
 

outputting to stderr

Expand Messages
  • Thomas Beale
    most command line Eiffel programs send feedback to the console with either io.put_string () or print (). I need to control this properly to be output = stdout
    Message 1 of 11 , May 1, 2013
      most command line Eiffel programs send feedback to the console with
      either io.put_string () or print (). I need to control this properly to
      be output => stdout and error output to std_err. It appears that the
      only way to do this is to use the STD_FILES modal set_error_default and
      set_output_default calls.

      That means if you have some code that wants to do (logical pseudo-code):

      ...
      stdout.put_string ("xxxxx")
      ...
      stderr.put_string ("err err err")
      ...
      stdout.put_string ("xxxxx")


      you actually have to do:

      ...
      io.put_string ("xxxx")
      ...
      io.set_error _default
      io.put_string ("err err err")
      io.set_output_default
      ...
      io.put_string ("xxxxx")


      and you only get away with that if you trust that no developer forgot to
      switch the default output back to standard out after reporting an error.

      I have never really thought about it before, but this hardly makes
      sense. Why doesn't ANY just have the following?

      stderr: PLAIN_TEXT_FILE
      stdout: PLAIN_TEXT FILE

      Or am I missing something basic here?

      - thomas
    • Emmanuel Stapf
      Wouldn t the following be what you are looking for io.put_string (...) io.error.put_string (...) ? Regards, Manu
      Message 2 of 11 , May 1, 2013
        Wouldn't the following be what you are looking for

        io.put_string (...)
        io.error.put_string (...)

        ?

        Regards,
        Manu

        > -----Original Message-----
        > From: eiffel_software@yahoogroups.com
        > [mailto:eiffel_software@yahoogroups.com] On Behalf Of Thomas Beale
        > Sent: Wednesday, May 01, 2013 08:47
        > To: eiffel_software@yahoogroups.com
        > Subject: [eiffel_software] outputting to stderr
        >
        >
        > most command line Eiffel programs send feedback to the console with
        > either io.put_string () or print (). I need to control this properly to
        > be output => stdout and error output to std_err. It appears that the only
        > way to do this is to use the STD_FILES modal set_error_default and
        > set_output_default calls.
        >
        > That means if you have some code that wants to do (logical pseudo-code):
        >
        > ...
        > stdout.put_string ("xxxxx")
        > ...
        > stderr.put_string ("err err err")
        > ...
        > stdout.put_string ("xxxxx")
        >
        >
        > you actually have to do:
        >
        > ...
        > io.put_string ("xxxx")
        > ...
        > io.set_error _default
        > io.put_string ("err err err")
        > io.set_output_default
        > ...
        > io.put_string ("xxxxx")
        >
        >
        > and you only get away with that if you trust that no developer forgot to
        > switch the default output back to standard out after reporting an error.
        >
        > I have never really thought about it before, but this hardly makes sense.
        > Why doesn't ANY just have the following?
        >
        > stderr: PLAIN_TEXT_FILE
        > stdout: PLAIN_TEXT FILE
        >
        > Or am I missing something basic here?
        >
        > - thomas
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
      • carl94706
        Is there something wrong with using: io.error.put_string( xxx ) ? Carl
        Message 3 of 11 , May 1, 2013
          Is there something wrong with using:

          io.error.put_string("xxx") ?

          Carl


          --- In eiffel_software@yahoogroups.com, Thomas Beale <Thomas.Beale@...> wrote:
          >
          >
          > most command line Eiffel programs send feedback to the console with
          > either io.put_string () or print (). I need to control this properly to
          > be output => stdout and error output to std_err. It appears that the
          > only way to do this is to use the STD_FILES modal set_error_default and
          > set_output_default calls.
          >
          > That means if you have some code that wants to do (logical pseudo-code):
          >
          > ...
          > stdout.put_string ("xxxxx")
          > ...
          > stderr.put_string ("err err err")
          > ...
          > stdout.put_string ("xxxxx")
          >
          >
          > you actually have to do:
          >
          > ...
          > io.put_string ("xxxx")
          > ...
          > io.set_error _default
          > io.put_string ("err err err")
          > io.set_output_default
          > ...
          > io.put_string ("xxxxx")
          >
          >
          > and you only get away with that if you trust that no developer forgot to
          > switch the default output back to standard out after reporting an error.
          >
          > I have never really thought about it before, but this hardly makes
          > sense. Why doesn't ANY just have the following?
          >
          > stderr: PLAIN_TEXT_FILE
          > stdout: PLAIN_TEXT FILE
          >
          > Or am I missing something basic here?
          >
          > - thomas
          >
        • Thomas Beale
          ... sure, but to make life easy in my view we should make it more obvious that io.error is what the rest of the world calls standard error or std_error or
          Message 4 of 11 , May 2, 2013
            On 01/05/2013 16:51, Emmanuel Stapf wrote:
            > Wouldn't the following be what you are looking for
            >
            > io.put_string (...)
            > io.error.put_string (...)
            >

            sure, but to make life easy in my view we should make it more obvious
            that 'io.error' is what the rest of the world calls 'standard error' or
            std_error or (some other variation), and io.output is what the rest of
            the world calls 'standard output' or std_out or....

            I am interested in code being more comprehensible to outsiders...

            - thomas
          • holworth
            I support that. David Williams Software Team Leader & Intellectual Property Manager Email: dwilliams@dek.com Tel: +44 1305 208341 From: Thomas Beale
            Message 5 of 11 , May 2, 2013
              I support that.

              David Williams
              Software Team Leader & Intellectual Property Manager
              Email: dwilliams@...
              Tel: +44 1305 208341



              From: Thomas Beale <Thomas.Beale@...>
              To: eiffel_software@yahoogroups.com
              Date: 02/05/2013 08:18
              Subject: Re: [eiffel_software] outputting to stderr
              Sent by: eiffel_software@yahoogroups.com






              On 01/05/2013 16:51, Emmanuel Stapf wrote:
              > Wouldn't the following be what you are looking for
              >
              > io.put_string (...)
              > io.error.put_string (...)
              >

              sure, but to make life easy in my view we should make it more obvious
              that 'io.error' is what the rest of the world calls 'standard error' or
              std_error or (some other variation), and io.output is what the rest of
              the world calls 'standard output' or std_out or....

              I am interested in code being more comprehensible to outsiders...

              - thomas





              The information in this e-mail and any attachments transmitted with it are provided in commercial confidence for the intended recipient(s). If you have received this e-mail in error, please notify the Postmaster by e-mail at postmaster@.... Any views or opinions expressed are solely those of the author and do not necessarily represent those of DEK.

              For local company specific legal information for your country or region and any local contact information for DEK, please refer to:

              http://www.dek.com/dek.nsf/reg!openform

              This footnote confirms that this message has been checked for the presence of computer viruses and other 'malware' to the best of our knowledge when it left our systems. DEK is not responsible in any way for any malware that may be or become associated with this message. Recipients are strongly urged to use appropriate protection and requested to assure themselves that opening any attachments is safe.


              [Non-text portions of this message have been removed]
            • Emmanuel Stapf
              ... Do you suggest adding 2 routines in ANY called `stdout and `stderr ? I think that writing: io.put_string ( ... ) io.output.put_string ( ... )
              Message 6 of 11 , May 2, 2013
                > sure, but to make life easy in my view we should make it more obvious
                > that 'io.error' is what the rest of the world calls 'standard error' or
                > std_error or (some other variation), and io.output is what the rest of
                > the world calls 'standard output' or std_out or....

                Do you suggest adding 2 routines in ANY called `stdout' and `stderr'?

                I think that writing:

                io.put_string ("...")
                io.output.put_string ("...")
                io.error.put_string ("...")

                does not require specific mindset to understand what it means.

                In C# for example, they do for standard output:

                Console.WriteLine ("..")

                and for standard error:

                Console.Error.WriteLine ("..")

                so this is no different than what we currently do and I don't think users are
                confused. Maybe we should rename `io' in `console' but that's very restrictive in
                my view since `STD_FILES' can operate on file as well.

                Regards,
                Manu
              • Thomas Beale
                ... probably yes. I know some will regard this as a horror from the C world, but the fact is that the Eiffel STD_FILES has this model of reporting errors
                Message 7 of 11 , May 3, 2013
                  On 02/05/2013 16:39, Emmanuel Stapf wrote:
                  >> sure, but to make life easy in my view we should make it more obvious
                  >> that 'io.error' is what the rest of the world calls 'standard error' or
                  >> std_error or (some other variation), and io.output is what the rest of
                  >> the world calls 'standard output' or std_out or....
                  > Do you suggest adding 2 routines in ANY called `stdout' and `stderr'?

                  probably yes. I know some will regard this as a horror from the C world,
                  but the fact is that the Eiffel STD_FILES has this model of reporting
                  errors anyway, it just isn't clear.

                  >
                  > I think that writing:
                  >
                  > io.put_string ("...")
                  > io.output.put_string ("...")
                  > io.error.put_string ("...")
                  >
                  > does not require specific mindset to understand what it means.

                  to me it means nothing special, unless I know Eiffel well, and always
                  remember that:
                  * io.put_string is really going to generate output on &1, unless
                  subverted by io.set_error_default
                  * io.output.xxx means... what? Oh, that's right, 'output' = 'standard
                  out' in everyone else's language
                  * io.error.xxx means.... etc

                  what I want is to be able to write and read code where I can instantly
                  know if the output is going to &1 or &2, and what other programs in a
                  command line pipeline will see.

                  >
                  > In C# for example, they do for standard output:
                  >
                  > Console.WriteLine ("..")
                  >
                  > and for standard error:
                  >
                  > Console.Error.WriteLine ("..")

                  Is this the first time C# was mentioned to defend a questionable Eiffel
                  practice? ;-)

                  >
                  > so this is no different than what we currently do and I don't think users are
                  > confused.

                  they might not be, but I wonder how many people write proper disciplined
                  command line programs that operate by posix rules? Most of the time I
                  don't do that, but when I have to, I need to be able to program without
                  obfuscation.

                  - thomas
                • Emmanuel Stapf
                  ... I could have used Java as well: System.out.println ( ... ) System.err.println ( ... ) or C++: cout
                  Message 8 of 11 , May 3, 2013
                    > Is this the first time C# was mentioned to defend a questionable Eiffel
                    > practice? ;-)

                    I could have used Java as well:

                    System.out.println ("...")
                    System.err.println ("...")

                    or C++:

                    cout << "..."
                    cerr << "..."

                    I used C# and now Java and C++ to show that your conception of stdout and stderr
                    is bound to just C and those days most people not using Eiffel are likely to know
                    about the above 3 ways of doing outputs. And Eiffel:

                    io.output.put_string ("...")
                    io.error.put_string ("...")

                    is really not much different.

                    Manu
                  • Thomas Beale
                    ... yes, but everyone knows what System.out and System.err mean, and that cout and cerr are synonyms for that, and they are direct correspondents for the old
                    Message 9 of 11 , May 3, 2013
                      On 03/05/2013 19:10, Emmanuel Stapf wrote:
                      >> Is this the first time C# was mentioned to defend a questionable Eiffel
                      >> practice? ;-)
                      > I could have used Java as well:
                      >
                      > System.out.println ("...")
                      > System.err.println ("...")
                      >
                      > or C++:
                      >
                      > cout << "..."
                      > cerr << "..."

                      yes, but everyone knows what System.out and System.err mean, and that
                      cout and cerr are synonyms for that, and they are direct correspondents
                      for the old stdout and stderr.

                      >
                      > I used C# and now Java and C++ to show that your conception of stdout and stderr
                      > is bound to just C and those days most people not using Eiffel are likely to know
                      > about the above 3 ways of doing outputs. And Eiffel:
                      >
                      > io.output.put_string ("...")
                      > io.error.put_string ("...")
                      >
                      > is really not much different.

                      if we were to take that line (which I agree is a perfectly reasonable
                      one), then we should completely ban io.put_string() everywhere and
                      always, also ban the modal set_default_error / set_default_output thing,
                      and only use the above forms, so it is always clear where the output is
                      going. And given the ubiquity of such statements, I wouldn't mind
                      something a bit shorter than io.error.put_string() to type just to get
                      something to stdout. How about stdout.put() or cout.put() or ...

                      - thomas
                    • Ian Joyner
                      Hi Thomas, Actually, if stdin, stdout, and stderr were added more directly, I still don t see the outside world beating down any doors to use Eiffel - it s
                      Message 10 of 11 , May 3, 2013
                        Hi Thomas,

                        Actually, if stdin, stdout, and stderr were added more directly, I still don't see the outside world beating down any doors to use Eiffel - it's just not C syntax. OK, people are brainwashed into thinking in terms of stdio, but as filing systems go, Unix is pretty weak. People are also brainwashed into thinking C and its syntax are good. In systems, such as WebObjects, the programmer never touches files - reading and writing objects is completely transparent (done by faulting). So that's why I question any move to added complexity in the file world. Plan 9 (and Unix to some extent) try to make everything work in terms of file abstractions - but I think that's a step in the wrong direction.

                        Ian

                        On 4 May 2013, at 04:26, Thomas Beale <Thomas.Beale@...> wrote:

                        > On 03/05/2013 19:10, Emmanuel Stapf wrote:
                        >>> Is this the first time C# was mentioned to defend a questionable Eiffel
                        >>> practice? ;-)
                        >> I could have used Java as well:
                        >>
                        >> System.out.println ("...")
                        >> System.err.println ("...")
                        >>
                        >> or C++:
                        >>
                        >> cout << "..."
                        >> cerr << "..."
                        >
                        > yes, but everyone knows what System.out and System.err mean, and that
                        > cout and cerr are synonyms for that, and they are direct correspondents
                        > for the old stdout and stderr.
                        >
                        >>
                        >> I used C# and now Java and C++ to show that your conception of stdout and stderr
                        >> is bound to just C and those days most people not using Eiffel are likely to know
                        >> about the above 3 ways of doing outputs. And Eiffel:
                        >>
                        >> io.output.put_string ("...")
                        >> io.error.put_string ("...")
                        >>
                        >> is really not much different.
                        >
                        > if we were to take that line (which I agree is a perfectly reasonable
                        > one), then we should completely ban io.put_string() everywhere and
                        > always, also ban the modal set_default_error / set_default_output thing,
                        > and only use the above forms, so it is always clear where the output is
                        > going. And given the ubiquity of such statements, I wouldn't mind
                        > something a bit shorter than io.error.put_string() to type just to get
                        > something to stdout. How about stdout.put() or cout.put() or ...
                        >
                        > - thomas
                        >
                        >
                        >
                        > ------------------------------------
                        >
                        > Yahoo! Groups Links
                        >
                        >
                        >
                      • Thomas Beale
                        but then a file is just an abstraction.... Pure VM model databases are actually not good to use for most applications (they are good in real time and
                        Message 11 of 11 , May 9, 2013
                          but then a 'file' is just an abstraction....

                          Pure VM model databases are actually not good to use for most
                          applications (they are good in real time and embedded systems). I don't
                          really care that much about stdio per se; what is needed however is a
                          clear syntax +/- library calls to point output to what unix systems
                          think of as stdout and stderr. At the moment that's completely unclear
                          in I would guess 99% of all Eiffel code.

                          - thomas

                          On 04/05/2013 03:00, Ian Joyner wrote:
                          > Hi Thomas,
                          >
                          > Actually, if stdin, stdout, and stderr were added more directly, I still don't see the outside world beating down any doors to use Eiffel - it's just not C syntax. OK, people are brainwashed into thinking in terms of stdio, but as filing systems go, Unix is pretty weak. People are also brainwashed into thinking C and its syntax are good. In systems, such as WebObjects, the programmer never touches files - reading and writing objects is completely transparent (done by faulting). So that's why I question any move to added complexity in the file world. Plan 9 (and Unix to some extent) try to make everything work in terms of file abstractions - but I think that's a step in the wrong direction.
                          >
                          >
                          *
                          *


                          [Non-text portions of this message have been removed]
                        Your message has been successfully submitted and would be delivered to recipients shortly.