in reply to Re^2: RFC: Math::Triangle (Perl 6)
in thread RFC: Math::Triangle (Perl 6)
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. (...)I disagree with this view.So using a class even for something relatively simple is not overkill, instead not using a class is impossible.use v6; 1.say; #prints 1 [download]
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.
|
|---|