News for hackers. Stuff that matters.
Re: How I learnt to love Perl by thwarted on Sunday December 07, 2008 @03:37PM (#389098)
I'm not sure that example, which doesn't do what it looks like it might do, supports your argument. Because

   sub foo {
     my($bar, @baz, %quux) = @_
Is just another way to declare your types:

   void foo(int bar, void *baz[], hash_t quux) { ...
Or in your untyped, dynamic language du jour with my bastardized Hungarian Notation:

   sub foo(Ibar, Abaz, Hquux) ...
However, as you point out, that syntax doesn't work because non-scalars need to be passed as references. Most non-scalar types need to be passed as references in C also (I can't remember which C standard let structs be passed as value), which is perl's heritage.
Re: How I learnt to love Perl by mechanical_fish on Sunday December 07, 2008 @04:19PM (#389117)
Yes, if you want to write C this sort of thing is the least of your problems. Perl is certainly simpler and easier to learn than C. I'd also agree that Perl's declaration syntax is simpler than Java's, but what isn't simpler than Java's type system at this point? ;)

The simple syntax works in multiple Perl alternatives: PHP and Ruby are the ones I know about. Both languages have intelligent defaults to eliminate the need, in many cases, for newbs to think hard about what they're doing. (By default, PHP passes an array of arguments, by value -- with hidden optimizations to avoid the overhead of excess copying. The PHP argument array may include entire arrays as arguments. Meanwhile, in Ruby everything is an object, so Ruby passes an array of object references.) These are the languages which constitute Perl's competition, today. (Along with Python, of course, which I am unfairly leaving out of my argument because but I don't know how Python handles arguments! But I'm sure the answer is "with reasonable intelligence".)

Re: How I learnt to love Perl by nostrademons on Sunday December 07, 2008 @08:07PM (#389325)
"but what isn't simpler than Java's type system at this point?"

Haskell's type system. ;-)