Deutsch English Français Italiano |
<v8bfr8$15ubb$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Stephen Pelc <stephen@vfxforth.com> Newsgroups: comp.lang.forth Subject: Re: Operator overloading? Date: Tue, 30 Jul 2024 19:44:40 -0000 (UTC) Organization: A noiseless patient Spider Lines: 44 Message-ID: <v8bfr8$15ubb$1@dont-email.me> References: <a1aab44ee3b1b56c2f54f2606e98d040@www.novabbs.com> <v8b04c$137lg$1@dont-email.me> <b181be5d4e6c9abd8ed22606ab2dfb91@www.novabbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=fixed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 30 Jul 2024 21:44:40 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d156e83f38ca0bbf57136bc03458ff1c"; logging-data="1243499"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//w9Udfj/IVicLCBe46Lbm" User-Agent: Usenapp for MacOS Cancel-Lock: sha1:cQ5jGvM3OkTqlDjuYBCs8ggff54= X-Usenapp: v1.27.4/l - Full License Bytes: 2693 On 30 Jul 2024 at 19:55:55 BST, "minforth" <minforth> wrote: > On Tue, 30 Jul 2024 15:16:28 +0000, Stephen Pelc wrote: >> The standard suggests/specifies that operators such as TO behave as if >> they parse. Ignore that for the moment and define >> >> variable operator >> >> : to 1 operator ! ; immediate >> >> A child of VALUE is probably an immediate word that inspects OPERATOR >> and compiles the fetch action if 0 or the store action if 1. This scheme >> can >> be extended to support a wide range of operators, such as +TO INCR DECR >> and so on. MPE has used this scheme for several decades with no tech >> support issues. If you really want to to be fussy and avoid the use of >> the >> "as if" rule for parsing, you can do something like (untested) the below >> for TO. But why bother? >> >> : to >> 1 operator ! ' execute >> ; immediate > > Thank you. So instead of wasting time on parsing during compilation- or > interpretation time, the runtime action of an xVALUE (even when > compiled) > involves to walk a type-specific operator chain (a large CASE construct > in VFX). This makes them slower when compiled, but why not. The CASE statements are walked at compile time and so can produce fully optimised code. Just download a VFX Forth, read the source code, and disassemble the results. Stephen -- Stephen Pelc, stephen@vfxforth.com MicroProcessor Engineering, Ltd. - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)78 0390 3612, +34 649 662 974 http://www.mpeforth.com MPE website http://www.vfxforth.com/downloads/VfxCommunity/ downloads