Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: how can forth compete with lisp Date: Sat, 13 Aug 2016 13:58:14 -0700 Organization: A noiseless patient Spider Lines: 49 Message-ID: <87vaz4wfmh.fsf@jester.gateway.pace.com> References: <8ceb459d-85bb-4a4d-9cbb-e8ea85c64b45@googlegroups.com> <404bf9e4-2072-490e-adff-aaeb520783ec@googlegroups.com> <8ffa1e5c-b93d-43d4-8ce2-eed3f9c879ee@googlegroups.com> <0f2cd827-39f2-48c3-ab03-ed5d19572256@googlegroups.com> <244a8d6e-5869-4ca0-948e-d4655c9ed3cc@googlegroups.com> <87ziogwj8v.fsf@jester.gateway.pace.com> <5c20ee17-759c-4f3e-be43-87a9335f750f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="afb9df5a762ad8974cbd7e506bdf03a5"; logging-data="8528"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TAek4eHhAth0UlMskoowW" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:+lX/FtdEPXAzCHh4h3XmSZU4hMs= sha1:SDOPFyUXlG8z59feG2WQ97VofOw= Xref: csiph.com comp.lang.forth:50070 JUERGEN writes: > In another thread I started, I tried to find a basic Forth under > MicroPython I sort of remember that, but I don't see any point in implementing Forth in Python. The idea of Forth is to get an interactive language from very little machine resources, that is capable of realtime operation, and is pretty fast for an interpreted language and that can also be made very fast with an optimizing compiler. The cost of this is quite a bit of programmer inconvenience in dealing with the stack, memory management, lack of compiler and runtime automatic error checking, etc. Python has lots of such conveniences, but the cost is that it's much slower than Forth, uses much more memory, is not realtime (uses automatic storage reclamation or garbage collection), etc. By implementing Forth in Python, you get both the inconvenience and the high resource consumption and slow speed. > Having this in MicroPython should allow to have a complete GFORTH run > under MicroPython. Gforth is written in C and you have to compile it with a C compiler. Python doesn't come into it. In principle you could write a Forth in Python but there's little to be gained from that. > How effective - is it fast enough to play with is my question? MicroPython is more than fast enough to play with. Maybe it's 10x slower than Forth on the same hardware. On the other hand, current hardware at least 100x faster than the 1980s computers from Forth's heyday, so if you're used to running Forth on those, Python will seem 10x faster, if that makes any sense. If you implemented Forth in Python straightforwardly, maybe you'd get a 10x slowdown, so you're back to the original speed of Forth on old computers. If you type "Maple Mini" into ebay, you should see lots of cheap boards (like 5 euros or less) with the old Leaf design, which is a Cortex M3 with 128k of flash and 20k of ram, at something like 80 mhz. That should be enough to run small Micropython programs, though you probably want more ram for bigger programs. The Micropython PyBoard is much nicer and comes with Micropython already installed, though it's fairly expensive (45 USD over here). You can play with one online, typing Micropython commands into your browser to watch the board control a servo and some leds: http://micropython.org/live/