- 求职 : 软件工程师
- 论坛徽章:
- 3
|
本帖最后由 104359176 于 2015-04-27 18:17 编辑
今天遇到一篇文章,说一个程序员如何从 Python 转到 Perl 6 语言的过程。
day-17-of-a-new-contributor
估计大家许多人看不到:
Before my involvement with Perl 6 I mostly used Python. However beautiful and flexible Python is, I worked on a project where it was a poor fit and writing proper test code was exceptionally uncomfortable. Thus, I often made mistakes – misused my data structures, passed values of incorrect types to methods – that I felt the language should be able to detect early without sacrificing flexibility. The "gradual typing" approach of Perl 6 sounded like a very good fit to me.
Having a friend show me bits and pieces of Perl 6 quickly led to looking at the Advent Calendar last year. I also joined the IRC channel and asked a whole bunch of questions. Not having done any Perl 5 programming before made figuring out the nooks and crannies of Perl 6 syntax a bit harder than I would have liked, especially when using the Perl 6 book. Fortunately, the IRC channel was always active and eager to help.
After having learnt a bit more about Perl 6, I quickly started helping out here and there. In part because I've already enjoyed doing that for PyPy – which is implemented in a subset of Python, much like Rakudo is implemented in NQP – but also because I kept hitting little problems and bugs.
主要原因是因为动态语言的通病:没有类型限定, 很多细小的问题很难被发现,项目一大,就抓瞎了。
Perl 6 的类型限定:- my Int $num = 1;
- my Str $str = 'str';
- sub check-args(Int $x, Str $y) { ... }
复制代码 |
|