Caleb Cushing's Blog Also known as XenoTerraCide
Posts with the tag perl syntax wishlist:

Perl Core Syntax Wishlist: Role Support

I want to see Role’s added, even PHP got Traits before Perl. It doesn’t have to be a huge thing, in fact all I want is the composition aspect. Let me do this: 1 2 3 4 5 6 7 8 9 package MyRole { sub foo { return 'test' } } package MyClass { with 'MyRole'; ... } MyClass->new->foo; I don’t really want or need anything else right now, just that would be fine.

Perl Core Syntax Wishlist: Class support

I would like to see the classkeyword become part of Perl, but unlike some I don’t want it simply because it’s nicer syntax. I’d like it to behave differently from package. I’d basically like to see this class MyClass {method foo { return $self->{foo} }method info { return load_class(‘Class::Info’)->new }}to be the equivalent of {use strict;use warnings;use utf8; # so our class can be named with utf8package MyClass {use namespace::autoclean;use Scalar::Util qw( blessed );# use Class::Load qw( load_class );# or similar for a feature that I’m hoping will be in Class::Load in the future# for now I’ll show with requiresub new { # or something better, point is that there’s a default simple constructormy $class = shift;my $self = ref $[0] eq ‘HASH’ ?

Perl Core Syntax Wishlist: die should die

I hate die it is, in my humble opinion, one of the worst parts of perl. I really wish it would be deprecated, and removed, or at least replaced with something that would tell you were the code that was die-ing was being called. Replace its implementation with that of Carp’s croak or confess and I’d be happy. Better yet, let’s just get real exception support and deprecate die (even if that’s never removed deprecation just make that real big on its pod).

Perl Core Syntax Wishlist: an Exception Stack

I have come to wish many things were part of Perl syntax that are not, and no using external modules is not enough for me. I think it’s time Perl got the features as part of the language itself (and yes I suppose I could settle for feature.pm, and no I’m probably not going to write them myself, I’m not smart enough yet). The first of these is a proper exception stack.