Re:Why Did I Choose Perl When Building Crowdtilt?
by juan_juarez on Friday August 31, 2012 @05:10PM
(#4461711)
There's a school of writing "modern" Perl, using source filters and object systems. Bare Perl is a mess but, in somewhat of a Lispy way, you can use Perl to rewrite your Perl. If none of your functions have signatures and you're manually blessing objects, your codebase will quickly turn to shit. Using a standard bits (such as Moose) to give you a consistent object system and method call syntax changes things dramatically.
[ Parent
| on HN ]
Re:Why Did I Choose Perl When Building Crowdtilt?
by lazyjones on Friday August 31, 2012 @05:26PM
(#4461766)
This is a new fad and it undoubtedly leads to more maintainable code, but it still feels like a bad tradeoff to me: you get the verbosity of stricter languages without the benefit (compile-time errors) at worse performance than plain Perl. I'd rather write something new in Scala or Go nowdays than in strict "modern Perl" style / Moose (and I've used Perl almost exclusively for the past 13 years).
Re:Why Did I Choose Perl When Building Crowdtilt?
by singingfish on Friday August 31, 2012 @06:49PM
(#4462017)
umm, verbosity?
package Point;
use Moose; # automatically turns on strict and warnings
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');
sub clear { my $self = shift; $self->$_(0) for qw/x y/}
1;
Re:Why Did I Choose Perl When Building Crowdtilt?
by colomon on Friday August 31, 2012 @08:51PM
(#4462304)
Verbosity.
class Point {
has Int $.x is rw;
has Int $.y is rw;
method clear() { $.x = 0; $.y = 0; }
}
:)
Re:Why Did I Choose Perl When Building Crowdtilt?
by draegtun on Saturday September 01, 2012 @09:16AM
(#4463586)
Perl 5.18 may have the following:
use mop;
class Point {
has $x = 0;
has $y = 0;
method clear { ($x, $y) = (0, 0) }
}
ref: https://github.com/stevan/p5-mop/blob/master/t/000-examples/...
Re:Why Did I Choose Perl When Building Crowdtilt?
by singingfish on Saturday September 01, 2012 @02:29AM
(#4462844)
Looks like a noble attempt to remove perl5 and ruby pain in the arse points simultaneously. Wonder if it will ever come to anything ...?
Re:Why Did I Choose Perl When Building Crowdtilt?
by dkoch on Friday August 31, 2012 @10:46PM
(#4462507)
Perl 6 is / will be sweet :)
Re:Why Did I Choose Perl When Building Crowdtilt?
by colomon on Saturday September 01, 2012 @08:03AM
(#4463482)
Perl 6 is sweet, and will be sweeter when it has better performance. :)
Re:Why Did I Choose Perl When Building Crowdtilt?
by singingfish on Friday August 31, 2012 @05:35PM
(#4461789)
Source filters? Hahahahaha. The only acceptable source filter to use is Smart::Comments - https://metacpan.org/module/Smart::Comments - and even then, if you fire up code using Smart::Comments in the interactive debugger it's going to be a pain in the arse.
Moo/Moose (and Mo and Mouse if you must) are on the other hand game changers.
Re:Why Did I Choose Perl When Building Crowdtilt?
by knighthacker on Friday August 31, 2012 @05:16PM
(#4461726)
+1
I definitely recommend reading "Modern Perl". It is a game changer.