notes-computer-programming-programmingLanguageDesign-prosAndCons-perl6

http://www.josetteorama.com/all-about-perl-6-interview-of-jonathan-worthington-part-1-of-3/

http://www.josetteorama.com/all-about-perl-6-interview-of-jonathan-worthington-part-2-of-3/

http://www.josetteorama.com/all-about-perl-6-interview-of-jonathan-worthington-part-3-of-3/

Why did it take so long to implement?

chromatic's view:

http://www.modernperlbooks.com/mt/2012/12/the-implementation-of-perl-5-versus-perl-6.html

http://www.perlmonks.org/bare/?node_id=940285

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

other views: http://strangelyconsistent.org/blog/perl6-is-now-half-as-old-as-perl

See also [1]:Retrospectives

--

NV: For people that have experience in other classic or static OOP languages, Roles can be used to construct Interfaces, Abstract classes, as well composition over inheritance?

ML: Right, you can use them both for interfaces as you know them from Java, and for code reuse, where they detect method conflicts at compile time, which multiple inheritance usually does not.

--

NV: What kind of threading model does Perl 6 adopt?

ML: That's one of the things that is still being ironed out. Larry wants some sort of unification of threads and events, but so far no compiler has decent threads support, so it is all speculative for now. There are scientific papers that achieve such a symbiosis in Haskell, in the end we want to provide something similar, but with Perl 6ish syntax.

--

https://news.ycombinator.com/item?id=9006061

b2gills 1 day ago

link

One feature which I believe is distinctly available only in Perl 6 is it's grammar feature. ( think class/method based regular expressions that look similar to BNF )

As an example look at this Perl 6 grammar for JSON: https://github.com/moritz/json/blob/master/lib/JSON/Tiny/Gra...

Perl 6's best feature is that it combines many features from many languages in a way that allows combining them cleanly, and without any of them feeling like they were glommed on. (unlike Perl 5's object system which was inspired by Python's object system)

If you can get past the syntax differences from other languages, and program in it for a while, you may never want to go back to any other language.

If you can't get past the syntax, please say that you "don't like the syntax" instead of "it's unreadable" or "it's a write-only language" or "it's difficult to learn". ( I for one found it quite easy to learn, and can read it quickly. )

---

Really can you make all of the following examples clearer in any other single language?

  constant powers-of-two = 2,4,8 ... *; # an infinite deductive list
  1. perhaps that would be more clear as: constant powers-of-two = 2, 4, 8, 16, 32, 64 ... *;
  2. list of pairs using the zip meta-operator (Z)
  3. combined with the pair constructor operator (=>) my @a = 'a'..'z' Z=> 0..*; # ( a => 0, b => 1, etc ) my $new-password = ('a'..'z','A'..'Z',0..9).roll(12).join; # 'ygHIHbi4XgUV?'
  4. the zero in the following is to prevent an off-by-one error
  5. when accessing by index
  6. * + * creates a code ref that takes two inputs and numerically adds them together constant fibonacci-list = 0, 1, 1, * + * ... *;
  7. takes about a second the first time it's accessed currently say fibonacci-list[10000].chars == 2090;
  8. if you wanted it to look more like haskell you could write it like this: constant fibonacci-list = 0, 1, 1, &[+] ... *;
  my @dice-rolls := ('⚀'..'⚅').roll(*); # infinite list of dice rolls
  1. deck of cards using the cross meta-operator (X)
  2. and the string concatenation operator (~)
  my @deck = 2..10,<J Q K A> X~ <♡ ♢ ♣ ♠>;
  my @shuffled = @deck.pick(*);
  1. ( .say ) is short for ( $_.say )
  2. prints the first 6 numbers (0..5) each on it's own line for ^6 { .say }
  3. prints the numbers 0..5 each on it's own line,
  4. possibly randomized,
  5. possibly each in it's own thread ( texas version )
  (0..^6)>>.say;
  (^6)».say; # ditto ( french version )
  1. ( those were purposefully misusing an auto-threading list operator >> )
  2. says a random number (1..5), 5 times out of 6 if (0..5).pick -> $number { say $number } if (0..5).pick { say $^number } # ditto

---

That was just a sampling of the bread-and-butter constructs (some of which were used in a way that most people wouldn't use them). There are also operators for dealing with Sets for example. ( ⋃ and (elem) being two of them )

see: http://doc.perl6.org/

You can even create new operators the same way you define a subroutine ( That's all they are in the Rakudo implementation, for most of them. )

  1. common factorial example sub postfix:<!> ( Int \n where * >= 0 ) is tighter(&infix:<*>) { [*] 1..n } say 5!; # 120

reply

---

perl6 has rationals by default, not floating point

---

"