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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Joy (Programming Language)

98 点作者 reedwolf大约 5 年前

11 条评论

nivertech大约 5 年前
It&#x27;s a functional programming language where every function is of type stack -&gt; stack.<p>I like concatenative languages[1] and especially pipelines[2], but IMO Forth-like stack-oriented languages are in the wrong direction, b&#x2F;c they force programmer to manipulate arguments on a stack, which feels hackish.<p>And my first real physical computer was an RPN calculator. As a kid I wrote lots of programs for it.<p>Also b&#x2F;c of their simple implementation, Forth-s and stack-based VMs are frequently used in the wrong domains, i.e. Bitcoin&#x27;s Scripts and Ethereum&#x27;s EVM.<p>APL-family languages are better in this regard, but they also feel hackish in the general case, especially when passing arguments to nested functions. Copying RTL-style from math notation is also wrong. You are typing LTR (at least in English), but the expressions are evaluated RTL. Here Forth, RPN, and UNIX pipelines got it right.<p>The interesting direction would be a programming language with following attributes:<p><pre><code> - Purely-functional - Statically typed with an algebraic type system - Concatenative [1] - Tacit &#x2F; Pipelines [2] - Homoiconic - top-to-bottom, LTR </code></pre> [1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Concatenative_programming_language" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Concatenative_programming_lang...</a><p>[2] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Tacit_programming" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Tacit_programming</a>
评论 #23051129 未加载
评论 #23052430 未加载
评论 #23053254 未加载
评论 #23052703 未加载
toolslive大约 5 年前
Joy is great (at least better than SQL) as an API to a database. IE, every query is a joy program. If you add get, set and (de)serialize as primitives, you have stored procedures, intermediate results, galore! Want to transform your result before you send it back to the client ? no problem, just add a transformer function.
评论 #23051544 未加载
reedwolf大约 5 年前
Example from C2[0]:<p><pre><code> (* x y percent approxEqual *) DEFINE approxEqual == 100.0 &#x2F; rotate [0 =] [pop] [dup rolldown - swap &#x2F;] ifte &gt; </code></pre> [0] <a href="https:&#x2F;&#x2F;wiki.c2.com&#x2F;?JoyLanguage" rel="nofollow">https:&#x2F;&#x2F;wiki.c2.com&#x2F;?JoyLanguage</a>
vincnetas大约 5 年前
&quot;In Joy, everything is a function that takes a stack as an argument and returns a stack as a result. &quot;<p>But formal parameters are same things[1]. It&#x27;s just a values pushed to stack before calling a function and values poped from stack on return. That&#x27;s why you get stackoverflow exceptions in java when your recursion fails.<p>EDIT: [1]most of the time, in situations that i know about.
评论 #23050412 未加载
carapace大约 5 年前
I&#x27;ve been working with Joy for several years now, on an off, in a hobbyist way, and I&#x27;ve got to say, I think it&#x27;s the most useful, simplest language.<p>(I&#x27;ve made implementations in Python and Prolog <a href="https:&#x2F;&#x2F;joypy.osdn.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;joypy.osdn.io&#x2F;</a> )
Gormisdomai大约 5 年前
The coolest part of this article imo is the binrec operator. Do other languages have something similar?
amelius大约 5 年前
From many viewpoints a stack is a nuisance, for example memory management and context switching. Therefore I think that languages which use a stack are going in the wrong direction.
kalium-xyz大约 5 年前
Michelson language has distinctly ruined my taste for language like this.
co_dh大约 5 年前
The point of Forth&#x2F;Joy is that the language is so simple, you don&#x27;t need compiler. It is a minimum language.
jayp1418大约 5 年前
I still find ada language more advanced than current ones
评论 #23049962 未加载
评论 #23050196 未加载
评论 #23050127 未加载
ngcc_hk大约 5 年前
Very confusing as just have another Joy web framework. For this kind of new language, one may have to have a kind of FAQ for the reason why it exists at all. Why not just FORTH?
评论 #23050125 未加载
评论 #23050054 未加载
评论 #23050195 未加载
评论 #23050205 未加载