Live data from Hacker News

Why I’m Learning Perl 6

evanmiller.org

361–370 of 380 posts

Re: Why I’m Learning Perl 6

#361
post #351

Earlier quoted context omitted.

I should have been more specific. Try this in Ruby, Python, PHP or Javascript: 0.1 + 0.2 - 0.3 . You'll get an approximation in most languages but only Perl 6 returns 0.

Yes, I understand the example. It's a classic floating point numbers demonstration. What I am saying is that I have not encountered a real-life case where this would have made my life easier. Again, it's neat, but not a real reason to move to a new language.

Then I have to assume you're not working in any kind of commercial or financial sector where approximations are not acceptable. Perl 6 and Go should be lauded for solving this problem.

Re: Why I’m Learning Perl 6

#362

Earlier quoted context omitted.

Why is CPAN not a viable replacement? It has always been perfectly viable for me.

CPAN packages are written by thousands of different people with varying styles (cf. the issue with 10 different ways of doing the same thing), quality standards and maintenance schedules. In Python I can expect the standard library to be consistent and be maintained as part of the core language. Now I don't mean that everything has to be in the standard library (I'm fine with the database access libraries being third…

Unfortunately for Python is that many/most of the modules that are included were written when the language was fairly new, so at a time when nobody was an expert in the language.

Which means that perhaps for many of them there is a better module out in the ecosystem that almost nobody uses because they have one extra step to install them.

If you want something close to that in Perl 6, just install Inline::Python and you can use all of those “batteries included” with Python as if they were modules written in Perl 6.

Exceptions in Perl 6 are much easier to deal with than they are in Perl 5.

Re: Why I’m Learning Perl 6

#363
post #143

Earlier quoted context omitted.

I'm not sure I understand your exercise. What do you mean by "Python's quoting documentation", and what do you mean by "editing" it?

> What do you mean by "Python's quoting documentation" String literals are described by the following lexical definitions: stringliteral: shortstring | longstring shortstring: "'" shortstringitem* "'" | '"' shortstringitem* '"' longstring: "'''" longstringitem* "'''" | '"""' longstringitem* '"""' shortstringitem: shortstringchar | escapeseq longstringitem: longstringchar | escapeseq shortstringchar: longstringchar: e…

For those that don't know you can use `「` and `」` to quote anything that does not contain `」` and Perl 6 won't process it in any way other than storing it as a Str.

If you needed to have `」` in there you can fall back to `Q{{{{{{…}}}}}}` or `Q:to;␤…␤END␤`

Re: Why I’m Learning Perl 6

#364
post #36

I like writing bash scripts a lot and perl is a natural step-up with powerful libraries to use. As others have said, the major obstacle for me has been the lack of great literature.

For small tasks I enjoy aesthetics of small dedicated Unix tools (grep, sed, awk, cut, sort) working together much more. Perl tries to be everything at once, still mysteriously lacking interactive REPL out of the box. Yes, Python is more heavyweight for scripting, but it pays in the long term with better maintenance and tooling for big scripts.

The first version of Perl was basically combining many Unix tools together into one language, along with features from C, so that they are easier to use together.

In fact there are two flip-flop operators that exist in Perl 5, one which works like the one in awk `..` , and the other like the one in sed `...`. Perl 6 renames them to `ff` and `fff`.

I remember hearing/reading that the release of Perl was delayed until a2p and s2p were written, specifically for people who used awk and sed to be able to get going quickly in Perl.

Re: Why I’m Learning Perl 6

#365

All I think about when I hear M:N thread multiplexing is "1992 is calling to have its stupid threads hacks back". M:N is what you do when you don't have real kernel thread support. You hacked N user space threads per process (N:1) but then 1990 rolled in and cheap SMP with M processors started to spread across the land, so you needed N:M to take a bit of advantage of that.

Perl 6 has M:N thread multiplexing along with normal thread support. It's just that M:N thread multiplexing is easier to use because all of the hard work is done for you.

Re: Why I’m Learning Perl 6

#366
post #13

It's terrible that you put Erlang on a list with other languges/VMs. >There’s no GIL, so unlike Those Other Languages There is no GIL in EVM as well, but playing with the words you make it look like "all are the same". This does not deserve top HN and just stupid. If your Perl6 VM is _so_ great, why didn't you mention anything about what's really important like preemptive scheduling which has been Erlang's unbeatable…

The author of the article likely hasn't dug much into the VM code yet.

https://github.com/MoarVM/MoarVM/#feature-overview

Re: Why I’m Learning Perl 6

#367
post #356

Earlier quoted context omitted.

Yes, I understand the example. It's a classic floating point numbers demonstration. What I am saying is that I have not encountered a real-life case where this would have made my life easier. Again, it's neat, but not a real reason to move to a new language.

Banking/accounting software? Generating reports that are expected to return correct data w/o cumulative errors from flating point arithmetic? After all, Perl is the Practical Extraction and Report Language.

I'm not saying there aren't applications where it is useful. If you can't tolerate errors, then you typically don't use floats in the first place. We've been running banking/accounting software for a long time without Perl 6.

What I am saying is that this isn't a killer feature.

It makes me go, "Oh, neat", and not, "Wow, this will make my life so much easier".

Re: Why I’m Learning Perl 6

#368
post #361

Earlier quoted context omitted.

Yes, I understand the example. It's a classic floating point numbers demonstration. What I am saying is that I have not encountered a real-life case where this would have made my life easier. Again, it's neat, but not a real reason to move to a new language.

Then I have to assume you're not working in any kind of commercial or financial sector where approximations are not acceptable. Perl 6 and Go should be lauded for solving this problem.

Actually, I work in analytics well inside the commercial sector. 10 digits of accuracy works most of the time, and when it doesn't there are other alternatives. As with anything there are trade-offs.

I wish more languages would do this and I happily applaud Perl 6 and go for allowing sane operations in the real space without needing separate packages.

But there are high quality packages for all modern languages that allow you to get precision if you need it.

I'm not debating the utility of this feature, but I am saying it's not--by itself--going to make me want to pick up Perl 6 for my next project.

Re: Why I’m Learning Perl 6

#369
post #136
post #65

I hate perl6. I hate it because I tried to get involved in the project early on, and it led me down the Haskell rathole. I don't know what Haskell looks like today, but a decade or more ago it was the hardest language to pick up that I had ever experienced. It was as if I had a solid background in latin languages and I was trying to pick up Chinese based on a handful of tutorials written by a tourist on the back of a…

FWIW, I, too, have tried learning Haskell and ended up banging my head against the wall over and over. With Lisp, I eventually "got it", but Haskell has evaded my attempts at understanding it with impressive stubbornness[1]. Disclaimer: I do not hate Haskell, I just don't "get it". If you love the language, fine, have as much fun with it as you possibly can. I for one have given up, at least for now. Maybe I'll try a…

I totally understand your frustration with Haskell.

I understand the tutorials and have read though the books available, but when I try to use the language on a small real project, say a 2d barcode generator, I have trouble getting off the ground. Its not even clear to me which set of features are recommended for the language. It seems like different users program in different, incompatible, languages! Here is a list of optional language extensions supported by GHC:

Cpp

OverlappingInstances

UndecidableInstances

IncoherentInstances

UndecidableSuperClasses

MonomorphismRestriction

MonoPatBinds

MonoLocalBinds

RelaxedPolyRec

ExtendedDefaultRules

ForeignFunctionInterface

UnliftedFFITypes

InterruptibleFFI

CApiFFI

GHCForeignImportPrim

JavaScriptFFI

ParallelArrays

Arrows

TemplateHaskell

TemplateHaskellQuotes

QuasiQuotes

ImplicitParams

ImplicitPrelude

ScopedTypeVariables

AllowAmbiguousTypes

UnboxedTuples

UnboxedSums

BangPatterns

TypeFamilies

TypeFamilyDependencies

TypeInType

OverloadedStrings

OverloadedLists

NumDecimals

DisambiguateRecordFields

RecordWildCards

RecordPuns

ViewPatterns

GADTs

GADTSyntax

NPlusKPatterns

DoAndIfThenElse

RebindableSyntax

ConstraintKinds

PolyKinds

DataKinds

InstanceSigs

ApplicativeDo

StandaloneDeriving

DeriveDataTypeable

AutoDeriveTypeable

DeriveFunctor

DeriveTraversable

DeriveFoldable

DeriveGeneric

DefaultSignatures

DeriveAnyClass

DeriveLift

DerivingStrategies

TypeSynonymInstances

FlexibleContexts

FlexibleInstances

ConstrainedClassMethods

MultiParamTypeClasses

NullaryTypeClasses

FunctionalDependencies

UnicodeSyntax

ExistentialQuantification

MagicHash

EmptyDataDecls

KindSignatures

RoleAnnotations

ParallelListComp

TransformListComp

MonadComprehensions

GeneralizedNewtypeDeriving

RecursiveDo

PostfixOperators

TupleSections

PatternGuards

LiberalTypeSynonyms

RankNTypes

ImpredicativeTypes

TypeOperators

ExplicitNamespaces

PackageImports

ExplicitForAll

AlternativeLayoutRule

AlternativeLayoutRuleTransitional

DatatypeContexts

NondecreasingIndentation

RelaxedLayout

TraditionalRecordSyntax

LambdaCase

MultiWayIf

BinaryLiterals

NegativeLiterals

DuplicateRecordFields

OverloadedLabels

EmptyCase

PatternSynonyms

PartialTypeSignatures

NamedWildCards

StaticPointers

TypeApplications

Strict

StrictData

MonadFailDesugaring

I've seen different subsets of these extensions recommended. Is there some canonical subset recommended by anyone doing real work in Haskell?

Even more off topic: in reference to your note about the word "stubbornness", the word "bookkeeping" has three consecutive doubled letters. I believe that there are no examples of four consecutive doubled letters in any ordinary English dictionary, but I ought to grep the longer lexicons I've got at home.

Re: Why I’m Learning Perl 6

#370

For some reason, when I started my software engineering career I got it into my head that I needed to learn as much as I could about programming languages. I learned ruby, perl5, python, lisp, forth, ml, ocaml, scheme, haskell, r, c#, java, lua, c++, factor, idris, asm, erlang, prolog, rust, d. But that wasn't quite enough because haskell and idris kept on talking about complicated type theory stuff. So I also learne…

> I learned ruby, perl5, python, lisp, forth, ml, ocaml, scheme, haskell, r, c#, java, lua, c++, factor, idris, asm, erlang, prolog, rust, d.

With all due respect, you didn't "learn" these languages. You got a superficial understanding of these languages. It's like someone who learns to say "hello, name is John, what is your name" in 17 human languages saying they learned 17 languages.

Being able to write "hello world" in all these languages doesn't mean you "learned" it.

Post reply on HN