加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

为什么在Perl中最后一个叫’last’?

发布时间:2020-12-15 21:12:04 所属栏目:大数据 来源:网络整理
导读:最后一个被称为Perl的历史原因是什么,而不是在C中被打破? Perl的设计受到C(除了awk,sed和sh-下面的手册页)的影响之外,所以一定有一些推理背后不熟悉的C风格命名的break / last. 从Perl 1.000(1987年12月18日发布)手册页的一点历史: [Perl] combines (in th
最后一个被称为Perl的历史原因是什么,而不是在C中被打破?

Perl的设计受到C(除了awk,sed和sh-下面的手册页)的影响之外,所以一定有一些推理背后不熟悉的C风格命名的break / last.

从Perl 1.000(1987年12月18日发布)手册页的一点历史:

[Perl] combines (in the author’s opinion,anyway) some of the best features of C,sed,awk,and sh,so people familiar with those languages should have little difficulty with it. (Language historians will also note some vestiges of csh,Pascal,and even BASIC|PLUS.)

解决方法

The semantics of ‘break’ or ‘last’ are
defined by the language (in this case
Perl),not by you.

Why not think of ‘last’ as “this is
the last statement to run for the
loop”.

It’s always struck me as odd that the
‘continue’ statement in ‘C’ starts the
next pass of a loop. This is
definitely a strange use of the
concept of “continue”. But it is the
semantics of ‘C’,so I accept it.

By trying to map particular
programming concepts into single
English words with existing meaning
there is always going to be some sort
of mismatching oddity

Source

另外,拉里·沃尔也有点奇怪.你看过他的照片吗?

Larry Wall http://www.wired.com/images/article/full/2007/12/larry_wall_250px.jpg

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读