http://www.perlmonks.org?node_id=412940


in reply to Re^3: Use method/function signatures with Perl
in thread Use method/function signatures with Perl

Funny. I thought that I just said that Attribute::Property is an unacceptable solution to me. That means that it doesn't take away the issue.

But you're right that validation is not the only thing that I object to about lvalue accessors. With OO I'd expect to be able to do something like create a Length module, Length objects can be accessed/set in various units (inches, meters, feet, miles, etc). An external user should have no idea what the internal representation is.

How do I do it with lvalues?

I guess that you can use tie, but implementing that takes enough work and adds enough surprise that I don't see it as a net win.

To me the syntactic sugar is simply not worth the extra work and complexity.

As for Perl 6, I'll evaluate each feature and come up with my own opinions. I'll feel free to ignore anything that I don't like - the language is rich enough that I have no shortage of viable choices for which subset of features to use and which to ignore. If I don't like the implementation of lvalue subroutines there, I'll ignore it like I what Perl 5 does. If I like it, then I'll feel free to use it like I would in Ruby.

And whichever I do, I'll feel free to dislike people who categorically declare that my considered set of choices are flawed.