Bugzilla:Languages: Difference between revisions

Jump to navigation Jump to search
(→‎PHP Cons: We don't care about WxWidgets. PHP Docs have always been fine when I used them. No worse than docs for any other language. Security argument will have to be more specific.)
Line 65: Line 65:
=== Cons ===
=== Cons ===


* See [http://avatraxiom.livejournal.com/58084.html The Problems of Perl].
* Private Methods aren't well supported require additional scaffolding.
* Private Methods aren't well supported require additional scaffolding.
* Multiple Inheritance can be problematic in extreme edge cases.
* Multiple Inheritance can be problematic in extreme edge cases.
* Certain elements of syntax can be confusing for new users, by long experience in training new Perl users:
* Some people without prior programming experience can find Perl syntax confusing
** The difference between () and [].
** The fact that %var is a () (which is also the array notation) but {} is $var.
** The fact that subroutine arguments aren't really subroutine arguments, they're just an array that gets passed to a function. (This also brings up confusion on the difference between using $_[1], my $var = shift, and my ($var) = @_.)
** The fact that $hash{'key'} and $hash{key} are the same.
** qq[] is a string (as is qq{}, etc.), q[] is a string, though qw() is an array.
** &sub() is resolved at runtime but sub() is resolved at compile time, ''except'' for methods.
** The conversions from one type to another can sometimes be horrendous to read. Eg: [keys %{ @{ $var } }].
** $$foo[1] and $foo->[1] mean the same thing.
** That numbers are compared with "==" but strings are compared with "eq", even though in other places strings are interpreted as numbers if used numerically.
** Figuring out what's $1, $2, $3, etc. from a regex result. And the fact that $1 and $2 don't get reset if there's no match.
*** Perl 5.10 will have named captures.
** That Perl errors are in $@ but system errors are in $!, and when to use which one.
** That Perl doesn't really have a class system, it just has a package system with @ISA or "use base," "bless," and SUPER::.
** That "my ($var) = @_" will get you the first item of the array, but "my $var = @_" will get you a number.
** In a hash created with (), if you accidentally have invalid items, you have an invalid hash. That is, you can't really do %hash = (key1 => $cgi->param('unset_param'), key2 => 'something'), because then you'll actually just have an invalid hash. (key1 will equal "key2" and "something" won't even have a real value.) In general it's safer to always make hashrefs when in doubt.
** In array context, $cgi->param('value') returns an ''empty list'' if "value" wasn't passed to the CGI. It doesn't return undef. This is why we have "scalar $cgi->param()" all over the code.


== Perl6 ==
== Perl6 ==
21

edits

Navigation menu