News for hackers. Stuff that matters.
Re:Perl 6 Introduction by zimbatm on Saturday November 28, 2015 @08:24AM (#10640992)
Does Perl 6 have fundamental features that don't exist in other languages ? Just curious.
Re:Perl 6 Introduction by perlgeek on Saturday November 28, 2015 @08:38AM (#10641013)
I don't know if any of these features are really unique, but the combination of having them all is certainly unique:

* Strings that are made of Unicode grapheme clusters instead of codepoints or bytes. This means that a substr() operation for example can't even accidentally rip a apart a base character and a combining character on top of it

* Grammars as a language feature

* Gradual typing

* A built-in meta object protocol

* Concurrency based on high-level primitives (promises, queues, supplies, ...) with syntactic support (instead of threads and locks; which are still available if necessary, but discouraged, because they don't compose well).

* Lazy lists

Re:Perl 6 Introduction by Woodi on Saturday November 28, 2015 @08:58AM (#10641063)
Yea, grammars looks simple-the-unique thing other languages don't have in 2015, 2016 and, I bet, 2017 too. Maybe even longer :)
Re:Perl 6 Introduction by kamaal on Saturday November 28, 2015 @10:40AM (#10641316)
That's only at level 1, until you realize Perl 6 code is parsed by a grammar written in Perl 6.

Its power is amplified by the part Perl 6 regexes are better than anything there is out there.

Even better, this extends beyond ASCII and applies to Unicode too. And will work with other powerful control structures.

I'd fix that date to something like 2027.

Re:Perl 6 Introduction by draegtun on Tuesday December 01, 2015 @03:53AM (#10654250)
While Grammars as a language feature aren't mainstream (yet!) they're not a unique feature either.

For eg. See the parse dialect which is a TDPL that comes with Rebol / Red

- http://www.rebol.com/docs/core23/rebolcore-15.html

- https://en.wikibooks.org/wiki/REBOL_Programming/Language_Fea...

- http://www.red-lang.org/2013/11/041-introducing-parse.html

Re:Perl 6 Introduction by gdwatson on Saturday November 28, 2015 @06:32PM (#10642998)
Grapheme-cluster strings are neat, and the decision to normalize makes sense in that context. But how does Perl 6 handle filenames, which can't be safely round-tripped through grapheme strings?
Re:Perl 6 Introduction by raiph on Saturday November 28, 2015 @07:12PM (#10643130)
It turns out that the same NFG mechanism developed to support graphemes works for this non-grapheme scenario too:

"... POSIX doesn’t promise you’ll get UTF-8, or even ASCII. It promises ... a bunch of bytes. We can now cope with this properly – surprisingly enough, thanks to the power of NFG. We now have a special encoding, UTF-8 Clean-8-bit, which turns bytes that are invalid as UTF-8 into synthetics, from which we can recover the original bytes again at output. This means that any filename, environment variable, and so forth can be roundtripped through Perl 6 problem-free. You can concat “.bak” onto the end of such a string, and it’ll still work out just fine."

From https://6guts.wordpress.com/2015/11/21/what-one-christmas-el...

Re:Perl 6 Introduction by zimbatm on Saturday November 28, 2015 @09:01AM (#10641068)
Thank you
Re:Perl 6 Introduction by awwaiid on Saturday November 28, 2015 @10:02AM (#10641202)
[minor syntax/markup edits]

One that has caught my fancy are various uses of the "Whatever Star". This appears as a * in a few contexts. In many it is really a shortcut for the "Whatever" class, so you can use it in function signatures to enter sort of "automatic mode".

  @shuffled_names = @names.pick(*) # randomly pick... however many you have. whatever.
But I think more interesting and different than that is using whatever-star as an automatic lambda thing.

  @nums.map(*/2 + 3)              # expression-lambda from context around a whatever-star
  @nums.map( -> $n { $n/2 + 3 } ) # equivalent with a real stabby arrow lambda
  @nums.map( { $^n/2 + 3 } )      # $^n is a generated alphabetical-positional argument
I suppose this isn't really fundamental... but is definitely different.
Re:Perl 6 Introduction by wantarray on Wednesday December 02, 2015 @07:34PM (#10666955)
I'm pretty sure that the "expression-lambdas" were inspired by Haskell, where you get a lambda simply by writing an operator with one or more missing operands.

In Perl 6, detecting that an operand is "missing" isn't possible due to the existence of prefix/infix/postfix operators with the same names, so it expects a "whatever" star in place of the missing operand... :)