Perl 5.20.1版发布

[复制链接]
查看11 | 回复2 | 2014-2-19 11:55:14 | 显示全部楼层 |阅读模式
Perl 5.20.1 发布了,如果你从 5.18.0 升级,请先阅读 perl5200delta, 因为这里描述了 5.18 和 5.20 之间的区别。该版本与 5.20.0 版本没有什么不兼容的改变,如果有的话,那一定是 bug。
性能方面的提升:
An optimization to avoid problems with COW and deliberately overallocated PVs has been disabled because it interfered with another, more important, optimization, causing a slowdown on some platforms. [perl #121975]
Returning a string from a lexical variable could be slow in some cases. This has now been fixed. [perl #121977]

回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
下载: http://www.perl.org/get.html
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
5.20的新特性很多,比如:
Experimental Subroutine signatures
Declarative syntax to unwrap argument list into lexical variables. sub foo ($a,$b) {...} checks the number of arguments and puts the arguments into lexical variables. Signatures are not equivalent to the existing idiom of sub foo { my($a,$b) = @_; ... }. Signatures are only available by enabling a non-default feature, and generate warnings about being experimental. The syntactic clash with prototypes is managed by disabling the short prototype syntax when signatures are enabled.
See "Signatures" in perlsub for details.
subs now take a prototype attribute
When declaring or defining a sub, the prototype can now be specified inside of a prototype attribute instead of in parens following the name.
For example, sub foo($$){} could be rewritten as sub foo : prototype($$){}.
More consistent prototype parsing
Multiple semicolons in subroutine prototypes have long been tolerated and treated as a single semicolon. There was one case where this did not happen. A subroutine whose prototype begins with "*" or ";*" can affect whether a bareword is considered a method name or sub call. This now applies also to ";;;*".
Whitespace has long been allowed inside subroutine prototypes, so sub( $ $ ) is equivalent to sub($$), but until now it was stripped when the subroutine was parsed. Hence, whitespace was not allowed in prototypes set by Scalar::Util::set_prototype. Now it is permitted, and the parser no longer strips whitespace. This means prototype &mysub returns the original prototype, whitespace and all.
rand now uses a consistent random number generator
Previously perl would use a platform specific random number generator, varying between the libc rand(), random() or drand48().
This meant that the quality of perl's random numbers would vary from platform to platform, from the 15 bits of rand() on Windows to 48-bits on POSIX platforms such as Linux with drand48().
Perl now uses its own internal drand48() implementation on all platforms. This does not make perl's rand cryptographically secure. [perl #115928]
New slice syntax
The new %hash{...} and %array[...] syntax returns a list of key/value (or index/value) pairs. See "Key/Value Hash Slices" in perldata.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行