<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>
      <blockquote type="cite">i quite like the idea of having a
        canvas-scope for such an object.
      </blockquote>
      Personally, I would rather prefer that if the error code would be
      simply output by the same object that generated the error.</p>
    <p>
      <blockquote type="cite">On 6/14/21 10:37 AM, Peter P. wrote:
        <br>
        > Yes, that's a good idea, but what if there are two
        identical objects
        <br>
        > on the same canvas?
        <br>
        <br>
        i think that would be *your* problem.
        <br>
        if you want to catch error messages from two instances of the
        same objectclass, just put them into separate canvases.
        <br>
        simple as that.
      </blockquote>
      I think Peter's concern is valid and it's actually another reason
      why I wouldn't like such a design.</p>
    <p>---</p>
    <p>Here's another idea, which I don't really love, but which I would
      prefer over your proposed [canvaserror]:</p>
    <p>Method calls which can generate an error send the error code to a
      global [errno] object and the user can query the current error
      state with a bang. This would be similar to 'errno' in C.</p>
    <p>If the user queries the errno immediately after the method call,
      Pd's determinism guarantees that the error really belongs to that
      method call. We would have to reserve a special value (e.g. "0")
      to mean "no error".</p>
    <p>My main point is that errors should not be *sent* by global or
      canvas-local objects, but that they should be *queried*. This way
      the user doesn't have to deal with cross talk between different
      objects.</p>
    <p>Christof<br>
    </p>
    <div class="moz-cite-prefix">On 14.06.2021 13:29, IOhannes m
      zmoelnig wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:b90c4fd3-48a8-1a04-15f9-5b00418791d7@iem.at">On 6/14/21
      10:23 AM, Roman Haefeli wrote:
      <br>
      <blockquote type="cite">On Mon, 2021-06-14 at 10:02 +0200, Peter
        P. wrote:
        <br>
        <br>
        <blockquote type="cite">  I am wondering how one would
          <br>
          parse these error messages if they came from one single object
          outlet
          <br>
          to
          <br>
          tell where the error originated from?
          <br>
        </blockquote>
        <br>
        I am wondering about that, too. Maybe a [pderror] would be
        canvas-local
        <br>
        and only report errors from objects belonging to the local
        canvas? And
        <br>
        it would prepend the name of the object to the message?
        <br>
      </blockquote>
      <br>
      i quite like the idea of having a canvas-scope for such an object.
      <br>
      <br>
      however, i think [pderror] is a bad name, as i would expect this
      object to be usable for *generating* errors (ala [print]), rather
      than outputting them.
      <br>
      <br>
      anyhow, i think the proposal maps nicely to what other languages
      offer as "exception handling".
      <br>
      from that pov, a good name would be [catch] (which would be *very*
      good, if, alas! that weren't already occupied by the similarly
      named but totally different [catch~]), or [except] (but i somehow
      have the feeling that this would need some explicit *connection*
      to the object that is bailing out).
      <br>
      <br>
      with iemgut's in mind, i would go for [canvaserror] (or, for a
      more general case: [canvasconsole]).
      <br>
      <br>
      On 6/14/21 10:37 AM, Peter P. wrote:
      <br>
      > Yes, that's a good idea, but what if there are two identical
      objects
      <br>
      > on the same canvas?
      <br>
      <br>
      i think that would be *your* problem.
      <br>
      if you want to catch error messages from two instances of the same
      objectclass, just put them into separate canvases.
      <br>
      simple as that.
      <br>
      <br>
      e.g. cf the python code
      <br>
      ```
      <br>
      try:
      <br>
        x=int("foo")
      <br>
        y=int("bar")
      <br>
      except:
      <br>
        print("one of the two conversions failed")
      <br>
      ```
      <br>
      <br>
      <br>
      while thinking about the exception analogy, it might be
      interesting to be able to re-throw an error message:
      <br>
      if you don't want to hande the error in your canvas, you can just
      pass it on to the parent canvas by sending it to an [error]
      object.
      <br>
      <br>
      the same could apply to [print], which can be considered just as a
      "low-priority error".
      <br>
      <br>
      fgmdsr
      <br>
      IOhannes
      <br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list
UNSUBSCRIBE and account-management -> <a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-list">https://lists.puredata.info/listinfo/pd-list</a>
</pre>
    </blockquote>
  </body>
</html>