Artifacts Associated With Ticket 219268ffff
Ticket change [3a3e1fabad] (rid 112531) by nobody on 2000-10-26 05:09:39:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 1347 RFE Version: 8.0.4 SubmitDate: '1999-03-02' LastModified: '1999-03-02' Severity: SER Status: UnAssn Submitter: pat ChangedBy: pat OS: Other OSVersion: All OSes Machine: NA FixedDate: '2000-10-25' ClosedDate: '2000-10-25' Name: Alexandre FERRIEUX DesiredBehavior: Currently, when an error occurs in an event/after handler, it is handled by the bgerror mechanism: the info about error is saved, and an [after idle] is posted to pop up an error dialog later. Note that all this doesn't interrupt the surrounding [vwait]. This is fine for normal wish apps using the implicit Tk event loop In more complex situations, the [vwait] is called by the programmer, and it would be preferable that the errors be raised synchronously, i.e. they interrupt the vwait. This way a [catch] of the vwait will do the right thing. For backward compatibility, this new behavior could be activated by an option [vwait -errors], or by a global variable [set ::tcl_vwait_errors 1]. Of course, a workaround currently exists, but it is inelegant and inefficient: proc bgerror s {set ::_bgerror_var BGERROR:$s} proc vwait_e vvar { upvar #0 $vvar ::_bgerror_var vwait ::_bgerror_var if {[regexp {^BGERROR:(.*)$} $::_bgerror_var pipo res]} {error $res} return $::_bgerror_var } (The problem with this is that if you don;t want to wipe out an already defined bgerror, you have to switch it back and forth with [rename]. If you have to do this frequently, the performance is terrible.) - foundin initialized to: "obsolete: 8.0.4"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "Catching errors at [vwait] instead of [bgerror]"
- type initialized to: "RFE"
Ticket change [bd8459b1a1] (rid 101917) by dkf on 2000-11-19 18:09:15:
- foundin changed to: "obsolete: 8.4a3"
- icomment:
I'm in two minds about this; though it is functionality which is useful in some situations, it also disturbs the currently defined behaviour of errors that occur in an event. But I suppose that's the whole point! :^) One way of doing it might be to make vwait take an optional extra argument (after the name of the global variable) that specifies an alternate error handler to use in place of bgerror for the duration of the wait (so you could avoid the expense of renaming commands all over the place.) Or maybe do it like this (using slightly more acceptable syntax): vwait -errorhandler someProcedure someGlobalVariable The only complication comes when you have loads of nested vwaits, but that is a situation that is pretty nasty anyway even without wanting to do several different error handlers... - login: "dkf"
- mimetype: "text/plain"
- priority changed to: "4"
- subsystem changed to: "81. Bundled Packages"
- username: "dkf"
Ticket change [5433e6c43c] (rid 93903) by dkf on 2001-02-07 23:13:30:
- subsystem changed to: "02. Event Loops"
Ticket change [1d19d13344] (rid 90732) by dgp on 2001-04-04 04:42:32:
- subsystem changed to: "18. Commands M-Z"
Ticket change [98ecba845d] (rid 110693) by dgp on 2003-11-13 06:08:20:
- assignee changed to: "dkf"
Ticket change [2ef20afdf0] (rid 92971) by ferrieux on 2008-04-10 04:28:00:
- icomment:
Logged In: YES user_id=496139 Originator: NO OK, an explicit option is the way to go. But instead of passing a callback, why not just raise a synchronous exception ? vwait -syncerr var The idea is that catching the vwait (or one of its callers, unaware of the underlying vwait, like in http) is a more modular idiom than defining an extra procedure. - login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [f9366638f4] (rid 91667) by nobody on 2008-04-10 04:56:13:
- icomment:
Logged In: NO What would the proposed '-syncerr' option mean, exactly?
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [50753d10e0] (rid 125972) by ferrieux on 2008-04-10 14:50:26:
- icomment:
Logged In: YES user_id=496139 Originator: NO The idea is that after 0 {error yo} vwait -syncerr forever would raise "yo" instead of installing an idle handler calling bgerror. Thus we'd support the isolated uses of [vwait] with none of the current ill-effects reported on this clt thread: http://groups.google.com/group/comp.lang.tcl/browse_frm/thread/3e178c574d6341fb/3303ebcc6767ec3d#3303ebcc6767ec3d And since it's an option, it won't risk any incompatibility for single-vwait and Tk-based apps, as per Donal's suggestion. - login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [d6739fc2d0] (rid 123807) by dgp on 2008-04-10 22:14:59:
- icomment:
Logged In: YES user_id=80530 Originator: NO As I understand it, the complaint is about the practice of Tcl_BackgroundError() to arrange for the background error handling command to be evaluated as an idle callback via a Tcl_DoWhenIdle() call. Or perhaps that various Tcl_EventProcs call Tcl_BackgroundError() in the first place. These routines are not directly attached to the [vwait] command. They generally that operate in any event loop. As such it seems a mismatch to me to try to influence the behavior of general client routines of the notifier infrastructure with an option to only one of the event loop creating commands in only one of the interps the notifier may be managing events for. There may still be a problem here worth addressing (not convinced either way), but I don't think a correct path for addressing it has been identified.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [647fb88285] (rid 92782) by ferrieux on 2008-04-10 22:39:47:
- icomment:
Logged In: YES user_id=496139 Originator: NO It is true that the various callbacks call Tcl_BackgroundError() which does two things: - enqueue the error in a linked list in assocdata("tclBgError") - if not done yet, Tcl_DoWhenIdle(HandleBgErrors) My naive idea was, in presence of [vwait -syncerr], to directly test the non-emptiness of that linked list at each at each turn of the vwait loop, and to directly return from [vwait] with the proper TCL_ERROR and associated error string computed from what's stored in the first cell of the list (BTW I don't know in what situations this list could be longer than 1). So, this would only affect the one vwait that has the flag, and would do so without non-local influence on the behavior of the general client routines like Tcl_BackgroundError() et al. Or am I missing something ? - login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment: