为什么有这么多“魔法"?在 Perl 中? [英] Why is there so much "magic" in Perl?

查看:66
本文介绍了为什么有这么多“魔法"?在 Perl 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

浏览 perlsubperlop 联机帮助页 我注意到那里有很多对magic"和magical"的引用(只需在其中搜索magic"即可).我想知道为什么 Perl 对它们如此丰富.

Looking through the perlsub and perlop manpages I've noticed that there are many references to "magic" and "magical" there (just search any of them for "magic"). I wonder why is Perl so rich in them.

一些例子:

print ++($foo = 'zz')            # prints 'aaa'       
printf "%d: %s", $! = 1, $!      # prints '1: Operation not permitted'
while (my $line = <FH>) { ... }  # $line is tested for definedness, not truth
use warnings; print "0 but true" + 1  # "0 but true" is a valid number!

推荐答案

当 Perl 功能被描述为神奇"时:

When a Perl feature is described as "magic":

这意味着该功能是由 NBA 球星魔术师约翰逊实施.每当 Perl 执行魔法"时,它是实际上发送一个 RPC 调用到一个植入魔法的遥控接收器他自己.他计算出答案,然后然后发送返回消息.使用约翰逊先生的所有困难部分Perl 提供了一个很好的抽象层并简化移植到新的平台.这比说容易得多Apache 便携式运行时.

It means that that feature is implemented by NBA star Magic Johnson. Whenever Perl executes "magic", it is actually sending an RPC call to a remote receiver implanted in Magic himself. He computes the answer, and then sends a return message. The use of Mr. Johnson for all the hard parts of Perl provides a great abstraction layer and simplifies porting to new platforms. It's way easier than, say, the Apache Portable Runtime.

来源:perrin on Perl Monks

这是官方的!Perl 更神奇.

It's official! Perl is more magical.

来自以下 Google 搜索的点击:

Hits from the following Google searches:

 25  site:ruby-doc.org     magic
 36  site:docs.python.org  magic
497  site:perldoc.perl.org magic

这篇关于为什么有这么多“魔法"?在 Perl 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆