编程语言的新的或不太知名的范式、语法特征和行为?

发布于 2024-08-29 02:10:11 字数 299 浏览 10 评论 0原文

我为它们设计了一些教育编程语言和解释器,但我的问题始终是它们最终变得“正常”和“无聊”,大多类似于某种现有语言(ASM 和 BASIC)。

我发现很难对语法特性、“巧妙的东西”以及新的或经过很大修改的编程范例提出新的想法。 我一直认为在这种情况下很难想出好的新东西,而不是有趣/无用的新东西。

我想知道你是否可以帮助我发挥你的创造力:

  • 语言语法方面有什么特点和内置函数,甚至可能是新的范式,我可以将其融入到我的语言中,使其保持无用,但更有趣、令人愉快、有趣和/或与编程不同吗?

I've designed some educational programming languages and interpreters for them, but my problem always was that they ended up "normal" and "boring", mostly similar to some kind of existing language (ASM and BASIC).

I find it really hard to come up with new ideas for syntax features, "neat things" and new or very modified programming paradigms for it. I always thought that it was hard to come up with good new things not fun/useless new things for this case.

I wondered if you could help me out with your creativity:

  • What features in terms of language syntax and built-in functions as well as maybe even new paradigms can I work into my language to keep it useless but more fun, enjoyable, interesting and/or different to program in?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

冷情妓 2024-09-05 02:10:11

我一直认为很难想出好的新东西

你是对的。这就是为什么约翰·巴克斯、肯·艾弗森、尼克劳斯·沃斯、罗宾·米尔纳、克里斯汀·尼加德、奥勒-约翰·达尔、艾伦·凯和芭芭拉·利斯科夫都赢得了图灵奖——他们为编程语言的设计贡献了很好的新思想。

如果您想为自己的设计增添一点兴趣,这些都是值得借鉴的优秀人士。

I always thought that it was hard to come up with good new things

You were right. This is why John Backus, Ken Iverson, Niklaus Wirth, Robin Milner, Kristen Nygaard and Ole-Johan Dahl, Alan Kay, and Barbara Liskov all won Turing Awards—they contributed good new ideas to the design of programming languages.

If you want to add a dash of interest to your own designs, these are excellent people to steal from.

旧街凉风 2024-09-05 02:10:11

ASM 和 BASIC 都是命令式语言,因此您可能需要考虑函数式编程语言的功能,尤其是 lambda 和映射。您可能还想考虑有趣的控制流,例如,能够抛出异常,然后,由于捕获异常并进行特​​定调用,从抛出异常的点恢复(尽管使用修改环境)。此外,协同例程或其他形式的语言级并行性通常也很有趣。

Both ASM and BASIC are imperative languages, so you might want to consider features of functional programming languages, especially lambdas and maps. You might also want to consider interesting flows of control, for example, being able to throw an exception and then later, as a result of catching the exception and making a certain call, resume from the point that the exception was thrown (albeit using a modified environment). Also, co-routines, or other forms of language-level parallelism are often interesting.

泪冰清 2024-09-05 02:10:11

除了 Michael 对函数式语言的评论之外,还可以看看闭包和块(就像它们在 Objective-C 中所做的那样)。这些使您可以将函数或代码片段视为可以传递并按需调用的一流对象。可以用它来做一些很酷的事情,而且它也正在成为大规模多核系统编程的范例。

您还可以研究柯里化,这意味着绑定函数的一些参数,这样您就可以在更少的参数上使用它。这样,您可以创建一个以 b 为底的对数函数,您可以柯里化该函数来创建以 2、10 为底等对数的函数。

还有一些不太实用的东西(如语言):看看 Ruby 将所有事物视为对象(甚至数字)的方式,您可以用它做很多事情。就像具有内省功能的面向对象运行时、“免费”解释器等。实现 OOP 东西比您想象的要容易。

过去 30 多年里已经做了很多事情,不要把自己局限于 70 年代风格的编程! ;) 如果您正在寻找灵感,请查看 Ruby、Python、Scala、Objective-C、JavaScript(阅读 Douglas Crockford 的 JavaScript:The Good Parts)等。

In addition to Michael's comment on functional languages, look at closures and blocks (like they're done in Objective-C). Those let you treat functions or pieces of code as first-class objects that you can pass around and call on demand. Some cool stuff can be done with that, and it's also shaping up to becoming the paradigm for programming massively multi-core systems.

You could also look into currying, which means binding some of a function's parameters, so you can then use it on fewer arguments. That way, you could create a base-b logarithm function, which you could curry to create functions for the base-2, base-10, etc. logarithm.

And something less functional (as in language): look at Ruby's way of treating everything as an object (even numbers), you can do quite a bit with that. Like an object-oriented runtime with introspection, an interpreter "for free," etc. Implementing OOP stuff is easier than you'd think.

A lot of stuff has been done in the last 30-odd years, don't restrict yourself to 70s-style programming! ;) If you're looking for inspiration, check out Ruby, Python, Scala, Objective-C, JavaScript (read Douglas Crockford's JavaScript: The Good Parts), etc.

南风起 2024-09-05 02:10:11

Esolang wiki 提供了各种深奥编程语言的怪异和精彩的一个很好的示例,包括许多用户创作。也许其中蕴藏着一些理智的灵感。

The Esolang wiki gives a good sample of the weirds and wonderfuls of all kinds of esoteric programming languages, including many user creations. Perhaps some inspiration for something sane lies therein.

三岁铭 2024-09-05 02:10:11

看看福斯。这是原创的东西。太原创了。

look at Forth. It is something original. Too original.

断肠人 2024-09-05 02:10:11

intercal 有很多不寻常的语言功能 B-)

intercal has plenty of unusual language features B-)

漆黑的白昼 2024-09-05 02:10:11

我一直认为将 CSP 应用于基于堆栈的语言会很巧妙。可能会变得很有趣。

I've always thought it would be neat to apply CSP to a stack based language. Could get pretty interesting.

与酒说心事 2024-09-05 02:10:11

请参阅维基百科:编程语言。有许多有用的链接,特别是在 分类法 部分。

很多“新”实际上只是“被遗忘的旧”。我将保留对当今一些“流行”编程语言的看法。

See Wikipedia: Programming Languages. There are many useful links, especially in the Taxonomies section.

So much of the "new" is really just "forgotten old". I will hold my thoughts on some of the "popular" programming languages of the day.

说不完的你爱 2024-09-05 02:10:11

有很多事情可以探索,并且正在对其中一些进行积极的研究。我认为有用的一些东西是:

  • 非函数式语言中的真正延续
  • 允许用户创建新语法元素的语言
    • FORTH 和 J 可能是起点。
    • Pogoscript 也很有趣,因为可以在用户代码中创建 if/elseif/else 和 while/wend arten'tspecial 等流程控制结构。
    • 自定义用户定义的运算符实际上并不新鲜:我认为 Haskell、Nemerle、Kaleidscope 和其他几个已经这样做了,但即使那样也不会“无聊”

There are many things that could be explored and active research is being done on some of them. Some of the things I think would be useful are:

  • real continuations in a non-functional language
  • languages that let the user create new syntax elements
    • FORTH and J might be starting points.
    • Pogoscript is interesting as well because flow control constructs like if/elseif/else and while/wend arten't special can be created in user code.
    • custom user defined operators actually aren't new: I think Haskell, Nemerle, Kaleidoscope and several others already do this but even that wouldn't be "boring"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文