That is because you think Perl 5. Perl 6 is full OO. There is absolutely nothing in the language that isn't an class/object, not even things like keywords. (...)
use v6; 1.say; #prints 1 [download]
So using a class even for something relatively simple is not overkill, instead not using a class is impossible.
I disagree with this view.

Granted, there is one (low) level of abstraction where this is kind of true. Kind of true, because the fact that you can write 1.say; does not necessarily mean that the literal integer 1 is an object. As far as I can say, this is more a form of boxing or perhaps autoboxing: in a sense, the primitive type is converted into an object for the sake of using methods on it, but 1 is really a primitive or native type, not really an object. But that's not my main point.

Even if this view of yours were to hold and if I were to admit (solely for the sake of argument) that "everything is an object," this would be a very low-level view of the language. You admittedly need OO programming to create new types. But that does not mean that you have to do all your programming at this low level. Perl 6 offers many (often higher) levels of abstraction (or programming paradigms), such as declarative programming (e.g. regexes and grammars), functional programming (data pipelines, higher order functions, closures, etc.), concurrent and parallel programming (promises, etc.), and of course more traditional procedural or imperative programming. Or even logic programming, if you are willing to take some extra efforts. So that not using a class is actually far from impossible.

We, as programmers, have to decide which level of abstraction to use, and you and I may agree or disagree on that. But saying that everything should be OO is just at variance with the Perl (5 or 6) philosophy, and, IMHO, plainly wrong.


In reply to Re^3: RFC: Math::Triangle (Perl 6) by Laurent_R
in thread RFC: Math::Triangle (Perl 6) by holli

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.