4 ms·
One promising thing about Perl 6 was the way it tried to bring parsers to everyday programming the way Perl popularized regular expressions. I'm sad the languag
by philwelch 16y ago
One promising thing about Perl 6 was the way it tried to bring parsers to everyday programming the way Perl popularized regular expressions. I'm sad the language seems to have stalled for that reason.
- ekiru 16y agoYou're almost exactly right there. One promising thing about Perl 6 is the way it brings parsers to everyday programming the way previous Perls popularized regexes. :) Perl 6's approach to syntax, operators, grammars, language extension, etc. is like Common Lisp's reader macros; except that Perl 6 makes them easy and composable. Common Lisp libraries tend to use reader macros very sparingly because it's hard to make them play together nicely. Perl 6 makes it easy to alter the syntax in ways that play together nicely. Many of Rakudo's core operators are defined in normal Perl 6 code. It's trivial to make new ones of your own. The more extensive grammar modifications aren't quite there yet, I think, but it'll happen, and it will be revolutionary. Fortunately, it hasn't stalled. It's moving along quite well.
- rwmj 16y agoHow does it compare to camlp4? Camlp4 extensions are mostly composable, provided two extensions don't directly conflict with each other.
- ekiru 16y agoI'm not very familiar with Camlp4. I tried skimming the tutorial to see if some of the big benefits of Perl 6's syntactic extension are there, but couldn't tell. Are Camlp4 extensions lexical? Can you load some syntactic extension within a single function and have it apply within only that function's lexical scope? If I understand Camlp4 correctly, it's essentially a pre-processor. It's a very powerful pre-processor, perhaps, but you'd probably have to work very deep magic to be able to replace the Ocaml parser for a lexical scope. This is not yet implemented, but eventually you'll be able to do 'supersede slang MAIN { ... }' and rewrite the grammar the current lexical scope. How easy is it to use Camlp4 extensions from OCaml programs? In Perl 6, it's a simple matter of "use SomeModule;". Here's the code of a module to provide a factorial operator. module Factorial; multi sub postfix:<!>(Mu $n) is export { [*] 1..$n; } And an example of using it: use Factorial; say 5!; # outputs 120 This is actually essentially how many of the built-in operators are provided in Rakudo. The ones that aren't provided in this way are the ones like || and && with short-circuiting semantics which need to be evaluated specially and the ones that are better implemented in PIR. I'm afraid I don't have any examples of more extensive grammar modifications, as Rakudo doesn't have much support for them yet. More accurately, it doesn't have support for adding them in mid-parse yet; it's fairly simple to create a new grammar class deriving from Rakudo's Perl6::Grammar with a few modifications and parse files with it.
- deleted 16y ago[deleted]
- deleted 16y ago[deleted]
- philwelch 16y ago"Everyday programming" doesn't necessarily use Perl, and it rarely uses prerelease programming languages. Perl 6 has brought parsers (I guess we should call them "grammars" in analogy to "regular expressions") to certain parts of the (shrinking) Perl community, but the everyday programming in general hasn't been lit aflame. Perl was influential enough to get regexes (in one form or another) into nearly every language in popular use today.
- sigzero 16y ago> everyday programming in general hasn't been lit aflame That isn't quite true. A lot of the things that are happening in P6 have been backported to P5 and in general has made everyone excited. It is has also "revitalized" the people working on the core of P5 to think new thoughts as well. I don't know if I will move to P6 but I am thankful for what it has done to P5.
- perlgeek 16y agoI'm curious, how did you get that impression? I'm one of the Perl 6 developers, and IMHO the regexes and grammars are one of the "killer" features. And I've also seen them evolve gradually, and have used them for various purposes. What gave you the impression that it has stalled? Is that the general impression on the outside of the Perl 6 community? What kind of marketing could we do to reach you?
- philwelch 16y agoFrom a marketing standpoint, calling it "Perl 6" is a terrible way to market it. Perl 6 implies that it's Perl, which has both good and bad connotations, and it also implies it's just an iteration on Perl 5, when in fact it's one of the most ambitious languages ever conceived. An ambitious new programming language can take ten years to develop and people are only halfway suspicious that it took so long. An iteration on Perl 5 should take nowhere close to ten years to finish. So don't call it Perl 6 :) If you wanted to keep continuity with the Perl line, then from the outset, it might have been a better idea to plan out a roadmap for Perls 6, 7, 8, and 9 rather than just Perl 6. "Perl with grammars" can be released and then you can move on to the next iteration. "Perl with grammars, objects, lazy evaluation, macros, junctions, optional static typing, and not just one but two kitchen sinks" will take upwards of 10 years to reach final release status. This has the benefit of increasing usability as idioms and common practices for new language features can evolve as each set of features is released. In practice a lot of this has been done for you ("Perl with objects" became Perl 5 + Moose). Since that didn't happen, I think casual observers are suspicious that second-system effect has taken place with Perl 6 and that it may never really be done.
- mst 16y agoAs I said in my Iron Man forfeit talk, I'd quite like to see the perl6 spec renamed to Camelia Perl - and perl5 renamed to something else as well. The respective communities for the two languages now very much regard ourselves as two fascinating languages in the same family - one very much production ready, the other still polishing that side but a stunning work of language design research already. Now it's just a case of our marketing catching up with reality.