我的意思是,是否有编码语言与人类风格编码?例如:
Create an object called MyVar and initialize it to 10;
Take MyVar and call MyMethod() with parameters. . .
Run Code Online (Sandbox Code Playgroud)
我知道它不是那么有用,但创建这样的语法会很有趣.
Pau*_*xon 120
LOLCODE怎么样?
HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
Run Code Online (Sandbox Code Playgroud)
简单本身!
Jam*_*ran 104
COBOL很像那样.
SET MYVAR TO 10.
EXECUTE MYMETHOD with 10, MYVAR.
Run Code Online (Sandbox Code Playgroud)
维基百科的另一个样本:
ADD YEARS TO AGE.
MULTIPLY PRICE BY QUANTITY GIVING COST.
SUBTRACT DISCOUNT FROM COST GIVING FINAL-COST.
Run Code Online (Sandbox Code Playgroud)
奇怪的是,尽管它的设计可以像英语一样可读,但大多数程序员完全用奇怪的命名约定来破坏它:
SET VAR_00_MYVAR_PIC99 TO 10.
EXECUTE PROC_10_MYMETHOD with 10, VAR_00_MYVAR_PIC99.
Run Code Online (Sandbox Code Playgroud)
tov*_*are 98
Inform 7也许是我觉得最适合用人类语言设计的语言.它非常适用于编写冒险游戏.
它基于基于规则的语义,您可以编写大量描述对象与其位置之间关系的规则.例如,以下部分是Inform 7程序:
"Hello Deductible" by "I.F. Author"
The story headline is "An Interactive Example".
The Living Room is a room. "A comfortably furnished living room."
The Kitchen is north of the Living Room.
The Front Door is south of the Living Room.
The Front Door is a door. The Front Door is closed and locked.
The insurance salesman is a man in the Living Room. The description is "An insurance salesman in a tacky polyester suit. He seems eager to speak to you." Understand "man" as the insurance salesman.
A briefcase is carried by the insurance salesman. The description is "A slightly worn, black briefcase." Understand "case" as the briefcase.
The insurance paperwork is in the briefcase. The description is "Page after page of small legalese." Understand "papers" or "documents" or "forms" as the paperwork.
Instead of listening to the insurance salesman:
say "The salesman bores you with a discussion of life insurance policies. From his briefcase he pulls some paperwork which he hands to you.";
move the insurance paperwork to the player.
Run Code Online (Sandbox Code Playgroud)
Chr*_*rra 42
AppleScript非常接近,尽管这显然取决于平台.
这是打开iTunes和播放播放列表的脚本
tell application "iTunes"
activate
play playlist "Party Shuffle"
end tell
Run Code Online (Sandbox Code Playgroud)
Cru*_*han 31
这是20世纪80年代早期的"下一件大事",我在前几年花了很多时间作为一名在"自然"中工作的编码员,这被认为是新一代4GL(第四代语言)中最好的一种.旨在使数据访问(在本例中为ADABAS数据库)人类可读.
当然它完全没有类型.我们最终得到的只是冗长的结构化代码.这两种产品仍然存在,但你从来没有听说过它们,这证明了它的死胡同.
实际上在那个时期似乎有一种普遍的愿望,即超越"编程",进入某种2001年启发的AI天堂.Oracle非常热衷于代码生成,我还记得一些名为"最后一个"的产品,该产品作为一种产品销售给管理者,可自动生成您想要的任何程序,并使您的所有编程人员都多余.似乎没有达到预期;-)
值得记住的是,SQL最初在某些方面上市,作为一种允许管理层直接查询其数据的方法.我甚至被派去学习基本的SQL课程(在一个大型的国家运输组织,在轨道上运行 - 钢铁品种),其中包括初级管理类型,因为他们计划将基本查询工具放在他们手中.真是个灾难.
也许它可能在50年内有所不同,但在目前的游戏编码阶段需要一定的思想和实现清晰度,最好通过为这些目的设计的专用语法来调解,而不是对自然语言的任何近似,这是不清楚和模棱两可的.最接近的近似可能是物理学,其中主题的本质在于所使用的数学(认为是物理学的编程语言)而不是冗长的词汇.
添加
我忘记了,除了COBOL之外还有PL/1,有时因为允许美国宇航局把一个人放在月球上,它就像COBOL一样冗长,并且更加努力地成为"经理可读".这就是为什么现在没人真正听说过:-)
Mau*_*fer 18
Ingredients.
72 g haricot beans
101 eggs
108 g lard
111 cups oil
32 zucchinis
119 ml water
114 g red salmon
100 g dijon mustard
33 potatoes
Method.
Put potatoes into the mixing bowl. Put dijon mustard into the mixing bowl.
Put lard into the mixing bowl. Put red salmon into the mixing bowl. Put oil into the mixing bowl.
Put water into the mixing bowl. Put zucchinis into the mixing bowl. Put oil into the mixing bowl.
Put lard into the mixing bowl. Put lard into the mixing bowl. Put eggs into the mixing bowl.
Put haricot beans into the mixing bowl. Liquefy contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.
Run Code Online (Sandbox Code Playgroud)
对不起,如果这不是一个严肃的答案,但这是非常棒的.:-)
Rob*_*ker 15
让编程语言像(详细的)普通语言一样,就像要求人们在法律术语中一直交谈一样.所有额外的措辞都会妨碍你.
理想的编程语言应该具有尽可能透明的语法,并让程序背后的概念脱颖而出.显然,在快速学习曲线和具有最小但模糊的语法(想想Perl,甚至K)之间存在折衷.
b3.*_*b3. 13
通过创建一组规则,可以像这样在Prolog中进行逻辑编程.您可以为特定域构建语法(或下载一个),创建知识库然后进行查询.定义语法后,您可以执行以下操作:
bob is a parent of tim.
mary is a parent of bob.
?- X is a grandparent of tim.
X = mary
?- jim is a parent of bob.
false
Run Code Online (Sandbox Code Playgroud)
tell application "Finder"
set the percent_free to ¬
(((the free space of the startup disk) / (the capacity of the startup disk)) * 100) div 1
end tell
if the percent_free is less than 10 then
tell application (path to frontmost application as text)
display dialog "The startup disk has only " & the percent_free & ¬
" percent of its capacity available." & return & return & ¬
"Should this script continue?" with icon 1
end tell
end if
Run Code Online (Sandbox Code Playgroud)
我可以阅读C.这意味着它是人类可读的(因为我是一个人).这对普通人来说太简洁了.编程语言的一般概念是最大化有关计算机应如何在给定行中操作的信息.
这就是Ruby如此受欢迎的原因; 它最大限度地减少了文本中的功能.英语(或任何其他自然语言)是一种非常不精确,低信息/字符的语言.
总而言之,它是:(i)之前完成的和(ii)已知的较弱的想法.
这实际上是一个热门话题.
对于初学者 - 什么是人类可读?
中国读者不能读俄语,反之亦然.你缩小你的域名,例如中国药剂师写一个你可以围绕它设计一种语言的描述.这将是人类可读的.
如语言属于Domain Specific Languages的范畴.
SQL
SELECT name, address FROM customers WHERE region = 'Europe'
Run Code Online (Sandbox Code Playgroud)
Perl,有些人声称.
print "hello!" and open my $File, '<', $path or die "Couldn't open the file after saying hello!";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14457 次 |
| 最近记录: |