Thu, 22 Jun 2006
Perl6 syntax
I have just came across the Perl6 Synopsis, so I wanted to see where the Perl development is heading to. I must say, I think moving to Perl6 would be a horrible task. I still did not read everything, but so far it seems some design decisions are a bit weird for me:
- Single dot (".") instead of an arrow ("->") as a dereference operator. While it is not bad per se (several languages like Ruby or C use it), I think the arrow is more readable (because it is wider, it provides better visual delimitation).
- Long dot (the "object\ .method()" construct). It is visually awful (as backslash is usually associated with string interpolation or escaping special characters). Whitespaces in Perl6 will be more involved as a part of syntax than in Perl5. I think the significant whitespace is a domain of Python, but now it is also in Perl6. I think introducing the long dot into the Perl6 syntax is probably connected with having to use dot as a dereference operator instead of an arrow.
- Mixed-case words (such as builtin type names, but I have seen this in other contexts in the Synopsis documents as well). IThinkThisIsAJavaWayOfDoingThings, WhichIsClearlyUnreadable. DefinitelyLessReadableThan underline_delimited_identifiers.
- Native versus object types (at least they have autoboxing). Having to distinguish between int and Int data types is not Do What I Mean. I think the main purpose of scripting languages is that the programmer does not need to think about (obvious) type conversions. Is it another try to sneak Java drawbacks^Wfeatures into Perl?
That said, there are definitely positive aspects of Perl6 as well - for example the ability to use any Unicode pair characters as comment or regex delimiters (for example the Japanese corner quotes in: "qr「match」"). But I think for me the above problems mean that I would have to stick with Perl5 as long as possible, or I would have to lear another language, which would have worse (or smaller) libraries than Perl has (Ruby), or which has even more annoying syntax (Python, the No-oneliners-please language).
1 replies for this story:
Milan Zamazal wrote:
I don't like Python (because of its ad hoc design), but its syntax is much better than Perl's one. When I tried to learn Perl I had to give up, partially because I had got lost in its syntax before I finished learning the language. This didn't happen to me with any of the ~20 other programming languages I've tried to learn so far. One may or may not like Python's syntax (I don't like it, it's about as stupid as in most other programming languages). But no-oneliners and strict indentation are no problem in any non-trivial programs, because you should write the code in a similar style anyway, in any programming language. The important thing is that Python programs are, unlike Perl programs, basically readable without much training. And that matters a lot. Reading your description of Perl6 syntax changes, I don't think you lose so much, it's simply still the worst syntax I've ever seen :-). BTW, I agree MixedCase identifiers are evil, but you can cope with them using the glasses-mode in Emacs if you'd like :-).