Opinions Wanted On Changing Vim Syntax Highlighting

Hello fellow Perl (and potentially Vim) users!

There's an open issue on the vim-perl issue tracker about how the current syntax highlighting is inconsistent in how it highlights chained method calls, which currently looks like this:

 1 use strict;
 2 use warnings;
 3 use feature qw(say);
 4 
 5 $foo->bar;
 6 
 7 $foo->bar();
 8 
 9 $foo->bar->baz;
10 
11 $foo->bar()->baz;

My proposal is to remove method highlighting altogether, and per the user y's suggestion, I'm announcing it here to take the pulse of the community and see where others stand. Removing method highlighting would make the Perl syntax file easier to work with as well as potentially improve highlighting performance.

The resulting highlighting would look like this:

 1 use strict;
 2 use warnings;
 3 
 4 $foo->bar;
 5 
 6 $foo->bar();
 7 
 8 $foo->bar->baz;
 9 
10 $foo->bar()->baz;

Perl 5 Porters Mailing List Summary: September 11th-17th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week.

Enjoy!

The Rakudo Book Project

Read this article on Rakudo.Party

When I first joined the Rakudo project, we used to say "there are none right now; check back in a year" whenever someone asked for a book about the language. Today, there's a whole website for picking out a book, and the number of available books seems to multiply every time I look at it.

Still, I feel something is amiss, when I talk to folks on our support chat, when I read blog posts about the language, or when I look at our official language documentation. And it's due to that feeling that I wish to join the Rakudo book-writing club and write a few of my own. I dub it: The Rakudo Book Project.


The Books

The Rakudo Book Project involves 3 main books—The White Book, The Gray Book, and The Black Book—as well as 2 half-books—The Green Book and The Cracked Book.

graphql-perl - MooX::Thunking - Deferred computation attributes

As part of porting GraphQL to Perl (sponsored by Perl Careers), one of my goals is to use the best possible practice in making rigorous code. One way to use this is to imitate the style of the JavaScript reference implementation's use of immutable data structures.

One problem arising is creating objects that have a reference to themselves. If the objects created were mutable, then one would simply create the object, then set the relevant attribute to include the object reference. If the objects are immutable this is not possible. For example:

package GraphQLType;
use Moo;
use Types::Standard -all;
has [qw(children)] => (
  is => 'ro',
  isa => ArrayRef[InstanceOf['GraphQLType']],
  required => 1,
);

package main;
my $type;
$type = GraphQLType->new(children => [$type]);

Importer::Zim

As a proof-of-concept, Importer::Zim has been released to CPAN. For modules which export symbols and define @EXPORT, @EXPORT_OK and @EXPORT_TAGS, zim can be used as a pragma to import subroutines into the caller package with lexical scope for perl 5.18+.

use zim 'Scalar::Util' => qw(blessed);
use zim 'List::Util' => qw(first sum max any all);

use zim 'Fcntl' => ':flock';
use zim 'Carp';  # imports carp(), confess(), croak()

use zim 'Mango' => 'bson_time' => { -as => 'bson_dt' };

Some of the benefits are:

  • there is no need for Exporter-like code - only the declarations of the exported symbols are necessary.

  • the imported symbols are self-cleaning - which means they won't pollute the namespace like it happens when exporting / importing is done through the symbol tables. (No need for modules like namespace::clean or namespace::autoclean.)

Importers are on the side of the consumer code - which is the one that should care more about the effect of the imported symbols. On the other hand, exporters are on the side of the producer code which can hardly anticipate every possible way its subroutines will be used. There are more good points on importers vs exporters at https://metacpan.org/pod/Importer#WHY?

London Perl Workshop: give a talk

The London Perl Workshop (LPW) takes place this year on Saturday 25th Nov and you are encouraged to submit your talk proposals now (or if you have already, feel free to submit another!).

The informal theme this year is "Perl and friends". We welcome proposals relating to Perl 5, Perl 6, other languages, and supporting technologies.

The hugest feature of Perl 6

If there would be an election for the single greatest Perl 6 feature, many would select the box for grammars and others would root for concurrency/async (as expressed in several articles here and elsewhere). Roles and types might be also strong contenders. Here is why I would pick: none of the above, even I like all of them very much.

Perl 5 Porters Mailing List Summary: September 5th-10th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week.

Enjoy!

TIL in this Month's Perl 6 Bug SQUASHathon

Read this article on zakame.net/blog

A bit overdue post, but I attended this months's Perl 6 Community Bug Squashathon last weekend and it was fun! I had a great time learning some more Perl 6 while making contributions at the same time. Definitely looking forward to next month's!

Here are a few little bits of Things I've Learned...

Resolving conflicts of interests (CP part III)

After explaining the kinds of prototypes that are used in complete Programming and the way code moves between them, it is time the explain the other motivation behind this concepts, before we see the big picture (project planning) next time.

Enlightened Perl Organisation sponsors Strawberry Perl

I am pleased to announce that Enlightened Perl Organisation (EPO) has kindly extended the support of Strawberry Perl project by sponsoring our build server for another 12 months. I would like to thank Mark Keating for arranging the funding.

If you are also considering supporting Strawberry Perl project you can do it indirectly by becoming EPO member or via donating EPO.

Data::Edit::Xml

https://metacpan.org/pod/Data::Edit::Xml provides a Perl centric means of editing data held in Xml format. Thus: my $a = Data::Edit::Xml::new(" "); say STDERR -p $a; gives: To cut out c under b but not under d : $a x= sub {--$_ if $_ <= [qw(c b a)]}; say STDERR -p $a; gives:

Perl 5 Porters Mailing List Summary: August 29th - September 4th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week.

Enjoy!

Barcelona Perl Mongers Meetup!

I had the honor to give a talk at Barcelona.pm Meetup. Perl community rocks as everybody knows; my new friends welcomed me and my family. We felt home, learned new things, enjoyed the nice dinner and it became the most memorable night in Barcelona.

I can't wait to visit Barcelona Perl Workshop.

Slides will be posted once I clean them up.

IMG_2070.jpg

SPVM Language Specification. I start to write it Today.

I start to write SPVM Language Specification.

SPVM Language Specification(Beta before 1.0)

SPVM array operation is 6x faster than Perl 5.26 now. If JIT is implemented, array operation maybe 20x faster than Perl 5.26. This is planed in one year.

SPVM provide you,

-You can write Fast culculation without XS
-You can bind C library without XS
-You can write C language inline without Inline::C

XS is very complex and difficult. SPVM improve usability of C binding and inline significantly.

SPVM communicate with Perl. You can call SPVM subroutine from Perl. SPVM is not single lauguage. You can call SPVM subroutine from Perl very easy.

Rakudo.js update - passes 56%+ of roast tests

Rakudo.js now passes roughly of 56%+ roast test files.
I'm currently working on fixing up the remaining ones.
Getting some of them to work is requiring fairly deep changes.
For example native values need to be passed specially and maybe boxed in the called sub/method rather than boxed on the side of the callers. As that causes wide spread changes it can cause some rather annoying debugging when something is not exactly right and compiling the setting explodes :)
I had a talk at TPC::EU (link to slides).
As part of an electron+react demo for the talk I started working on a JSX slang for Perl 6 (https://github.com/pmurias/p6-jsx/blob/master/01-basic.t).
BTW. slangs already work on rakudo.js :)
In other news the --source-map option in rakudo.js and nqp.js now puts in line and file numbers in our backtraces.

prototypes vs branches (CP part II)

As previously mentioned, one principle of Complete Programming is the separation of concerns you normally handle simultaneously. In part two I discuss some further consequences of that and how we use version control in CP.

"inf" doesn't work everywhere, apparently

I've just got this CPAN Testers report which says that my module Compress::Huffman had an error due to $minkey not being set to any value on line 176. Tracing this back, it seems to be due to the use of the word 'inf' on line 166, then this being not converted to infinity but to zero for some reason, and $minkey never getting set.

I don't remember where I got the idea to use 'inf' for infinity, but I'm switching over to the method given here of using 9**9**9 instead.

Incidentally, for those interested in the Huffman algorithm, $minkey here is the least probable key, and its probability is $min, which is set to the value of infinity at the start so that every key will have a lower value than it.

the core idea behind Complete Programming (tm)(c)

During my last post I mentioned the method of Complete Programming, which started as my knee jerk reaction to the insanities of waterfall and XP. I'm not really big on manifestos but writing down things helps to think clearly and so you might also benefit from thinking about one important principle in CP.

Perl6 - NativeCall, using the native trait correctly

I saw a lot of confusion with what should be passed to the native trait when working on binding a C function from a library using NativeCall.

One important thing to remember is Perl 6 trait are solved at compile time. This is important because every value passed to a trait take their compile time value.

use NativeCall;
my $foo = "a";
sub foo is native($foo) {*}

This will fail to compile since native does not take Any has a valid type. Even if $foo can be checked as being a Str, its compile time type is Any. Easy to check with a BEGIN block.

<Skarsnik> m: use NativeCall; my $foo = "a"; say $foo.^name
<evalable6> Skarsnik, rakudo-moar 79604a880: OUTPUT: «Str»
<Skarsnik> m: use NativeCall; my $foo = "a"; BEGIN {say $foo.^name};
<evalable6> Skarsnik, rakudo-moar 79604a880: OUTPUT: «Any»

It's actually explained in NativeCall documentation

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.