supernovus / perl6-http-client

Build HTTP Clients easily with Perl 6
18 stars 11 forks source link

Consider a more Perl 6'ish API? #7

Open smls opened 9 years ago

smls commented 9 years ago

Did you consider letting the API exploit some of the shiny elegant Perl 6 features like assignable (rw) accessors and overloadable subscript operators?

This seems so Perl 5'ish to me:

$request.url('http://example.com/web/service');
$request.add-field(id => 37271);

Whereas Perl 6 allows the following, which would be a much more elegant I think:

$request.url = 'http://example.com/web/service';
$request.fields<id> = 37271;
supernovus commented 9 years ago

That would be a great idea. This was written several years ago when not all the features that are available now were available yet. Most of my libraries could probably use some major refactoring, if not complete rewrites given the number of changes since I worked on them last. I'm not very active on here anymore, as my day job keeps me rather occupied.