微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Ruby提供了相当于Perl的严格使用吗?

我的意思是,Ruby中没有我的.我发现在Perl中使用严格来提供非常好的反错字保护.

解决方法

The strict pragma does three things in Perl. Two of the items are to
forbid the use of symbolic references and “barewords.” Ruby doesn’t
support these features,so it’s not an issue.

The other feature of the strict pragma is to avoid creating random
global variables every time one is mentioned. In Ruby,globals look
different from other variables (the leading $),so this is not really
a problem. Local variables need to be assigned to before use,since
that’s Ruby’s method of declaration. That solves the same problem
the strict pragma handles for Perl.

资料来源:https://groups.google.com/forum/?fromgroups#!topic/ruby-talk-google/PiRnWplvGDw

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐