TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Forth & stack machines

70 点作者 ahalan超过 13 年前

5 条评论

thristian超过 13 年前
A while ago I came across Factor¹, which calls itself "a practical stack language"; it has the same basic (lack of) syntax as Forth, but has a Common Lisp-inspired object system, garbage collection, and a standard library whose scope resembles Python's.<p>I haven't actually written anything in it yet.<p>Partially, it's because of work-flow issues - Factor doesn't lend itself to hacking on source-trees outside the Factor source tree, and I'm not sure how I'd set up a single-button "run all the tests" command, for example. Partially it's an issue of finding the right project - being a new language and a new paradigm, I'd want to start off with something simple, but not so simple that I'd be tempted to dash off a half-dozen lines of Python and move on.<p>A good chunk of it, however, is because of articles like this one (in fact, probably this very article I read on Hacker News some months ago) that make me despair of ever making code that will be as simple and efficient as the code-samples I've seen — the Python community calls Python code that goes with the grain of the language as "Pythonic"; I'm not sure what Factor's equivalent adjective would be ("Factorial"?).<p>¹: <a href="http://factorcode.org/" rel="nofollow">http://factorcode.org/</a>
评论 #2986446 未加载
wollw超过 13 年前
Ever since encountering OpenFirmware on the old PPC Macs I've been interested in Forth but I've only started playing around with it recently (I actually just put amforth on an ATMega328P this afternoon). It's really pretty interesting to use as it forces me to really program in a different way than usual. Most languages allow me, to put it one way, to break to "rules" of the language (ie: programming imperatively in a functional language) but using Forth really means having to learn to solve problems a new way.<p>In the case of running Forth on an AVR it also has the benefit of being able to program interactively on the actual hardware instead of having to flash and reflash every time I want to change something. Very pleasant.
评论 #2987461 未加载
_delirium超过 13 年前
I thought this part captured it nicely:<p><i>Forth is not the language. [...] Forth is the approach to engineering aiming to produce as small, simple and optimal system as possible, by shaving off as many requirements of every imaginable kind as you can.</i><p>I actually quite like that approach, though like the author of this post I'm not sure how well it could be applied within the context of a larger company with requirements that you don't fully control.
stcredzero超过 13 年前
<i>The requirement for “real world work” is almost by definition incompatible with “the freedom to change the language, the compiler, the OS and the hardware design”.</i><p>If "the hardware design" really means the VM for a VM based language, then I have known people who accomplished great things in their real world work by changing the "hardware design." There is a difference between changing such things willy-nilly because you can versus doing pragmatic and smart things because it makes things simpler and faster.<p><i>The Forth way of focusing on just the problem you need to solve seems to more or less require that the same person or a very tightly united group focus on all three of these things, and pick the right algorithms, the right computer architecture, the right language, the right word size, etc. I don’t know how to make this work.</i><p>A group that can make that work -- sounds like the sort of startup that PG would like to fund.
pointyhat超过 13 年前
Very interesting article although I think it shows a bit of confusion. The person is also rather inexperienced both with his approach to the problem he was solving and the outcome. I would have probably used a commercial DSP looking at the workload.<p>Looking at Forth, it's a thing of beauty. It's just simple. That is all that can be said. In a lot of circumstances, it will do the job admirably. People tend to forget that the majority of computers out there still aren't desktop PCs, servers, mobile devices etc. Surveying my house quickly, they are tiny things in washing machines, cookers, fire alarms, traffic signals, process controllers, lighting, microwave ovens, calculators, children's toys, televisions, dishwashers, scales, cd players etc. There are literally billions of the things all doing tiny tasks constantly 24/7. Forth fits there nicely if you ask me :)