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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Levels of code in Forth programming (2002)

163 点作者 pointfree将近 6 年前

11 条评论

elcritch将近 6 年前
Intriguing article. Just updated some Forth code for interfacing with an ADC on a sensor I’m building. Dealing with SPI&#x2F;I2C and sensors&#x2F;adc’s in Forth really is fantastic. The results in much more succinct hardware code IMHO than C or even higher level languages. Really Chuck Moore seems spot on when dealing with specific hardware.<p>One example is a simple Forth word (macro) to convert 3 bytes into one 32 bit number integrates well into code for dealing with an adc chip.<p>However I wouldn’t want to write while applications in Forth as dealing with stack swaps becomes annoying. Still writing your own Forth is pretty fun too. I did mine by basing C compiler XMacros which made porting to an Itsy M4 trivial (about 3-4 of work) [1].<p>Still there’s a few Forth’s for Arduino’s, Itsy’s, ESP’s [2] which are really fun as they enable repl style interactive programming with hardware while still being blindingly fast!<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;elcritch&#x2F;forthwith" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;elcritch&#x2F;forthwith</a> 2: <a href="https:&#x2F;&#x2F;github.com&#x2F;zeroflag&#x2F;punyforth" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zeroflag&#x2F;punyforth</a>
haolez将近 6 年前
Forth is pretty amazing. It really delivers on that old promise of “a language that will make you a better programmer in other languages”.<p>However, from my experience, since there is basically no syntax, all Forth programs tend to be a DSL for the problem at hand. It’s almost like having to learn a new language ok each new project. It’s like a complete opposite of what makes Go great.
评论 #20551295 未加载
评论 #20552003 未加载
评论 #20557088 未加载
评论 #20552488 未加载
codr7将近 6 年前
Before I learned Forth, I was very comfortable in Common Lisp. Now I miss the convenience when writing Forth and raw simplicity when writing Lisp.<p>I realize the problem isn&#x27;t Forth, some people (such as the writer for example) are capable of pulling amazing feats for such a primitive tool.<p>But as a result, the programming languages [0] I&#x27;ve designed since have all been part Forth and part Common Lisp.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;codr7&#x2F;cidk" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;codr7&#x2F;cidk</a>
theamk将近 6 年前
&gt; Portability is not possible. Real applications are closely coupled to hardware. Change the platform and all the code changes<p>Some lessons simply did not age well.... Even in world of today&#x27;s microcontrollers, which often have kilobytes of RAM and very different CPU styles, people still write mostly hardware abstracted code.
评论 #20553218 未加载
评论 #20554328 未加载
评论 #20551481 未加载
bcherny将近 6 年前
This is a really interesting read, and as someone who’s almost exclusively programmed in high level languages, this approach seems alien to me.<p>A couple of questions:<p>1. Is it possible to write complex, modern applications (things like browsers, photo editors, etc. — things that would take millions of lines of Java or JS) using this style of programming?<p>2. What is “sourceless programming”? Where is a good place to learn more about it?
评论 #20551719 未加载
评论 #20554743 未加载
wwweston将近 6 年前
&gt;I was also researching AI in Forth, implementing ideas from LISP examples and doing expert systems and neural nets and mixing them and building robots. In the software I added a layer for an inference engine for English language descriptions of rule sets and a layer for the rules. I wrote a learning email report and conversation engine AI program and had it running for a few months. My boss could not distinguish it from me. That was my idea of AI, smart enough to do my job for me and get paid at my salary while I took a vacation.<p>Is the author exaggerating here, or did they actually succeed at writing something that could pass whatever Turing test level his boss could offer?<p>If it&#x27;s the latter, what then-current knowledge would they likely have sourced?
评论 #20553034 未加载
评论 #20552347 未加载
jwilliams将近 6 年前
Eons ago as an embedded programmer I came to respect Forth. I encountered numerous situations where using Forth led to a much smaller footprint (size in particular) -- Why? For exactly the reasons that Chuck Moore espouses here; you are writing a purpose-built VM from the hardware up.<p>Even then I don&#x27;t agree that portability&#x2F;abstraction isn&#x27;t important - it&#x27;s got the potential to be an extremely reductionist position. Instead I&#x27;d argue it&#x27;s incredibly expensive and should be treated as such.
评论 #20555348 未加载
stallmanite将近 6 年前
This is really captivating. I think I’m inspired to finally dust off my of TI-Forth for the 99&#x2F;4a
MrEldritch将近 6 年前
Chuck Moore has always struck me as some kind of alien, not unlike the way stories about Von Neumann do - that this is a person who is, in his specialized field, capable of thinking in ways that I just can&#x27;t, and achieving things that seem practically magical with it.
评论 #20564724 未加载
pilmihilmipilmi将近 6 年前
Does anybody know what Chuck Moore does right now? I was following a while his posts on patent lawsuite but then he went quite.
nine_k将近 6 年前
To sum up Chuck Moore&#x27;s quotations: you write code that takes all of the machine, and you got to write all of the code. If you have this, you can squash out all abstraction and build the ideal solution directly.<p>This may hold true for small-scale hardware like controllers. They have a well-defined set of tasks, small enough to fit in your head.<p>This means that you have a certain trouble sharing the code with your colleagues, making the bus factor of your project closer to 1, and lowering the usefulness of code reviews.<p>This means that you have trouble sharing code with yourself in your next project.<p>You become tightly coupled do the machine. This is, on one hand, liberating, you can do anything easily. But this is also limiting, because you spend your mental resources on optimizing for this particular machine.<p>I personally think that deep optimization is something that the machine should do, they are better than humans at this most of the time. And humans should do want machines currently can&#x27;t.
评论 #20551776 未加载
评论 #20552938 未加载