Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #13998 > unrolled thread
| Started by | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| First post | 2012-07-14 15:55 +0200 |
| Last post | 2012-07-25 03:55 +0400 |
| Articles | 20 on this page of 159 — 18 participants |
Back to article view | Back to comp.lang.forth
Quotations revisited mhx@iae.nl (Marcel Hendrix) - 2012-07-14 15:55 +0200
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-15 19:26 +0000
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-15 23:53 +0200
Re: Quotations revisited mhx@iae.nl (Marcel Hendrix) - 2012-07-15 23:54 +0200
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-16 00:48 +0200
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-22 15:01 +0000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-23 16:49 +0000
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-23 21:39 +0000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-25 13:13 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-22 11:07 -0500
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-22 10:21 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-22 12:35 -0500
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-22 11:39 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-22 15:16 -0500
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-22 14:35 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-23 04:18 -0500
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-23 12:58 +0000
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-23 11:55 -0700
Re: Quotations revisited BruceMcF <agila61@netscape.net> - 2012-07-23 05:45 -0700
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-27 12:41 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-15 14:11 -1000
Re: Quotations revisited "A. K." <akk@nospam.org> - 2012-07-16 07:47 +0200
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-16 13:56 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-16 07:20 -1000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-17 13:49 +0000
Re: Quotations revisited Mark Wills <markrobertwills@yahoo.co.uk> - 2012-07-16 02:32 -0700
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-27 12:58 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 04:32 -0500
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-16 11:41 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 07:40 -0500
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-16 14:05 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 09:20 -0500
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-16 15:46 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 11:33 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-16 15:32 +0000
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-16 17:56 +0000
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-16 23:37 +0200
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-27 13:05 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-27 08:21 -0500
Re: Quotations revisited Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2012-07-16 10:14 +0200
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 04:23 -0500
Re: Quotations revisited m.a.m.hendrix@tue.nl - 2012-07-16 03:39 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 07:09 -0500
Re: Quotations revisited mhx@iae.nl (Marcel Hendrix) - 2012-07-16 23:47 +0200
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-17 04:14 -0500
Re: Quotations revisited Coos Haak <chforth@hccnet.nl> - 2012-07-17 17:39 +0200
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-17 12:18 -0500
Re: Quotations revisited mhx@iae.nl (Marcel Hendrix) - 2012-07-17 20:26 +0200
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-19 16:21 +0000
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-19 15:58 -0700
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-16 14:05 +0000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-16 12:47 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 08:56 -0500
Re: Quotations revisited Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-16 15:04 +0100
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 09:23 -0500
Re: Quotations revisited Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-16 17:38 +0100
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-16 12:58 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-16 14:56 +0000
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-16 22:53 +0000
Re: Quotations revisited BruceMcF <agila61@netscape.net> - 2012-07-16 19:59 -0700
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-16 17:04 -1000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-17 06:51 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-16 21:39 -1000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-17 07:48 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-16 22:24 -1000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-17 10:48 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-17 08:19 -1000
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-18 01:31 +0400
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-19 16:11 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-19 12:41 -1000
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-21 01:24 +0400
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-20 16:20 -1000
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-21 03:59 -0700
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-21 21:33 -1000
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-22 01:35 -0700
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-22 21:19 +0400
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-22 08:15 -1000
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-22 11:48 -0700
Re: Quotations revisited Coos Haak <chforth@hccnet.nl> - 2012-07-22 21:48 +0200
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-22 15:22 -0500
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-22 14:50 -0700
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-22 15:08 -0700
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-22 15:20 -0700
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-23 03:29 +0400
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-22 14:22 -1000
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-23 05:46 +0400
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-22 21:46 -1000
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-25 03:31 +0400
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-23 16:50 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-23 07:57 -1000
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-25 03:38 +0400
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-26 13:01 +0000
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-21 12:10 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-21 09:19 -0500
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-21 18:58 +0200
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-22 04:24 -0500
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-22 14:25 +0200
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-22 11:11 -0500
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-21 19:29 +0000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-23 16:31 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-23 12:21 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-23 17:32 +0000
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-23 11:23 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-24 03:28 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-25 13:15 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-25 11:47 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-26 13:06 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-26 09:50 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-26 15:11 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-26 11:06 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-26 16:46 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-27 04:52 -0500
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-26 09:48 -0700
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-27 14:51 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-28 08:29 -0500
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-29 20:55 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-30 04:40 -0500
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-31 23:46 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-08-01 04:30 -0500
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-23 16:17 +0000
Re: Quotations revisited "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-07-22 18:41 -0400
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-23 16:53 +0000
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-17 12:22 +0000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-17 07:30 -0500
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-17 06:34 -0700
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-17 09:04 -0500
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-18 07:07 -0700
Re: Quotations revisited Coos Haak <chforth@hccnet.nl> - 2012-07-18 17:43 +0200
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-18 09:29 -0700
Re: Quotations revisited Coos Haak <chforth@hccnet.nl> - 2012-07-18 20:59 +0200
Re: Quotations revisited Coos Haak <chforth@hccnet.nl> - 2012-07-18 21:14 +0200
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-19 16:05 +0000
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-20 14:50 +0000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-20 15:08 +0000
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-21 11:27 +0000
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-23 16:28 +0000
Re: Quotations revisited Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-23 19:41 +0000
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-18 10:18 -0700
Re: Quotations revisited anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-19 17:00 +0000
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-19 15:34 -0700
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-19 16:08 -0700
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-17 20:09 +0200
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-16 12:01 +0000
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-16 10:42 -0700
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-16 18:06 +0000
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-16 11:08 -1000
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-16 21:38 +0000
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-17 00:29 +0200
Re: Quotations revisited "Elizabeth D. Rather" <erather@forth.com> - 2012-07-16 12:38 -1000
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-17 04:20 -0500
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-17 03:21 -0700
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-17 03:14 -0700
Re: Quotations revisited Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-17 19:58 +0200
Re: Quotations revisited Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-17 13:05 -0500
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-20 11:12 +0000
Re: Quotations revisited Alex McDonald <blog@rivadpm.com> - 2012-07-20 05:40 -0700
Re: Quotations revisited stephenXXX@mpeforth.com (Stephen Pelc) - 2012-07-20 15:55 +0000
Re: Quotations revisited Paul Rubin <no.email@nospam.invalid> - 2012-07-22 20:54 -0700
Re: Quotations revisited Aleksej Saushev <asau@inbox.ru> - 2012-07-25 03:55 +0400
Page 4 of 8 — ← Prev page 1 2 3 [4] 5 6 7 8 Next page →
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-16 17:04 -1000 |
| Message-ID | <G9Odner46_fHS5nNnZ2dnUVZ_rednZ2d@supernews.com> |
| In reply to | #14096 |
On 7/16/12 4:59 PM, BruceMcF wrote: ... > : foo [: set-up bar clean-up ;] CATCH ; > ... may be more useful, if the error handling following the CATCH is also included. That's the first example I've seen that actually makes a little sense (assuming, of course, that the error handling code follows). Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2012-07-17 06:51 +0000 |
| Message-ID | <2012Jul17.085127@mips.complang.tuwien.ac.at> |
| In reply to | #14097 |
"Elizabeth D. Rather" <erather@forth.com> writes:
>On 7/16/12 4:59 PM, BruceMcF wrote:
>...
>> : foo [: set-up bar clean-up ;] CATCH ;
>> ... may be more useful, if the error handling following the CATCH is also included.
>
>That's the first example I've seen that actually makes a little sense
>(assuming, of course, that the error handling code follows).
I posted such an example already in 2009 (with slightly different syntax):
|Date: Tue, 27 Oct 2009 12:02:10 GMT
|Message-ID: <2009Oct27.130210@mips.complang.tuwien.ac.at>
...
|Here's one example I have: Reusable code often needs CATCH to ensure
|that all exits from a word go through some common cleanup code. CATCH
|takes an xt, and in Forth-94 that often leads to adding a helper
|definition, e.g.:
|
|: hex.-helper ( u -- )
| hex u. ;
|
|: hex. ( u -- )
| base @ >r
| ['] hex.-helper catch
| r> base ! throw ;
|
|With :[ ... ]; (or similar syntax) we can put the helper definition
|right where it is used, and don't need to name it:
|
|: hex. ( u -- )
| base @ >r
| :[ hex u. ]; catch
| r> base ! throw ;
|
|Shorter, and IMO easier to read.
Concerning "Names are useful": That's not the case for HEX.-HELPER
here, as indicated by the actual name. Having that name is just an
artifact of not having quotations.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2012: http://www.euroforth.org/ef12/
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-16 21:39 -1000 |
| Message-ID | <LNWdnUnT1pUqi5jNnZ2dnUVZ_tOdnZ2d@supernews.com> |
| In reply to | #14098 |
On 7/16/12 8:51 PM, Anton Ertl wrote: > "Elizabeth D. Rather" <erather@forth.com> writes: >> On 7/16/12 4:59 PM, BruceMcF wrote: >> ... >>> : foo [: set-up bar clean-up ;] CATCH ; >>> ... may be more useful, if the error handling following the CATCH is also included. >> >> That's the first example I've seen that actually makes a little sense >> (assuming, of course, that the error handling code follows). > > I posted such an example already in 2009 (with slightly different syntax): > > |Date: Tue, 27 Oct 2009 12:02:10 GMT > |Message-ID: <2009Oct27.130210@mips.complang.tuwien.ac.at> > ... > |Here's one example I have: Reusable code often needs CATCH to ensure > |that all exits from a word go through some common cleanup code. CATCH > |takes an xt, and in Forth-94 that often leads to adding a helper > |definition, e.g.: > | > |: hex.-helper ( u -- ) > | hex u. ; > | > |: hex. ( u -- ) > | base @ >r > | ['] hex.-helper catch > | r> base ! throw ; > | > |With :[ ... ]; (or similar syntax) we can put the helper definition > |right where it is used, and don't need to name it: > | > |: hex. ( u -- ) > | base @ >r > | :[ hex u. ]; catch > | r> base ! throw ; > | > |Shorter, and IMO easier to read. > > Concerning "Names are useful": That's not the case for HEX.-HELPER > here, as indicated by the actual name. Having that name is just an > artifact of not having quotations. Less useful, IMO, because H. has been around in a lot of systems, including Open Firmware, for a long time, defined simply as: : H. ( n -- ) BASE @ HEX U. BASE ! ; No need for CATCH/THROW or funny business. Bruce's example at least had the virtue of suggesting a scenario that would be reasonably one-time code, and hence not worth making into a separate definition. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2012-07-17 07:48 +0000 |
| Message-ID | <2012Jul17.094834@mips.complang.tuwien.ac.at> |
| In reply to | #14099 |
"Elizabeth D. Rather" <erather@forth.com> writes:
>On 7/16/12 8:51 PM, Anton Ertl wrote:
>> |: hex. ( u -- )
>> | base @ >r
>> | :[ hex u. ]; catch
>> | r> base ! throw ;
>> |
>> |Shorter, and IMO easier to read.
...
>Less useful, IMO, because H. has been around in a lot of systems,
>including Open Firmware, for a long time, defined simply as:
>
>: H. ( n -- ) BASE @ HEX U. BASE ! ;
That prints the base in hex, if everything works fine. I guess you
mean:
: H. ( n -- ) BASE @ HEX swap U. BASE ! ;
>No need for CATCH/THROW or funny business.
But if somebody types Ctrl-C (user interrupt) while U. is working,
BASE is not restored. That's why the CATCH/THROW is in HEX.
There is still a short window of vulnerability between CATCH and !,
but that's the best we can do in standard Forth. Gforth has a feature
for that, and this feature and other ideas are discussed in:
@InProceedings{ertl08euroforth,
author = {M. Anton Ertl},
title = {Cleaning up After Yourself},
crossref = {euroforth08},
pages = {35--38},
url = {http://www.complang.tuwien.ac.at/anton/euroforth/ef08/papers/ertl.pdf},
psurl = {http://www.complang.tuwien.ac.at/papers/ertl08euroforth.ps.gz},
OPTnote = {not refereed},
abstract = {Performing cleanup actions such as restoring a
variable or closing a file used to be impossible to
guarantee in Forth before Forth-94 gave us
\code{catch}. Even with \code{catch}, the cleanup
code can be skipped due to user interrupts if you
are unlucky. We introduce a construct that
guarantees that the cleanup code is always
completed. We also discuss a cheaper implementation
approach for cleanup code than using a full
exception frame.}
}
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2012: http://www.euroforth.org/ef12/
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-16 22:24 -1000 |
| Message-ID | <0b-dnV4aqvPZvJjNnZ2dnUVZ_s-dnZ2d@supernews.com> |
| In reply to | #14100 |
On 7/16/12 9:48 PM, Anton Ertl wrote: > "Elizabeth D. Rather" <erather@forth.com> writes: >> On 7/16/12 8:51 PM, Anton Ertl wrote: >>> |: hex. ( u -- ) >>> | base @ >r >>> | :[ hex u. ]; catch >>> | r> base ! throw ; >>> | >>> |Shorter, and IMO easier to read. > ... >> Less useful, IMO, because H. has been around in a lot of systems, >> including Open Firmware, for a long time, defined simply as: >> >> : H. ( n -- ) BASE @ HEX U. BASE ! ; > > That prints the base in hex, if everything works fine. I guess you > mean: > > : H. ( n -- ) BASE @ HEX swap U. BASE ! ; Oops! Of course. Too late at night, here! >> No need for CATCH/THROW or funny business. > > But if somebody types Ctrl-C (user interrupt) while U. is working, > BASE is not restored. That's why the CATCH/THROW is in HEX. Really, pretty hard to do. Have you ever succeeded? Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2012-07-17 10:48 +0000 |
| Message-ID | <2012Jul17.124835@mips.complang.tuwien.ac.at> |
| In reply to | #14101 |
"Elizabeth D. Rather" <erather@forth.com> writes:
>> But if somebody types Ctrl-C (user interrupt) while U. is working,
>> BASE is not restored. That's why the CATCH/THROW is in HEX.
>
>Really, pretty hard to do. Have you ever succeeded?
: H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok
: test decimal 1000000 0 do i h. loop ; ok
test
...
4FEF2 4FEF3 4FEF4 4FEF5 4FEF6 4FEF7 4FEF8 4FEF9
:3: User interrupt
>>>test<<<
Backtrace:
$7FFFF69F1E70 write-file
$7FFFF69F2C68 type
$7FFFF69F2DE0 ud.r
$7FFFF69F2E90 ud.
$7FFFF6A44338 u.
$7FFFF6A443D0 H.
$501A4
$F4240
base @ decimal . 16 ok
First try.
You can see in the backtrace where the user interrupt happened.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2012: http://www.euroforth.org/ef12/
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-17 08:19 -1000 |
| Message-ID | <eeCdnbmbGZ4jMZjNnZ2dnUVZ_sidnZ2d@supernews.com> |
| In reply to | #14107 |
On 7/17/12 12:48 AM, Anton Ertl wrote: > "Elizabeth D. Rather" <erather@forth.com> writes: >>> But if somebody types Ctrl-C (user interrupt) while U. is working, >>> BASE is not restored. That's why the CATCH/THROW is in HEX. >> >> Really, pretty hard to do. Have you ever succeeded? > > : H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok > : test decimal 1000000 0 do i h. loop ; ok > test > ... > 4FEF2 4FEF3 4FEF4 4FEF5 4FEF6 4FEF7 4FEF8 4FEF9 > :3: User interrupt >>>> test<<< > Backtrace: > $7FFFF69F1E70 write-file > $7FFFF69F2C68 type > $7FFFF69F2DE0 ud.r > $7FFFF69F2E90 ud. > $7FFFF6A44338 u. > $7FFFF6A443D0 H. > $501A4 > $F4240 > base @ decimal . 16 ok > > First try. > > You can see in the backtrace where the user interrupt happened. That's a pathological example because of the massively iterated short loop. H. isn't used that way in real-world code. I have no problem with your putting in unnecessary CATCHes, just with inventing obscure structures in order to do so. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | Aleksej Saushev <asau@inbox.ru> |
|---|---|
| Date | 2012-07-18 01:31 +0400 |
| Message-ID | <87k3y23why.fsf@inbox.ru> |
| In reply to | #14126 |
"Elizabeth D. Rather" <erather@forth.com> writes: > On 7/17/12 12:48 AM, Anton Ertl wrote: >> "Elizabeth D. Rather" <erather@forth.com> writes: >>>> But if somebody types Ctrl-C (user interrupt) while U. is working, >>>> BASE is not restored. That's why the CATCH/THROW is in HEX. >>> >>> Really, pretty hard to do. Have you ever succeeded? >> >> : H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok >> : test decimal 1000000 0 do i h. loop ; ok >> test >> ... >> 4FEF2 4FEF3 4FEF4 4FEF5 4FEF6 4FEF7 4FEF8 4FEF9 >> :3: User interrupt >>>>> test<<< >> Backtrace: >> $7FFFF69F1E70 write-file >> $7FFFF69F2C68 type >> $7FFFF69F2DE0 ud.r >> $7FFFF69F2E90 ud. >> $7FFFF6A44338 u. >> $7FFFF6A443D0 H. >> $501A4 >> $F4240 >> base @ decimal . 16 ok >> >> First try. >> >> You can see in the backtrace where the user interrupt happened. > > That's a pathological example because of the massively iterated > short loop. H. isn't used that way in real-world code. > > I have no problem with your putting in unnecessary CATCHes, just > with inventing obscure structures in order to do so. Thus, if I dump a big memory region with the "h." above or with a loop enclosed into "base @ hex ... base !", will that be "pathological" too? -- HE CE3OH...
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2012-07-19 16:11 +0000 |
| Message-ID | <2012Jul19.181131@mips.complang.tuwien.ac.at> |
| In reply to | #14126 |
"Elizabeth D. Rather" <erather@forth.com> writes:
>On 7/17/12 12:48 AM, Anton Ertl wrote:
>> "Elizabeth D. Rather" <erather@forth.com> writes:
>>>> But if somebody types Ctrl-C (user interrupt) while U. is working,
>>>> BASE is not restored. That's why the CATCH/THROW is in HEX.
>>>
>>> Really, pretty hard to do. Have you ever succeeded?
>>
>> : H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok
>> : test decimal 1000000 0 do i h. loop ; ok
>> test
...
>That's a pathological example because of the massively iterated short
>loop. H. isn't used that way in real-world code.
You may consider I/O-bound code pathological, but it is not at all
unusual in the real world. A simple example is DUMP. I would hope
that this unsafe H. is not used in real-world code, but I fear that it
is.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2012: http://www.euroforth.org/ef12/
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-19 12:41 -1000 |
| Message-ID | <G9OdnXW-v6GXEJXNnZ2dnUVZ_qydnZ2d@supernews.com> |
| In reply to | #14183 |
On 7/19/12 6:11 AM, Anton Ertl wrote: > "Elizabeth D. Rather" <erather@forth.com> writes: >> On 7/17/12 12:48 AM, Anton Ertl wrote: >>> "Elizabeth D. Rather" <erather@forth.com> writes: >>>>> But if somebody types Ctrl-C (user interrupt) while U. is working, >>>>> BASE is not restored. That's why the CATCH/THROW is in HEX. >>>> >>>> Really, pretty hard to do. Have you ever succeeded? >>> >>> : H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok >>> : test decimal 1000000 0 do i h. loop ; ok >>> test > ... >> That's a pathological example because of the massively iterated short >> loop. H. isn't used that way in real-world code. > > You may consider I/O-bound code pathological, but it is not at all > unusual in the real world. A simple example is DUMP. I would hope > that this unsafe H. is not used in real-world code, but I fear that it > is. Most implementations of DUMP I know of are interruptible but not by trapping H. A more appropriate strategy is with a KEY? in the loop, maybe once/line. Likewise anything else capable of generating a lot of output. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | Aleksej Saushev <asau@inbox.ru> |
|---|---|
| Date | 2012-07-21 01:24 +0400 |
| Message-ID | <87liiet9be.fsf@inbox.ru> |
| In reply to | #14188 |
"Elizabeth D. Rather" <erather@forth.com> writes: > On 7/19/12 6:11 AM, Anton Ertl wrote: >> "Elizabeth D. Rather" <erather@forth.com> writes: >>> On 7/17/12 12:48 AM, Anton Ertl wrote: >>>> "Elizabeth D. Rather" <erather@forth.com> writes: >>>>>> But if somebody types Ctrl-C (user interrupt) while U. is working, >>>>>> BASE is not restored. That's why the CATCH/THROW is in HEX. >>>>> >>>>> Really, pretty hard to do. Have you ever succeeded? >>>> >>>> : H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok >>>> : test decimal 1000000 0 do i h. loop ; ok >>>> test >> ... >>> That's a pathological example because of the massively iterated short >>> loop. H. isn't used that way in real-world code. >> >> You may consider I/O-bound code pathological, but it is not at all >> unusual in the real world. A simple example is DUMP. I would hope >> that this unsafe H. is not used in real-world code, but I fear that it >> is. > > Most implementations of DUMP I know of are interruptible but not > by trapping H. A more appropriate strategy is with a KEY? in the > loop, maybe once/line. Likewise anything else capable of > generating a lot of output. Do you mean that there're no other ways to interrupt program than by writing it so that it constantly polls for some event? -- HE CE3OH...
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-20 16:20 -1000 |
| Message-ID | <cpydnX_9HJlBjJfNnZ2dnUVZ_vednZ2d@supernews.com> |
| In reply to | #14230 |
On 7/20/12 11:24 AM, Aleksej Saushev wrote: > "Elizabeth D. Rather" <erather@forth.com> writes: > >> On 7/19/12 6:11 AM, Anton Ertl wrote: >>> "Elizabeth D. Rather" <erather@forth.com> writes: >>>> On 7/17/12 12:48 AM, Anton Ertl wrote: >>>>> "Elizabeth D. Rather" <erather@forth.com> writes: >>>>>>> But if somebody types Ctrl-C (user interrupt) while U. is working, >>>>>>> BASE is not restored. That's why the CATCH/THROW is in HEX. >>>>>> >>>>>> Really, pretty hard to do. Have you ever succeeded? >>>>> >>>>> : H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok >>>>> : test decimal 1000000 0 do i h. loop ; ok >>>>> test >>> ... >>>> That's a pathological example because of the massively iterated short >>>> loop. H. isn't used that way in real-world code. >>> >>> You may consider I/O-bound code pathological, but it is not at all >>> unusual in the real world. A simple example is DUMP. I would hope >>> that this unsafe H. is not used in real-world code, but I fear that it >>> is. >> >> Most implementations of DUMP I know of are interruptible but not >> by trapping H. A more appropriate strategy is with a KEY? in the >> loop, maybe once/line. Likewise anything else capable of >> generating a lot of output. > > Do you mean that there're no other ways to interrupt program than by > writing it so that it constantly polls for some event? It's the cleanest to implement and has fewest side-effects. The cost of a KEY? per line out output is pretty minimal, a lot less than a CATCH around every H. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | Alex McDonald <blog@rivadpm.com> |
|---|---|
| Date | 2012-07-21 03:59 -0700 |
| Message-ID | <30fdf529-6c73-49d7-8fdc-f02271e33ebc@g5g2000yqg.googlegroups.com> |
| In reply to | #14235 |
On Jul 21, 3:20 am, "Elizabeth D. Rather" <erat...@forth.com> wrote: > On 7/20/12 11:24 AM, Aleksej Saushev wrote: > > > > > > > > > > > "Elizabeth D. Rather" <erat...@forth.com> writes: > > >> On 7/19/12 6:11 AM, Anton Ertl wrote: > >>> "Elizabeth D. Rather" <erat...@forth.com> writes: > >>>> On 7/17/12 12:48 AM, Anton Ertl wrote: > >>>>> "Elizabeth D. Rather" <erat...@forth.com> writes: > >>>>>>> But if somebody types Ctrl-C (user interrupt) while U. is working, > >>>>>>> BASE is not restored. That's why the CATCH/THROW is in HEX. > > >>>>>> Really, pretty hard to do. Have you ever succeeded? > > >>>>> : H. ( n -- ) BASE @ HEX swap U. BASE ! ; ok > >>>>> : test decimal 1000000 0 do i h. loop ; ok > >>>>> test > >>> ... > >>>> That's a pathological example because of the massively iterated short > >>>> loop. H. isn't used that way in real-world code. > > >>> You may consider I/O-bound code pathological, but it is not at all > >>> unusual in the real world. A simple example is DUMP. I would hope > >>> that this unsafe H. is not used in real-world code, but I fear that it > >>> is. > > >> Most implementations of DUMP I know of are interruptible but not > >> by trapping H. A more appropriate strategy is with a KEY? in the > >> loop, maybe once/line. Likewise anything else capable of > >> generating a lot of output. > > > Do you mean that there're no other ways to interrupt program than by > > writing it so that it constantly polls for some event? > > It's the cleanest to implement and has fewest side-effects. The cost of > a KEY? per line out output is pretty minimal, a lot less than a CATCH > around every H. > > Cheers, > Elizabeth > > -- > ================================================== > Elizabeth D. Rather (US & Canada) 800-55-FORTH > FORTH Inc. +1 310.999.6784 > 5959 West Century Blvd. Suite 700 > Los Angeles, CA 90045http://www.forth.com > > "Forth-based products and Services for real-time > applications since 1973." > ================================================== In many hosted Forths, the executed instruction cost of KEY? per line will be much higher than a CATCH per H.; a call to the OS, context switching and stream management at the cost of several thousand instructions per KEY? is not minimal.
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-21 21:33 -1000 |
| Message-ID | <--idnS0grfwsMZbNnZ2dnUVZ_qednZ2d@supernews.com> |
| In reply to | #14242 |
On 7/21/12 12:59 AM, Alex McDonald wrote: > On Jul 21, 3:20 am, "Elizabeth D. Rather" <erat...@forth.com> wrote: >> On 7/20/12 11:24 AM, Aleksej Saushev wrote: ... >>>> Most implementations of DUMP I know of are interruptible but not >>>> by trapping H. A more appropriate strategy is with a KEY? in the >>>> loop, maybe once/line. Likewise anything else capable of >>>> generating a lot of output. >> >>> Do you mean that there're no other ways to interrupt program than by >>> writing it so that it constantly polls for some event? >> >> It's the cleanest to implement and has fewest side-effects. The cost of >> a KEY? per line out output is pretty minimal, a lot less than a CATCH >> around every H. > > In many hosted Forths, the executed instruction cost of KEY? per line > will be much higher than a CATCH per H.; a call to the OS, context > switching and stream management at the cost of several thousand > instructions per KEY? is not minimal. In my experience, a keystroke is captured by an interrupt which records the keyboard event. It does not take either an I/O operation nor an OS call to inquire whether an event has occurred, merely a check of a memory location. Thereupon code can obtain the key if it cares, but often you're just interested in the existence of the event. Very cheap. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | Alex McDonald <blog@rivadpm.com> |
|---|---|
| Date | 2012-07-22 01:35 -0700 |
| Message-ID | <80f29a71-6f7c-4057-ace1-06919430b8e6@a16g2000vby.googlegroups.com> |
| In reply to | #14260 |
On Jul 22, 8:33 am, "Elizabeth D. Rather" <erat...@forth.com> wrote: > On 7/21/12 12:59 AM, Alex McDonald wrote: > > > > > > > > > > > On Jul 21, 3:20 am, "Elizabeth D. Rather" <erat...@forth.com> wrote: > >> On 7/20/12 11:24 AM, Aleksej Saushev wrote: > ... > >>>> Most implementations of DUMP I know of are interruptible but not > >>>> by trapping H. A more appropriate strategy is with a KEY? in the > >>>> loop, maybe once/line. Likewise anything else capable of > >>>> generating a lot of output. > > >>> Do you mean that there're no other ways to interrupt program than by > >>> writing it so that it constantly polls for some event? > > >> It's the cleanest to implement and has fewest side-effects. The cost of > >> a KEY? per line out output is pretty minimal, a lot less than a CATCH > >> around every H. > > > In many hosted Forths, the executed instruction cost of KEY? per line > > will be much higher than a CATCH per H.; a call to the OS, context > > switching and stream management at the cost of several thousand > > instructions per KEY? is not minimal. > > In my experience, a keystroke is captured by an interrupt which records > the keyboard event. It does not take either an I/O operation nor an OS > call to inquire whether an event has occurred, merely a check of a > memory location. Thereupon code can obtain the key if it cares, but > often you're just interested in the existence of the event. Very cheap. > Ah, how times have changed... > Cheers, > Elizabeth > > -- > ================================================== > Elizabeth D. Rather (US & Canada) 800-55-FORTH > FORTH Inc. +1 310.999.6784 > 5959 West Century Blvd. Suite 700 > Los Angeles, CA 90045http://www.forth.com > > "Forth-based products and Services for real-time > applications since 1973." > ==================================================
[toc] | [prev] | [next] | [standalone]
| From | Aleksej Saushev <asau@inbox.ru> |
|---|---|
| Date | 2012-07-22 21:19 +0400 |
| Message-ID | <871uk3r9vk.fsf@inbox.ru> |
| In reply to | #14260 |
"Elizabeth D. Rather" <erather@forth.com> writes: > On 7/21/12 12:59 AM, Alex McDonald wrote: >> On Jul 21, 3:20 am, "Elizabeth D. Rather" <erat...@forth.com> wrote: >>> On 7/20/12 11:24 AM, Aleksej Saushev wrote: > ... >>>>> Most implementations of DUMP I know of are interruptible but not >>>>> by trapping H. A more appropriate strategy is with a KEY? in the >>>>> loop, maybe once/line. Likewise anything else capable of >>>>> generating a lot of output. >>> >>>> Do you mean that there're no other ways to interrupt program than by >>>> writing it so that it constantly polls for some event? >>> >>> It's the cleanest to implement and has fewest side-effects. The cost of >>> a KEY? per line out output is pretty minimal, a lot less than a CATCH >>> around every H. >> >> In many hosted Forths, the executed instruction cost of KEY? per line >> will be much higher than a CATCH per H.; a call to the OS, context >> switching and stream management at the cost of several thousand >> instructions per KEY? is not minimal. > > In my experience, a keystroke is captured by an interrupt which > records the keyboard event. It does not take either an I/O > operation nor an OS call to inquire whether an event has > occurred, merely a check of a memory location. Thereupon code > can obtain the key if it cares, but often you're just interested > in the existence of the event. Very cheap. Not at all! You have to write the polling code everywhere you know it can be interrupted. You need to track all those places too. With "catch" you write all that code only once. Now compare the price. -- HE CE3OH...
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-07-22 08:15 -1000 |
| Message-ID | <7vydnY5PU6bD3pHNnZ2dnUVZ_sSdnZ2d@supernews.com> |
| In reply to | #14270 |
On 7/22/12 7:19 AM, Aleksej Saushev wrote: > "Elizabeth D. Rather" <erather@forth.com> writes: > >> On 7/21/12 12:59 AM, Alex McDonald wrote: >>> On Jul 21, 3:20 am, "Elizabeth D. Rather" <erat...@forth.com> wrote: >>>> On 7/20/12 11:24 AM, Aleksej Saushev wrote: >> ... >>>>>> Most implementations of DUMP I know of are interruptible but not >>>>>> by trapping H. A more appropriate strategy is with a KEY? in the >>>>>> loop, maybe once/line. Likewise anything else capable of >>>>>> generating a lot of output. >>>> >>>>> Do you mean that there're no other ways to interrupt program than by >>>>> writing it so that it constantly polls for some event? >>>> >>>> It's the cleanest to implement and has fewest side-effects. The cost of >>>> a KEY? per line out output is pretty minimal, a lot less than a CATCH >>>> around every H. >>> >>> In many hosted Forths, the executed instruction cost of KEY? per line >>> will be much higher than a CATCH per H.; a call to the OS, context >>> switching and stream management at the cost of several thousand >>> instructions per KEY? is not minimal. >> >> In my experience, a keystroke is captured by an interrupt which >> records the keyboard event. It does not take either an I/O >> operation nor an OS call to inquire whether an event has >> occurred, merely a check of a memory location. Thereupon code >> can obtain the key if it cares, but often you're just interested >> in the existence of the event. Very cheap. > > Not at all! You have to write the polling code everywhere you know > it can be interrupted. You need to track all those places too. > With "catch" you write all that code only once. Now compare the price. No, a keyboard interrupt handler is a single instance of code that responds to an event. It doesn't poll. And putting CATCH around something as tiny as H. implies you have to sprinkle them in every word that does output. Ugh. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2012-07-22 11:48 -0700 |
| Message-ID | <7x394jr5ss.fsf@ruckus.brouhaha.com> |
| In reply to | #14274 |
"Elizabeth D. Rather" <erather@forth.com> writes: > And putting CATCH around something as tiny as H. implies you have to > sprinkle them in every word that does output. Ugh. It looks to me like the problem with H. is the statefulness of BASE and the way that H. mucks around with it. You wouldn't need CATCH given a number printing routine that takes its base as a stack arg.
[toc] | [prev] | [next] | [standalone]
| From | Coos Haak <chforth@hccnet.nl> |
|---|---|
| Date | 2012-07-22 21:48 +0200 |
| Message-ID | <p6yfrnt2shl5.1gn56nb8ouen5$.dlg@40tude.net> |
| In reply to | #14276 |
Op Sun, 22 Jul 2012 11:48:03 -0700 schreef Paul Rubin: > "Elizabeth D. Rather" <erather@forth.com> writes: >> And putting CATCH around something as tiny as H. implies you have to >> sprinkle them in every word that does output. Ugh. > > It looks to me like the problem with H. is the statefulness of BASE and > the way that H. mucks around with it. You wouldn't need CATCH given a > number printing routine that takes its base as a stack arg. Words like # and #S rely on the value in BASE. It would be a burden to rewrite every word containing # and #S for every base. At least three times for every binary, decimal and hexadecimal. And some FigForth users may want to use base 36 variants too. -- Coos CHForth, 16 bit DOS applications http://home.hccnet.nl/j.j.haak/forth.html
[toc] | [prev] | [next] | [standalone]
| From | Andrew Haley <andrew29@littlepinkcloud.invalid> |
|---|---|
| Date | 2012-07-22 15:22 -0500 |
| Message-ID | <m_6dnRnAieuI_JHNnZ2dnUVZ8rKdnZ2d@supernews.com> |
| In reply to | #14276 |
Paul Rubin <no.email@nospam.invalid> wrote: > "Elizabeth D. Rather" <erather@forth.com> writes: >> And putting CATCH around something as tiny as H. implies you have to >> sprinkle them in every word that does output. Ugh. > > It looks to me like the problem with H. is the statefulness of BASE > and the way that H. mucks around with it. You wouldn't need CATCH > given a number printing routine that takes its base as a stack arg. This is true, but having to pass BASE to all numeric conversion words would be very awkward. For example, think about a word like DUMP; you could have a version that is passed a base, or you could have HDUMP and DDUMP. In practice it's really nice to be able to say HEX and work in hex for a while. It is very much nicer for interaction than, say, GDB, where you have to specify the (non-decimal) BASE every time you print a variable. Andrew.
[toc] | [prev] | [next] | [standalone]
Page 4 of 8 — ← Prev page 1 2 3 [4] 5 6 7 8 Next page →
Back to top | Article view | comp.lang.forth
csiph-web