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


in reply to Reasons for Using Perl 6

Just to name few.


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re^2: Reasons for Using Perl 6
by Laurent_R (Canon) on Dec 22, 2017 at 22:43 UTC
    Yes, holli, by all means. I would add grammars.
Re^2: Reasons for Using Perl 6
by Jenda (Abbot) on Dec 23, 2017 at 03:31 UTC
    • "Math that works" is what? An attempt to circumvent the restrictions of the computer computational model at the expense of making actual computation insanely slow? I guess that might mean it works, but is it useful? Or do you mean something else?
    • And that's a good thing why?
    • Which was one of the reasons the implementation took almost twenty years already and the result is still prohibitively slow.
    • mkay

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      Floating-point arithmetic is flawed and sucks, and has sucked for probably 40+ years by now (which is really a very long period when speaking about modern technologies). It is actually outrageous that this hasn't been fixed over such a long period. Experienced programmers know it and have been accustomed to live with that. Does that mean that we should accept this flaw? I don't think so. IMHO, we should get rid of that flaw, we need a flexit.

      Consider this in Python:

      >>> .3 - .2 - .1 -2.7755575615628914e-17
      The result is very small, but it should really be 0.

      It's not better in Perl 5:

      $ perl -E 'say .3 - .2 - .1;' -2.77555756156289e-17
      Of course, neither Python nor Perl 5 is responsible for that, it is the FP arithmetic of the underlying architecture which sucks.

      Does this mean we can't do anything about it? Yes, we can, Perl 6 has this right:

      > say .3 - .2 - .1; 0 > printf "%.50f\n", .3 - .2 - .1; 0.00000000000000000000000000000000000000000000000000
      Getting an accurate result for such a simple calculation is not anecdotal. It is a real and major improvement. You can compare non integers for equality and get the correct result. Don't do that with most other programming languages.

      Yes, this improvement comes with a cost. So long as we have hardware that is inaccurate, we'll need to work around it with software, and this is bound to be somewhat slower. Personally, I think that accuracy is more important than speed.

      If speed was the only criteria, none of us would use Perl, we would all write our programs in C, nay, probably in assembly. But we don't. So, most of the time, speed is not the most important factor for us.

      Well, sometimes, speed matters. And I probably would not argue for accuracy if that meant that computation was really "insanely slow," as you claim. But it is not insanely slow; it is just somewhat slower, as shown in my earlier post above, and this speed issue could just be solved with a faster CPU. And, as I said earlier, there are performance enhancements almost every week (and some very big ones should be there very soon).

        And, as I said earlier, there are performance enhancements almost every week (and some very big ones should be there very soon).
        Given the history of Perl 6 over the last couple decades, I'm not sure that anything which even remotely hints at "it'll be there Real Soon Now" is going to be effective at changing the minds of its non-fans.
        Floating-point arithmetic is flawed and sucks

        I disagree with that on both counts.
        To me, it's incredibly naïve to complain about a base 2 approximation of 0.3 minus a base 2 approximation of 0.2 minus a base 2 approximation of 0.1 resulting in a minute non-zero value.

        I've nothing against rational arithmetic - but note that when you've done your rational computations and you end up with a result of 132511/43, the first thing you're going to do (in order to gauge the magnitude of that value) is to convert it to an approximate floating point value.
        And I would think (untested) that perl5's Math::GMPq module provides better rational arithmetic than perl6 ever will.

        I can't see perl6's arithmetic model ever being a reason for me to use perl6. (I'd rather stay with perl5 - and do the arithmetic in XS space if accuracy is important.)

        Cheers,
        Rob

        Real world programming tends to involve functions. For instance, trigonometric functions are very common. How exactly does Perl 6 do it right? What is the domain of accurate calculations? Say, can it do simple interest calculations accurately?

        Perl and speed aren't mutually exclusive. You can have a low-level module or Inline::C doing the heavy lifting and still benefit from rapid prototyping or other comforts that Perl allows.

      Without wanting to really move you from your strong opinions strongly held about Perl 6, is perf -especially numeric- actually prohibitively slow still? Have you done any numeric work in Perl 6 in say the last six months to a year? I'd gently suggest it's really not that bad anymore. Rational maths is always going to be slower than floating point due to hardware support. Comparing like for like though Im not sure the difference is so big its something that would stop me. At least if I was using something as slow as Perl 5 for numeric work to begin with perf is clearly not what I cared about! For the P6 advent this year I did a bit of a write up on my personal long wait for perf, its really not what it once was https://perl6advent.wordpress.com/2017/12/16/day-16-%F0%9F%8E%B6-deck-the-halls-with-perf-improvements-%F0%9F%8E%B6/

        It's all nice and dandy, including the funny "next Christmas" remarks ... it's just ten years too late. The language would have an infinitely better chance if you did a few search&replaces in the source code and documentation, removed all references to Perl whatsoever, made one or two more ad hoc changes to the use of special characters and operators, found a few people nobody knows and have them released it elsewhere under a new name and hope nobody notices it's not something new, but rather a project started some 18 years ago originally supposed to be finished about 15 years ago.

        Jenda
        Enoch was right!
        Enjoy the last years of Rome.