Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Thanks for your feedback. It's much appreciated. While I understand your perspective I maintain a difference of opinion. For example:

Your take:

"it is possible to implement "everything is an object" in Perl ... which isn't bad, but no particular benefit either"

My take:

You're right to call out that this is a move towards "everything is an object" in Perl. As mentioned in another comment/reply, "the lack of a native type system means that your classes and methods can’t be certain of the type of data they’re being passed, which forces you into a position of defensive programming".

Your observation:

"Venus::Number objects can, thanks to overload, be manipulated with the usual arithmetic operators. However, as soon as I apply an arithmetic operator on a Venus number, the result loses its object properties and is just a plain number."

My response:

You're correct and this is intentional. All value class methods, intentionally, return native data types. I refer to this in the article under "guiding principles" where I state that "the library should ease the multi-paradigm identity crisis" and "be a compliment, not a cudgel", i.e. if I'm using Venus and (in a particular context) I only want to leverage the Venus::Array#any algorithm (e.g. Venus::Array->new([1..8])->any(sub{$_ > 5})) I can use that and have the result be a basic arrayref, OR, if I want to opt-into "everything is an object" and chaining method calls via autoboxing I can do that easily too (e.g. Venus::Array->new([1..8])->box->any(sub{$_ > 5})->count->unbox).

P.s. Thanks again for the great feedback. Based on it I'll be adding the simple math routines to the Number class in an upcoming release, as well as fixing the string interpolation bug.

"I am inevitable." - Thanos

In reply to Re^2: What if Perl had an OO standard library? by awncorp
in thread What if Perl had an OO standard library? by awncorp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-25 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found