Mailing List Archive

standard Perl
On 2/17/24 09:36, Ovid wrote:
> ... https://metacpan.org/pod/standard ...


Thank you for mentioning the Perl module "standard".


Going a short way down the rabbit hole, I see:

https://metacpan.org/pod/standard

https://metacpan.org/pod/Guacamole

https://blogs.perl.org/users/jeffrey_kegler/2011/11/what-is-the-marpa-algorithm.html

https://metacpan.org/dist/Marpa-R2/view/pod/Marpa_R2.pod

https://metacpan.org/dist/Marpa-R2/view/pod/Scanless/DSL.pod


So, a domain specific language (DSL) for describing programming
languages according to their grammar, a DSL grammatical description of a
programming language similar to Perl that fits within the constraints of
the DSL and related tools, a module for validating the syntax of
programs written in this variant Perl, a module capable of producing
parser/evaluator objects per a DSL grammatical description, and those
objects are capable of running programs written in the described
programming language (notably, the Perl variant) (?).


Future plans include modifying the Perl variant DSL grammatical
description to facilitate learning, usage, and security, to facilitate
language additions (such as macros), and to facilitate tool chain
improvements (such as IDE integration)?


I would be interested in a compiler. Would "standard" and related
support this?


How do "standard" and related compare to RPerl?

https://metacpan.org/dist/RPerl/view/script/rperl


David
Re: standard Perl [ In reply to ]
On 2024-02-18 4:00 p.m., David Christensen wrote:
> On 2/17/24 09:36, Ovid wrote:
>> ... https://metacpan.org/pod/standard ...
> How do "standard" and related compare to RPerl?
>
> https://metacpan.org/dist/RPerl/view/script/rperl

All I know of "standard" is what you just said and what I read at
https://metacpan.org/pod/standard . I have a small familiarity with RPerl from
having read about it but not having actually used it.

As I can see it, "standard" basically is a restricted subset of normal Perl that
excludes maybe 1-2% or at most 5%, where this gains greater ease in having
alternate implementations of Perl. It is mainly about making parsing less
complicated, but at runtime its essentially the same.

In contrast, as I understand it, RPerl is basically C++ in Perl clothing. It
has different levels of support depending on how you write your Perl. If you
write "low magic Perl" which basically cuts out 50% of the language, and also
add a lot of type annotations resembling C++ or hardware-level types, then your
code can be transpiled to C++ and run as fast as a C++ program, which is orders
of magnitude eg 100X faster than the Perl otherwise would be. So you make more
changes but get a huge speed boost, which is the main point of RPerl, speed. In
contrast if you write "medium or high magic Perl", then RPerl would do less for
you, if it works at all, still linking in the standard Perl interpreter. The
main difference between "low magic" and higher is the non-use or use of generic
types that are resolved at runtime, such as what Perl scalars or Perl's type
system in general supports. Or something, I'm not an expert here, but that's
the vague idea I have.

In a nutshell, they are very different things.

-- Darren Duncan
Re: standard Perl [ In reply to ]
On Mon, Feb 19, 2024 at 1:48?AM Darren Duncan <darren@darrenduncan.net>
wrote:


> In contrast, as I understand it, RPerl is basically C++ in Perl clothing.
> It
> has different levels of support depending on how you write your Perl. If
> you
> write "low magic Perl" which basically cuts out 50% of the language, and
> also
> add a lot of type annotations resembling C++ or hardware-level types, then
> your
> code can be transpiled to C++ and run as fast as a C++ program, which is
> orders
> of magnitude eg 100X faster than the Perl otherwise would be.


Correct me if I'm wrong (I very well might be), but RPerl really doesn't
let you do much of anything, does it? Last I've heard, for example, you
couldn't even read from a database, making it pretty useless to just about
anyone doing serious work. I've also asked if any companies use it, but
I've received no response. I don't think it's used anywhere. I've heard of
one project where someone was hired to see if they could make RPerl useful
for a company, but failed.

RPerl looks to me an awful lot like a beginning comp-sci transpiler project
that got out of control. I also understand that RPerl doesn't let you use
most of C++, either. So you have a crippled subset of Perl—with a bunch of
werid annotations layered on top—being used as a scripting language to
write a crippled subset of C++. I can't understand why anyone would find
that compelling.

If, however, it could do everything Perl (or C++) could do, it might be
worth looking into. I would love to see *any* evidence that it's useful for
business.

Best,
Ovid
Re: standard Perl [ In reply to ]
On 2024-02-18 10:10 p.m., Ovid wrote:
> On Mon, Feb 19, 2024 at 1:48?AM Darren Duncan wrote:
> In contrast, as I understand it, RPerl is basically C++ in Perl clothing.  It
> has different levels of support depending on how you write your Perl.  If you
> write "low magic Perl" which basically cuts out 50% of the language, and also
> add a lot of type annotations resembling C++ or hardware-level types, then your
> code can be transpiled to C++ and run as fast as a C++ program, which is orders
> of magnitude eg 100X faster than the Perl otherwise would be.
>
> Correct me if I'm wrong (I very well might be), but RPerl really doesn't let you
> do much of anything, does it? Last I've heard, for example, you couldn't even
> read from a database, making it pretty useless to just about anyone doing
> serious work.

Well, lots of useful functionality including reading from a database ALSO can't
be done by the language itself with regular Perl or C++ either, and instead is
enabled by other code used WITH the language. So in that sense, RPerl is at the
same level.

I was speaking more to the core language as I understand it rather than the
whole ecosystem.

So RPerl is not a replacement for the whole Perl ecosystem, but rather is its
own language that is inspired by Perl and C++ bringing a kind of hybrid of both,
and which lacks a comprehensive mature ecosystem, so what you can do with it is
more limited to problem spaces that can be solved using a core language, like
algorithm type problems.

> I've also asked if any companies use it, but I've received no
> response. I don't think it's used anywhere. I've heard of one project where
> someone was hired to see if they could make RPerl useful for a company, but failed.
>
> RPerl looks to me an awful lot like a beginning comp-sci transpiler project that
> got out of control. I also understand that RPerl doesn't let you use most of
> C++, either. So you have a crippled subset of Perl—with a bunch of werid
> annotations layered on top—being used as a scripting language to write a
> crippled subset of C++. I can't understand why anyone would find that compelling.
>
> If, however, it could do everything Perl (or C++) could do, it might be worth
> looking into. I would love to see /any/ evidence that it's useful for business.

I'm not going to argue that RPerl is actually useful as is for most business
cases that currently are handled by either Perl or C++. I was just trying to
answer the asked question on how "standard" Perl and RPerl compared.

My bottom line in my original response still stands, that "standard" and RPerl
are very different from each other, and do not just have small differences.

-- Darren Duncan
Re: standard Perl [ In reply to ]
On 2/18/24 23:18, Darren Duncan wrote:
> On 2024-02-18 10:10 p.m., Ovid wrote:
>> On Mon, Feb 19, 2024 at 1:48?AM Darren Duncan wrote:
>>     In contrast, as I understand it, RPerl is basically C++ in Perl
>> clothing.  It
>>     has different levels of support depending on how you write your
>> Perl.  If you
>>     write "low magic Perl" which basically cuts out 50% of the
>> language, and also
>>     add a lot of type annotations resembling C++ or hardware-level
>> types, then your
>>     code can be transpiled to C++ and run as fast as a C++ program,
>> which is orders
>>     of magnitude eg 100X faster than the Perl otherwise would be.
>> Correct me if I'm wrong (I very well might be), but RPerl really
>> doesn't let you do much of anything, does it? Last I've heard, for
>> example, you couldn't even read from a database, making it pretty
>> useless to just about anyone doing serious work.
>
> Well, lots of useful functionality including reading from a database
> ALSO can't be done by the language itself with regular Perl or C++
> either, and instead is enabled by other code used WITH the language.  So
> in that sense, RPerl is at the same level.
>
> I was speaking more to the core language as I understand it rather than
> the whole ecosystem.
>
> So RPerl is not a replacement for the whole Perl ecosystem, but rather
> is its own language that is inspired by Perl and C++ bringing a kind of
> hybrid of both, and which lacks a comprehensive mature ecosystem, so
> what you can do with it is more limited to problem spaces that can be
> solved using a core language, like algorithm type problems.
>
>> I've also asked if any companies use it, but I've received no
>> response. I don't think it's used anywhere. I've heard of one project
>> where someone was hired to see if they could make RPerl useful for a
>> company, but failed.
>>
>> RPerl looks to me an awful lot like a beginning comp-sci transpiler
>> project that got out of control. I also understand that RPerl doesn't
>> let you use most of C++, either. So you have a crippled subset of
>> Perl—with a bunch of werid annotations layered on top—being used as a
>> scripting language to write a crippled subset of C++. I can't
>> understand why anyone would find that compelling.
>>
>> If, however, it could do everything Perl (or C++) could do, it might
>> be worth looking into. I would love to see /any/ evidence that it's
>> useful for business.
>
> I'm not going to argue that RPerl is actually useful as is for most
> business cases that currently are handled by either Perl or C++.  I was
> just trying to answer the asked question on how "standard" Perl and
> RPerl compared.
>
> My bottom line in my original response still stands, that "standard" and
> RPerl are very different from each other, and do not just have small
> differences.
>
> -- Darren Duncan


Thank you both for the discussion. :-)


I recall evaluating RPerl several years ago and coming to the conclusion
that it was too restricted for my coding style (functional) and goals
(concurrent, distributed).


Are "standard" and related any better?


Do "standard" and related have an ecosystem that is sufficient for "real
work"?


Will "standard" and related lead to a compiler?


David
Re: standard Perl [ In reply to ]
On 2024-02-19 12:02 a.m., David Christensen wrote:
> I recall evaluating RPerl several years ago and coming to the conclusion that it
> was too restricted for my coding style (functional) and goals (concurrent,
> distributed).
>
> Are "standard" and related any better?
>
> Do "standard" and related have an ecosystem that is sufficient for "real work"?
>
> Will "standard" and related lead to a compiler?

What I've gleaned about "standard" by itself from
https://metacpan.org/pod/standard is that it is effectively just like a perl
critic policy, in that all it does is prevent you from using 1-2% of the
available Perl syntax in your own codebase.

But then a consequence of this is that it is easier for alternate
implementations of Perl to run your codebase, where they otherwise couldn't with
the presence of that 1-2%.

So with "standard" you still have all the same functionality as regular Perl,
and that is compatible with regular Perl.

This means that in principle it is easier to make a compiler for that Perl code,
but I'm not aware that a compiler actually exists for it today.

-- Darren Duncan
Re: standard Perl [ In reply to ]
On Mon, Feb 19, 2024 at 9:02?AM David Christensen <dpchrist@holgerdanske.com>
wrote:

> Thank you both for the discussion. :-)
>
> I recall evaluating RPerl several years ago and coming to the conclusion
> that it was too restricted for my coding style (functional) and goals
> (concurrent, distributed).
>
> Are "standard" and related any better?
>
> Do "standard" and related have an ecosystem that is sufficient for "real
> work"?
>
> Will "standard" and related lead to a compiler?
>

"standard" just uses a grammar to define a subset of Perl that is still
100% capable of doing everything Perl does. I doubt a compiler would happen
because you'd have to translate tons of CPAN modules to use standard.
However, such a compiler would be amazing because you could then build
tooling support which is not currently possible.

You can use standard.pm now and it perfectly interacts with other CPAN
modules because its effects are lexically scoped. All it does is make sure
your code conforms to a statically parseable subset.
https://metacpan.org/pod/standard#DIFFERENCES

Note that as far as I can tell, the project is abandoned. I could be
mistaken about that.

Best,
Ovid
Re: standard Perl [ In reply to ]
On Mon, 19 Feb 2024 01:48:45 +0100, Darren Duncan <darren@darrenduncan.net> wrote:

> On 2024-02-18 4:00 p.m., David Christensen wrote:
>> On 2/17/24 09:36, Ovid wrote:
>>> ... https://metacpan.org/pod/standard ...
>> How do "standard" and related compare to RPerl?
>>
>> https://metacpan.org/dist/RPerl/view/script/rperl
>
> All I know of "standard" is what you just said and what I read at
> https://metacpan.org/pod/standard . I have a small familiarity with RPerl from
> having read about it but not having actually used it.
>
> As I can see it, "standard" basically is a restricted subset of normal Perl that
> excludes maybe 1-2% or at most 5%,

It may exclude little of the syntax, but those exclusions also block like 90% of existing Perl code, so i don't think is of any use but a curiosity.

Kind of annoying to see those folks spend time on that instead of trying to help me improve PPI, which is actively used in production.

--
With regards,
Christian Walde
Re: standard Perl [ In reply to ]
On 2024-02-19 11:37, Christian Walde wrote:
> On Mon, 19 Feb 2024 01:48:45 +0100, Darren Duncan
> <darren@darrenduncan.net> wrote:
>> On 2024-02-18 4:00 p.m., David Christensen wrote:
>>> On 2/17/24 09:36, Ovid wrote:
>>>> ... https://metacpan.org/pod/standard ...
>>> How do "standard" and related compare to RPerl?
>>> https://metacpan.org/dist/RPerl/view/script/rperl
>>
>> All I know of "standard" is what you just said and what I read at
>> https://metacpan.org/pod/standard .  I have a small familiarity with
>> RPerl from
>> having read about it but not having actually used it.
>>
>> As I can see it, "standard" basically is a restricted subset of
>> normal Perl that
>> excludes maybe 1-2% or at most 5%,
>
> It may exclude little of the syntax, but those exclusions also block
> like 90% of existing Perl code, so i don't think is of any use but a
> curiosity.
>
> Kind of annoying to see those folks spend time on that instead of
> trying to help me improve PPI, which is actively used in production.

To me it doesn't look hard to migrate existing code to what "standard"
requires,
and I know a lot of Perl code, from many origins.

Having PPI rules to flag the "standard" issues, will of course help with
that.
Also with the automated part of such a migration!

What it comes down to, is that "standard" should use PPI,
to make any migration of some decently sized code base to "standard"
feasible.
PPI doesn't need standard, but will certainly facilitate it.

-- Ruud
Re: standard Perl [ In reply to ]
Hey David,

TL;DR:

* Standard Perl provides guidelines for writing clear and unambiguous
Perl code. It aims to improve readability and parsability for both
humans and machines. It focuses on writing Perl in a way that reduces
syntax complexity without changing the language's essence. It's not a
new Perl, just a suggestion on how to write Perl more clearly so we
can build strong tools for it.
* Guacamole, utilizing the Marpa parser, is one such tool designed to
parse Perl code that follows the "standard" guidelines into a
structured format. This enables advanced code analysis, refactoring,
and generation by understanding the code's structure and intent. You
still run it with perl as you did before - that part doesn't change.
It also doesn't remove Perl features. Those are all still supported
since you're still running it with the perl interpreter.
* RPerl differs significantly as it is a parser that translates Perl
code into C++. It requires adherence to a specific subset of the Perl
language, offering speed at the expense of the broader Perl syntax's
flexibility and compatibility.

Below is a much more detailed answer, trying to break down all the
elements. Sorry for how tedious it is. If the TL;DR is enough, please
ignore the rest. :)

On Mon, Feb 19, 2024 at 1:01?AM David Christensen
<dpchrist@holgerdanske.com> wrote:
>
> On 2/17/24 09:36, Ovid wrote:
> > ... https://metacpan.org/pod/standard ...
>
>
> Thank you for mentioning the Perl module "standard".
>
>
> Going a short way down the rabbit hole, I see:
>
> https://metacpan.org/pod/standard
>
> https://metacpan.org/pod/Guacamole
>
> https://blogs.perl.org/users/jeffrey_kegler/2011/11/what-is-the-marpa-algorithm.html
>
> https://metacpan.org/dist/Marpa-R2/view/pod/Marpa_R2.pod
>
> https://metacpan.org/dist/Marpa-R2/view/pod/Scanless/DSL.pod
>
>
> So, a domain specific language (DSL) for describing programming
> languages according to their grammar, a DSL grammatical description of a
> programming language similar to Perl that fits within the constraints of
> the DSL and related tools, a module for validating the syntax of
> programs written in this variant Perl, a module capable of producing
> parser/evaluator objects per a DSL grammatical description, and those
> objects are capable of running programs written in the described
> programming language (notably, the Perl variant) (?).
>
>
> Future plans include modifying the Perl variant DSL grammatical
> description to facilitate learning, usage, and security, to facilitate
> language additions (such as macros), and to facilitate tool chain
> improvements (such as IDE integration)?
>
>
> I would be interested in a compiler. Would "standard" and related
> support this?

There are multiple parts involved here:
* Syntax: Just the rules of what the language looks like, how to write
a function call or declare a function, etc.
* Parser: Breaking down the string that represents the code into a
tree of operations ("there's an addition with two variables")
* Virtual Machine (VM): Running the operations that the parser recognized

The Perl language has "perl" - an interpreter which parses and runs
Perl code. Putting aside the "running" part of it - just parsing Perl
itself - is famously practically impossible. This is because Perl has
syntax which can be interpreted in multiple ways (i.e, ambiguous) and
only by running the code (or enough code), you would be able to
resolve it.

A good example of this is prototypes, which tell perl how to parse the
rest of the code. "When you see this function, you parse the rest of
the code after it in the following manner."

Example code: foo bar 1, { a => 2 }

This code is ambiguous. Without knowing the prototype for the "foo()"
and "bar()" subroutines, you are not entirely sure what's going on.
The perl interpreter has the same problem.

* Does the "bar()" subroutine receive two parameters ("1" and "{ a =>
2 }") or does it only get "1" and the "foo()" subroutine get the
result of "bar()" as a first parameter and "{ a => 2 }" as a second
parameter?
* Is "{ a => 2 }" a coderef or a hashref? When you look at it now,
it's a hashref, but what about "{ ( a => 2 ) }"? That's a coderef.
What about "{; a => 2 }"? Coderef again. Anyway, confusing.
* Oh, and if you accidentally put a newline between "{" and "a", the
"a" will be called as a subroutine, rather than automatically treated
as a string.

So to resolve these options (at least the first one), the perl
interpreter will load the code that defines the prototypes for "foo()"
and "bar()", executing any BEGIN {} block it finds along the way, and
then be able to parse the rest.

The syntax of Perl is quite vast which creates this problem. However,
instead of purposefully keeping this ambiguous by cutting down chars,
you can keep some characters and make it clearer:

> foo( bar(1), +{ "a" => 2 } )
> foo( bar( 1, +{ "a" => 2 } ) )

Both of these ways are still compliant with the Perl syntax (the
definition of the language) and they will be executed perfectly fine -
exactly the same way as before, except they leave no room for
ambiguity. The parentheses make it clear which are the parameters for
which function. It's also clear these are functions. An added benefit
is that the perl interpreter knows what was supposed to happen, so if
there's an issue, it will give you a better error:

$ perl -e'foo( 1, +{ "a" => 2 } )'
Undefined subroutine &main::foo called at -e line 1.

$ perl -e'foo 1, +{ "a" => 2 }'
Number found where operator expected at -e line 1, near "foo 1"
(Do you need to predeclare foo?)
syntax error at -e line 1, near "foo 1"
Execution of -e aborted due to compilation errors.

In the first case, we told perl that "foo()" is a subroutine. We were
clear on which were the parameters. When we tried running it, it knew
that subroutine was not available and it told you exactly that.

In the second case, perl had a parsing error in which it's not exactly
clear what happened. It says "there's a symbol here called foo that
I'm not familiar with." Yeah, it helps if you're technical enough to
understand, but otherwise, you're not necessarily sure what happened.
perl isn't necessarily sure either. We're not even getting into issues
with indirect notation, in which perl thinks it could've been
something entirely different and then gives you an error for this
entirely different syntax which you didn't necessarily even know was a
thing.

Standard Perl is a document that suggests how to write Perl in a way
that doesn't confuse perl or developers. It says "don't write foo 1,
but instead foo(1)". That's basically it. Not all of its suggestions
are well received. We're gotten accustomed to not quoting strings in
various cases (left of "=>" and as keys in hash access), but those
also provide room for ambiguity. Imagine "sub foo {'hello'}
$hash{foo}" - you might say "oh, the key is foo" but another developer
might assume it calls the subroutine foo and the key is hello. What
about "$hash{+foo}" or "$hash{-foo}" - you might think however these
behave, it's the same, but that's not true. Plus does something
different than minus for the parsing. Standard Perl says "just quote
all strings". It makes it easier to read and easier to parse.

There are a lot of other benefits besides "not confusing developers"
and "getting better warnings and errors from the parser."

If you can understand every code you see without having to run any of
it, you can use a program to analyze it. That's where Guacamole and
Marpa come in. Marpa allows you to define syntax (either using code or
using a BNF string) and it will then parse it for you and create the
tree of operations. You can then use the tree to do what you want.
Guacamole includes the BNF string and a few utilities around that.

When you load the "standard" pragma, it will take your code and try to
parse it with Guacamole. If you wrote your code in a way that's
ambiguous, it will fail and tell you where the issue is. You could
then correct your code. If your code finally loads successfully, it
means you adhered to all of Standard Perl and now you can use
Guacamole utilities against your code.

Guacamole has a few cool tools that use the op tree. It can output
code strings back (like B::Deparse). Since we have a tree of
operations and can generate code from another tree of operations, we
can easily define in code how code should be structured ("a function
called foo with the following parameters") and we could generate this
code. Imagine Perl::Critic finding a problem and rewriting the code
into the correct code. (Or imagine being able to find similar code
based on its operations tree even if the strings are not the same - we
could detect they accomplish the same.)

I tried doing something like this manually with PPI -
Ref::Util::Rewriter. You can see how odd the code is and, despite the
comments, I'm still not sure what I attempted doing in every line of
code or why. Instead, we can easily say "find the following code
structure and replace it with this code structure - now generate that
code string and recreate my program with this new code instead." Some
companies (like Meta) have systems like that which can rewrite vast
amounts of code across the entire code-base with 100% accuracy. It is
definitely a killer feature for a language, which Perl does not have,
but statically parseable languages have.

PPI does document parsing - trying to understand the elements as best
it can, but eventually throwing it to you with a shrug. You can't
blame it, It can't know everything because the code is ambiguous and
PPI can't run code to get enough context. If you read Perl::Critic
policies, you will see a lot of the code with PPI is moving around
trying to figure out what a thing is - just like I'm doing with
Ref::Util::Rewriter. But with Guacamole, you know for sure. There's no
"I don't know, it's just a word - you figure it out." Instead, it
tells you what every element is.


>
>
>
> How do "standard" and related compare to RPerl?
>
> https://metacpan.org/dist/RPerl/view/script/rperl
>

There's a big difference between the two. My memory of RPerl is hazy
(so I might be corrected on the thread), but basically RPerl is a
parser that generates C++ code that compiles to a native binary,
meaning the OS is able to run the program directly instead of needing
a VM as the runner. RPerl doesn't use the "perl" VM for anything. It
doesn't use it to parse or to run. It parses on its own to generate
the corresponding C++ code. So RPerl needs to implement everything it
wants to support from the Perl syntax by itself, which is not easy to
do, because the Perl language can do quite a lot.

Standard Perl is just a document that suggests how to write Perl in a
way that can be statically parsed by anything, including the "perl" VM
or RPerl.

Guacamole is only a parser (using Marpa as the actual parsing
framework), but it also doesn't run it. It just generates a big tree
of operations from the code it reads.

Standard Perl and Guacamole don't move you away from perl, they just
suggest how to write it and - wherever you do write the way it
suggests - it can now provide tooling to do cool stuff. It's still
Perl and you're still running it with perl.

RPerl, on the other hand, says "write this variation of Perl and we
could compile it into C++ and run it really fast"[1]. That variation
isn't just about syntax, but actual features since you are moving away
from perl and run it with RPerl. Guacamole is just a tool on the side.

A different way to see it is:
* If you follow what Standard Perl suggests, nothing in your code
changes other than being more readable (for people and programs). Now
you can use Guacamole to do really cool things, still running your
code exactly as you did until now. Standard Perl supports practically
everything (with few exceptions like prototypes which make your code
ambiguous without adding any new capabilities, speed, or features).
* Standard Perl is also gradual in the sense that, if you follow the
standard for only 10% of your codebase, you can use the Guacamole
utilities on those 10%. Update the rest of your code, and you can use
those utilities there too. It's not an all or nothing approach. The
running is still done by "perl" itself, exactly as before.
* To follow Standard Perl and Guacamole, the Perl language and
interpreter doesn't need any updates or changes. It's just a slightly
more constrained way of writing it. The Perl 5 Porters needn't change
anything for you to just use it.
* Using RPerl is replacing the "perl" binary and you can only use
enough of the Perl features as RPerl supports.

Sawyer.

[1] One such thing it doesn't support as a capability is magic. If you
try to use it, it will not work because RPerl doesn't implement the
concept of magic which the "perl" VM does. Things like DBI will not
run on RPerl. The importance of databases is expressed by others on
the thread already.
Re: standard Perl [ In reply to ]
On Mon, Feb 19, 2024 at 11:38?AM Christian Walde
<walde.christian@gmail.com> wrote:
>
> On Mon, 19 Feb 2024 01:48:45 +0100, Darren Duncan <darren@darrenduncan.net> wrote:
>
> > On 2024-02-18 4:00 p.m., David Christensen wrote:
> >> On 2/17/24 09:36, Ovid wrote:
> >>> ... https://metacpan.org/pod/standard ...
> >> How do "standard" and related compare to RPerl?
> >>
> >> https://metacpan.org/dist/RPerl/view/script/rperl
> >
> > All I know of "standard" is what you just said and what I read at
> > https://metacpan.org/pod/standard . I have a small familiarity with RPerl from
> > having read about it but not having actually used it.
> >
> > As I can see it, "standard" basically is a restricted subset of normal Perl that
> > excludes maybe 1-2% or at most 5%,
>
> It may exclude little of the syntax, but those exclusions also block like 90% of existing Perl code, so i don't think is of any use but a curiosity.

This is true. A lot of code depends on autoquoted strings, prototypes,
etc. However, the vast majority of these can be fixed with a few
regexes and much of the rest with a bit of PPI. Additionally,
Guacamole works one file at a time, so you can use it for a module,
even if all the modules it itself loads don't support it. I've
experimented with this kind of rewriting on a fairly large codebase of
one of the biggest Perl users (whose name does not start with a "B")
and it works. It's pretty cool.

> Kind of annoying to see those folks spend time on that instead of trying to help me improve PPI, which is actively used in production.

Alas, we can't determine what people care about, nor can we make them
care about that one thing we specifically care about.

I will say, if anyone wants to contribute to Guacamole, I'm happy to
help them do so.

S.
Re: standard Perl [ In reply to ]
On Mon, 19 Feb 2024 at 11:38, Christian Walde <walde.christian@gmail.com>
wrote:

> On Mon, 19 Feb 2024 01:48:45 +0100, Darren Duncan <darren@darrenduncan.net>
> wrote:
>
> > On 2024-02-18 4:00 p.m., David Christensen wrote:
> >> On 2/17/24 09:36, Ovid wrote:
> >>> ... https://metacpan.org/pod/standard ...
> >> How do "standard" and related compare to RPerl?
> >>
> >> https://metacpan.org/dist/RPerl/view/script/rperl
> >
> > All I know of "standard" is what you just said and what I read at
> > https://metacpan.org/pod/standard . I have a small familiarity with
> RPerl from
> > having read about it but not having actually used it.
> >
> > As I can see it, "standard" basically is a restricted subset of normal
> Perl that
> > excludes maybe 1-2% or at most 5%,
>
> It may exclude little of the syntax, but those exclusions also block like
> 90% of existing Perl code, so i don't think is of any use but a curiosity.
>

I had a similar thoughts about standard perl when I first read about it,
but then I realized the intention was to try to give a Perl a better chance
at having a long and productive future as opposed to fetishizing long
abandoned code. If it is true that Perl loses market share every year (and
I think it is true) then the existing code-base becomes less and less
relevant. Breaking code nobody uses doesn't matter much does it?


> Kind of annoying to see those folks spend time on that instead of trying
> to help me improve PPI, which is actively used in production.
>

PPI is a great attempt at solving an important problem, thank you for your
efforts, but it doesn't change the calculus of the game. As long as the
only thing that can parse Perl code properly is perl itself, and as long as
popular tooling like VS Code cannot handle the language properly Perl will
be at a major disadvantage in the marketplace. Standard perl is at least
valuable to showing there is an alternative to becoming completely
irrelevant, which seems to be the course it is on now.

I think if the Perl community decided "Ok, we will adopt standard perl" we
would figure out ways to address the code that broke. As Sawyer says
elsewhere most of it can be fixed with regexes and use of tools like PPI,
and the stuff that cant be fixed probably isn't that important anyway.

cheers,
Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"
Re: standard Perl [ In reply to ]
On 2024-03-18 18:38, demerphq wrote:
> On Mon, 19 Feb 2024 at 11:38, Christian Walde
> <walde.christian@gmail.com> wrote:
> [...] Kind of annoying to see those folks spend time on that instead
> of trying to help me improve PPI, which is actively used in production.
>
> PPI is a great attempt at solving an important problem, thank you for
> your efforts,  but it doesn't change the calculus of the game.  As
> long as the only thing that can parse Perl code properly is perl
> itself, and as long as popular tooling like VS Code cannot handle the
> language properly Perl will be at a major disadvantage in the
> marketplace. Standard perl is at least valuable to showing there is an
> alternative to becoming completely irrelevant, which seems to be the
> course it is on now.
>
> I think if the Perl community decided "Ok, we will adopt standard
> perl" we would figure out ways to address the code that broke.  As
> Sawyer says elsewhere most of it can be fixed with regexes and use of
> tools like PPI, and the stuff that cant be fixed probably isn't that
> important anyway.

Another tool being PPR. It was fun watching this (from 2017) once more:
"Three Little Words" - Damian Conway
https://www.youtube.com/watch?v=e1T7WbKox6s

-- Ruud
Re: standard Perl [ In reply to ]
On 3/18/24 06:42, Sawyer X wrote:
> Hey David,
>
> TL;DR:


Thank you for taking the time to write that lengthy explanation. :-)


Over the years, I have been trying to find and use simple and clear
idioms in my Perl code -- to facilitate understanding, to facilitate
correctness. "standard" would seem to take this idea to a higher level,
and enable more sophisticated workflows for compliant code.


Unfortunately, my system does not appear to support "standard":

2024-03-18 13:47:35 root@laalaa ~
# cat /etc/debian_version ; uname -a
11.9
Linux laalaa 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31)
x86_64 GNU/Linux

2024-03-18 13:48:11 root@laalaa ~
# perl -v | head -n 2 | grep .
This is perl 5, version 32, subversion 1 (v5.32.1) built for
x86_64-linux-gnu-thread-multi

2024-03-18 13:48:52 root@laalaa ~
# perl -e 'use standard; 1'
Can't locate standard.pm in @INC (you may need to install the standard
module) (@INC contains: /etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1
/usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32
/usr/share/perl/5.32 /usr/local/lib/site_perl) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.


I cannot determine how to install "standard":

2024-03-18 13:49:43 root@laalaa ~
# apt-cache search libstandard-perl

2024-03-18 13:50:07 root@laalaa ~
# cpan install standard
Reading '/root/.cpan/Metadata'
Database was generated on Mon, 18 Mar 2024 19:41:01 GMT
Could not expand [standard]. Check the module name.
I can suggest names if you install one of Text::Levenshtein::XS,
Text::Levenshtein::Damerau::XS, Text::Levenshtein, and
Text::Levenshtein::Damerau::PP
and you provide the -x option on invocation.
Skipping standard because I couldn't find a matching namespace.


Comments or suggestions?


David
Re: standard Perl [ In reply to ]
On Mon, Mar 18, 2024 at 9:53?PM David Christensen <dpchrist@holgerdanske.com>
wrote:

> Unfortunately, my system does not appear to support "standard":
>
> 2024-03-18 13:47:35 root@laalaa ~
> # cat /etc/debian_version ; uname -a
> 11.9
> Linux laalaa 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31)
> x86_64 GNU/Linux
>
> 2024-03-18 13:48:11 root@laalaa ~
> # perl -v | head -n 2 | grep .
> This is perl 5, version 32, subversion 1 (v5.32.1) built for
> x86_64-linux-gnu-thread-multi
>
> 2024-03-18 13:48:52 root@laalaa ~
> # perl -e 'use standard; 1'
> Can't locate standard.pm in @INC (you may need to install the standard
> module) (@INC contains: /etc/perl
> /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1
> /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5
> /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32
> /usr/share/perl/5.32 /usr/local/lib/site_perl) at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
>
>
> I cannot determine how to install "standard":
>
> 2024-03-18 13:49:43 root@laalaa ~
> # apt-cache search libstandard-perl
> <snip>

Comments or suggestions?
>

It's part of the Guacamole distribution. You can install it with:

cpan Guacamole

However, if you use App::cpanminus, you can install it with:

cpanm standard

And with the above, it will figure out that standard.pm is part of the
Guacamole distribution and install the latter, getting you the "standard"
module (this alone tells us that we need better tooling in the Perl core).

However, standard.pm relies on Guacamole which relies on Marpa, and I don't
see that being approved for the Perl core. If Guacamole *were* in the Perl
core, it would make it (somewhat) easier to convince Perl devs to switch.
For now it's a blocker for the bigger picture, sadly. However, if the Perl
core modules were to switch to standard (which most of them could be), that
could be a huge win if the follow-up tooling were built.

That being said, if you can make *your* code run under standard, I suspect
that would be a good thing. It looks a bit different, but having a regular,
predictable syntax is valuable. I've been hacking on Perl for two decades
and I still see Perl code that I can't figure out without reading far too
much context about it.

Currently I've started using VS Code and it's amazing for Python. For Perl,
it's, um, not amazing. Going down the 'standard' path has huge potential
payoffs for Perl, but I suspect that there are so many Perl devs with
TIMTOWTDI tattoos (or the aspiration) that it will be a hard battle to
fight. I would be delighted to see someone pick up that sword and charge
into the fray.

Best,
Ovid
Re: standard Perl [ In reply to ]
On 2024-03-18 18:38, demerphq wrote:
> fetishizing long abandoned code
If your goal is a marketing initiative i recommend applying a marketing
brain to your messages in a wider sense. :)

--
With regards,
Christian Walde
Re: standard Perl [ In reply to ]
On Mon, Mar 18, 2024 at 10:22?PM Ovid <curtis.poe@gmail.com> wrote:
>
> [...]
>
> However, standard.pm relies on Guacamole which relies on Marpa, and I don't see that being approved for the Perl core. If Guacamole were in the Perl core, it would make it (somewhat) easier to convince Perl devs to switch. For now it's a blocker for the bigger picture, sadly. However, if the Perl core modules were to switch to standard (which most of them could be), that could be a huge win if the follow-up tooling were built.


standard.pm can be split from Guacamole distribution, but since it was
valuable as a pragma that validates the current file it's loaded in,
it might be worth keeping it together.

Guacamole uses Marpa because it was really simple to implement the
BNF-based parser in Marpa. In theory, this can be replaced with any
number of parser generators that support BNF, like Flex/Bison or ANTLR
(or maybe Parse::RecDescent). You could generate a parser (with
Flex/Bison, it will be a small C program) and then write an XS wrapper
to that. This would then be compiled with perl as any other XS-based
module that perl comes with. This would you a blazing-fast Perl module
that parses Perl code, and you could run all the Guacamole utilities
based on that. Pretty cool, but not a simple job.

But even if one (myself or more likely, someone else) were to convert
this to Flex/Bison, introducing it into core would require keeping it
up-to-date. I no longer keep abreast of Perl and its syntax. New
keywords were introduced and those will need to be supported in
Guacamole. (Luckily, Guacamole's BNF does allow specifying a keyword,
the arity, and even infix ops like the fancy new keywords introduced.)
However, putting anything in core adds an onus to the core developers
that few non-core help with, making it an unfair trade. Once it's in
core, it *must* be updated because it's shipping with perl itself.


> That being said, if you can make your code run under standard, I suspect that would be a good thing. It looks a bit different, but having a regular, predictable syntax is valuable. I've been hacking on Perl for two decades and I still see Perl code that I can't figure out without reading far too much context about it.


Not only do you need to deal with ambiguity that requires more
context, but you need to deal with things you didn't even know
existed.

You've probably seen code like:

s@foo@bar@

but did you know that practically any printable char can be used as a
delimiter if you use a space after "s"?

s ZfooZbarZ


> Currently I've started using VS Code and it's amazing for Python. For Perl, it's, um, not amazing. Going down the 'standard' path has huge potential payoffs for Perl, but I suspect that there are so many Perl devs with TIMTOWTDI tattoos (or the aspiration) that it will be a hard battle to fight. I would be delighted to see someone pick up that sword and charge into the fray.


I think once people see the gains in it, it'll be easier to let go of
personal preference, but it's hard to show gains when they are still
theoretical.

With Guacamole, you could:
* Write linting policies with 100% accuracy and very little code
* Write linting for patterns, not exact syntax ("a loop with a query in it")
* Identify duplication in code based on code trees, not exact syntax
strings (there was a linter that tried doing this, I forgot the name)
* Rewrite code en masse: I cannot speak enough of how valuable it is
for a company - rewrite code to a faster version of it, update an
entire codebase to an API change immediately, applying a corrective
patch to the entire codebase, etc. You know, things that make a
language more valuable than not having to quote a string when
accessing a hash key.
* Implement accurate, detailed formatting rules
* Generate ops in other VMs - being able to practically move a Perl
program to be run on top of GraalVM, JVM, WebAssembly, etc. (This is
quite an undertaking, but Ingy achieved it for YAML recently with
YAMLScript, and people have done it with Ruby, Python, and other
languages.)

Not all of it is implemented, but it's all possible. Even for what's
implemented, the code needs to be compatible before the tools can be
used. In this sense, people would need to adhere before they could use
any tool. I'm not sure how to convince people of that, and I stopped
trying.
Re: standard Perl [ In reply to ]
On 3/18/24 14:22, Ovid wrote:
> On Mon, Mar 18, 2024 at 9:53?PM David Christensen wrote:
>> ...
>> I cannot determine how to install "standard":
>> ...
>
> It's part of the Guacamole distribution. You can install it with:
>
> cpan Guacamole
> ...


2024-03-19 03:27:13 root@laalaa ~
# cat /etc/debian_version ; uname -a ; perl -v | head -n 2 | grep .
11.9
Linux laalaa 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31)
x86_64 GNU/Linux
This is perl 5, version 32, subversion 1 (v5.32.1) built for
x86_64-linux-gnu-thread-multi

2024-03-19 03:18:21 root@laalaa ~
# cpan Guacamole
...
Running make install for XSAWYERX/Guacamole-0.008.tar.gz
Manifying 5 pod documents
Installing /usr/local/share/perl/5.32.1/standard.pm
Installing /usr/local/share/perl/5.32.1/Guacamole.pm
Installing /usr/local/share/perl/5.32.1/Guacamole/Deparse.pm
Installing /usr/local/share/perl/5.32.1/Guacamole/Test.pm
Installing /usr/local/share/perl/5.32.1/Guacamole/Dumper.pm
Installing /usr/local/man/man3/Guacamole::Test.3pm
Installing /usr/local/man/man3/Guacamole::Deparse.3pm
Installing /usr/local/man/man3/Guacamole::Dumper.3pm
Installing /usr/local/man/man3/standard.3pm
Installing /usr/local/man/man3/Guacamole.3pm
Appending installation info to
/usr/local/lib/x86_64-linux-gnu/perl/5.32.1/perllocal.pod
XSAWYERX/Guacamole-0.008.tar.gz
/usr/bin/make install -- OK

2024-03-19 03:31:45 root@laalaa ~
# cat hello.pl
use standard;
print "hello, world!\n";

2024-03-19 03:31:48 root@laalaa ~
# perl hello.pl
hello, world!


Thank you. :-)


David
Re: standard Perl [ In reply to ]
> On Mar 19, 2024, at 6:25?AM, Sawyer X <xsawyerx@gmail.com> wrote:
>
> On Mon, Mar 18, 2024 at 10:22?PM Ovid <curtis.poe@gmail.com> wrote:
>
>
>> Currently I've started using VS Code and it's amazing for Python. For Perl, it's, um, not amazing. Going down the 'standard' path has huge potential payoffs for Perl, but I suspect that there are so many Perl devs with TIMTOWTDI tattoos (or the aspiration) that it will be a hard battle to fight. I would be delighted to see someone pick up that sword and charge into the fray.
>
> I think once people see the gains in it, it'll be easier to let go of
> personal preference, but it's hard to show gains when they are still
> theoretical.
>
> With Guacamole, you could:
> * Write linting policies with 100% accuracy and very little code
> * Write linting for patterns, not exact syntax ("a loop with a query in it")
> * Identify duplication in code based on code trees, not exact syntax
> strings (there was a linter that tried doing this, I forgot the name)
> * Rewrite code en masse: I cannot speak enough of how valuable it is
> for a company - rewrite code to a faster version of it, update an
> entire codebase to an API change immediately, applying a corrective
> patch to the entire codebase, etc. You know, things that make a
> language more valuable than not having to quote a string when
> accessing a hash key.
> * Implement accurate, detailed formatting rules
> * Generate ops in other VMs - being able to practically move a Perl
> program to be run on top of GraalVM, JVM, WebAssembly, etc. (This is
> quite an undertaking, but Ingy achieved it for YAML recently with
> YAMLScript, and people have done it with Ruby, Python, and other
> languages.)
>
> Not all of it is implemented, but it's all possible. Even for what's
> implemented, the code needs to be compatible before the tools can be
> used. In this sense, people would need to adhere before they could use
> any tool. I'm not sure how to convince people of that, and I stopped
> trying.

For comparison: Go was designed specifically (in part) to facilitate these sorts of things. It’s one reason for that language’s explosive popularity: writing tooling around the code is relatively easy. I haven’t met any Go programmers who lament being unable to do things like choose a custom regexp delimiter; on the contrary, the language’s uniformity is one of its big selling points.

Not everything about Go is a win, of course :), but in this area I think Perl would do well to move away from “TIMTOWTDI”.

cheers,
-Felipe
Re: standard Perl [ In reply to ]
From the keyboard of demerphq [18.03.24,18:38]:

> On Mon, 19 Feb 2024 at 11:38, Christian Walde <walde.christian@gmail.com>
> wrote:
> On Mon, 19 Feb 2024 01:48:45 +0100, Darren Duncan
> <darren@darrenduncan.net> wrote:
>
> > On 2024-02-18 4:00 p.m., David Christensen wrote:
> >> On 2/17/24 09:36, Ovid wrote:
[...]
> I had a similar thoughts about standard perl when I first read about it,
> but then I realized the intention was to try to give a Perl a better chance
> at having a long and productive future as opposed to fetishizing long
> abandoned code. If it is true that Perl loses market share every year (and
> I think it is true) then the existing code-base becomes less and less
> relevant.  Breaking code nobody uses doesn't matter much does it?

Being bi-polar (as everybody is to some extent), histrionic and whatever
shitty label attached to me claims to tell about me, without knowing any
thing about me whatsoever, it is true what I utter:

Whenever I read "market share" ore some such, I either yawn and done.
Or else, hell breaks loose in my head. For it is the fetishistic aspect
of capital that is literally and objectively going to kill us. Period.

Perl is not meant to have any market share likewise to the cathedral of
Strassbourg. It is.

More explanations available upon request.

cheers,
0--gg-

--
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: standard Perl [ In reply to ]
On Tue, 19 Mar 2024, 14:44 shmem, <gm@qwurx.de> wrote:

> From the keyboard of demerphq [18.03.24,18:38]:
>
> > On Mon, 19 Feb 2024 at 11:38, Christian Walde <walde.christian@gmail.com
> >
> > wrote:
> > On Mon, 19 Feb 2024 01:48:45 +0100, Darren Duncan
> > <darren@darrenduncan.net> wrote:
> >
> > > On 2024-02-18 4:00 p.m., David Christensen wrote:
> > >> On 2/17/24 09:36, Ovid wrote:
> [...]
> > I had a similar thoughts about standard perl when I first read about it,
> > but then I realized the intention was to try to give a Perl a better
> chance
> > at having a long and productive future as opposed to fetishizing long
> > abandoned code. If it is true that Perl loses market share every year
> (and
> > I think it is true) then the existing code-base becomes less and less
> > relevant. Breaking code nobody uses doesn't matter much does it?
>
> Being bi-polar (as everybody is to some extent), histrionic and whatever
> shitty label attached to me claims to tell about me, without knowing any
> thing about me whatsoever, it is true what I utter:
>
> Whenever I read "market share" ore some such, I either yawn and done.
> Or else, hell breaks loose in my head. For it is the fetishistic aspect
> of capital that is literally and objectively going to kill us. Period.
>
> Perl is not meant to have any market share


I'm sorry that you feel like that. I feel differently. Market share is
simply a term that describes how many companies use perl and how prevalent
perl programming jobs are, and how many schools teach people the language.

You may not care that there are less and less opportunities to get paid to
write perl, you may not care that there are less and less reasons to learn
to program perl, but I think I am not alone in being concerned about this.

Yves

>
>
Re: standard Perl [ In reply to ]
On Tue, 19 Mar 2024 15:16:08 +0100
demerphq <demerphq@gmail.com> wrote:

> On Tue, 19 Mar 2024, 14:44 shmem, <gm@qwurx.de> wrote:
> > Whenever I read "market share" ore some such, I either yawn and
> > done. Or else, hell breaks loose in my head. For it is the
> > fetishistic aspect of capital that is literally and objectively
> > going to kill us. Period.
> >
> > Perl is not meant to have any market share
>
>
> I'm sorry that you feel like that. I feel differently. Market share is
> simply a term that describes how many companies use perl and how
> prevalent perl programming jobs are, and how many schools teach
> people the language.
>
> You may not care that there are less and less opportunities to get
> paid to write perl, you may not care that there are less and less
> reasons to learn to program perl, but I think I am not alone in being
> concerned about this.

While I try not to wade into these debates too much, I do want to say a
brief reply on this.

While things like market share and "how many people are using perl" are
useful things to keep an eye on, I wouldn't want to see Perl lose its
individuality by trying to chase the fads of the day and just be like
everyone else.

For me, Perl's one killer feature beyond everything else, has been its
deep level of extensibility. PL_keyword_plugin is the first thing that
comes to mind, but also OP_CUSTOM, PERL_MAGIC_ext, the mutability of the
PL_ppaddr[] array, my new PL_infix_plugin, etc... The only reason I am
here in core perl writing lots of core things is from all the
interesting hackery I wrote that became first many Syntax::Keyword::*
modules (and async/await and Object::Pad), all of which was only
possible because of this deep focus on extensibility. The reason I
added PL_infix_plugin was to continue to permit this kind of thing in
the future.

One thing that does worry me somewhat about this current focus on
static parsing of source code at rest, is how well it will handle such
extension mechanisms - I can't imagine it will go at all well. If the
cost of using this static-analysis tooling is that now nobody can use
any of these extended features from third-party modules, then I fear
that Perl loses a big chunk of its reason to be - that extensibility.
And in doing so, we'll lose a big experimental playground where folks
try out a new class of features that can become future language.
((Yes I worded it like that on purpose ;) ))

If you have to be constrained by only what was provided by the core
language of a few years ago in order to use any of the tooling, then
what benefit does Perl give you that you couldn't get out of
Javascript, Python, ... any of that other crowd?

It is well-known and well-acknowledged that "Only perl can parse Perl",
but what goes along with that is, if we have all these extensibility
features, then "Today's perl can parse tomorrow's Perl"

Please don't break that.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: standard Perl [ In reply to ]
From the keyboard of demerphq [19.03.24,15:16]:
[...]
> I'm sorry that you feel like that. I feel differently. Market share is
> simply a term that describes how many companies use perl and how prevalent
>t perl programming jobs are, and how many schools teach people the language. 

I don't care about companies and their struggle to fulfill capitalistic
interests. I don't care about prevalence any more that I care of prevalence
of the covid19 virus. I don't care about schools which I detested ever since
I got into one the first time. I don't care about jobs, since I care about
what the job means and what it is up to, what its impact is in the real world.
I don't care about payment, about money. Fuck that.

> You may not care that there are less and less opportunities to get paid to
> write perl, you may not care that there are less and less reasons to learn
> to program perl, but I think I am not alone in being concerned about this.

True. I don't care about opportunities as much as I care for reasons, and
there are more and more reasons every day to get expertise of and program
in perl. I am very concerned about life and love, and perl is part of this.

0--gg-

--
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: standard Perl [ In reply to ]
On Tue, 19 Mar 2024 at 15:33, Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

> On Tue, 19 Mar 2024 15:16:08 +0100
> demerphq <demerphq@gmail.com> wrote:
>
> > On Tue, 19 Mar 2024, 14:44 shmem, <gm@qwurx.de> wrote:
> > > Whenever I read "market share" ore some such, I either yawn and
> > > done. Or else, hell breaks loose in my head. For it is the
> > > fetishistic aspect of capital that is literally and objectively
> > > going to kill us. Period.
> > >
> > > Perl is not meant to have any market share
> >
> >
> > I'm sorry that you feel like that. I feel differently. Market share is
> > simply a term that describes how many companies use perl and how
> > prevalent perl programming jobs are, and how many schools teach
> > people the language.
> >
> > You may not care that there are less and less opportunities to get
> > paid to write perl, you may not care that there are less and less
> > reasons to learn to program perl, but I think I am not alone in being
> > concerned about this.
>
> While I try not to wade into these debates too much, I do want to say a
> brief reply on this.
>
> While things like market share and "how many people are using perl" are
> useful things to keep an eye on, I wouldn't want to see Perl lose its
> individuality by trying to chase the fads of the day and just be like
> everyone else.
>
> For me, Perl's one killer feature beyond everything else, has been its
> deep level of extensibility. PL_keyword_plugin is the first thing that
> comes to mind, but also OP_CUSTOM, PERL_MAGIC_ext, the mutability of the
> PL_ppaddr[] array, my new PL_infix_plugin, etc... The only reason I am
> here in core perl writing lots of core things is from all the
> interesting hackery I wrote that became first many Syntax::Keyword::*
> modules (and async/await and Object::Pad), all of which was only
> possible because of this deep focus on extensibility. The reason I
> added PL_infix_plugin was to continue to permit this kind of thing in
> the future.
>
> One thing that does worry me somewhat about this current focus on
> static parsing of source code at rest, is how well it will handle such
> extension mechanisms - I can't imagine it will go at all well. If the
> cost of using this static-analysis tooling is that now nobody can use
> any of these extended features from third-party modules, then I fear
> that Perl loses a big chunk of its reason to be - that extensibility.
> And in doing so, we'll lose a big experimental playground where folks
> try out a new class of features that can become future language.
> ((Yes I worded it like that on purpose ;) ))
>

Part of the problem with Perl is that the mechanism for extending the
language is turing complete. If there is one thing I think Perl got wrong
it is that we have too many ways to extend the language and it is too hard
to tell how that extension works. We really dont and didnt need 20
different ways to export a sub from one package to another.

When I use VS code to work on Javascript code it can detect all of
the exported functions available in the files that I depend on. It can tell
what files export what, and help me write my code correctly. Perl makes
doing stuff like that very hard to impossible.

So, /if/ we were to embrace something like standard perl, AND we were to
extend the language to have a standardized way of annotating the extensions
that the language supports then I think we could have our cake and eat it
too.

I also think it is great that Perl can support additional keywords, etc,
etc. All we would need to make this statically analyzable would be a
standard way to annotate that a module did this. The point being that I
dont want to remove your ability to extend the language I want to see perl
decide on a standard way that we do so.


>
> If you have to be constrained by only what was provided by the core
> language of a few years ago in order to use any of the tooling, then
> what benefit does Perl give you that you couldn't get out of
> Javascript, Python, ... any of that other crowd?
>

The problem is these days there really isnt much that Perl can give you
that Javascript can. (Heretical as that may sound to people on this list).
On the other hand, there are a ton of things that I get by using Javascript
that I cant have with Perl.


>
> It is well-known and well-acknowledged that "Only perl can parse Perl",
>

IMO this is an unforced error of language design that is a big part of the
reason the language is in terminal decline.


> but what goes along with that is, if we have all these extensibility
> features, then "Today's perl can parse tomorrow's Perl"
>
> Please don't break that.
>

I dont /want/ to break anything but I personally would willing to break
some things if the trade off for the language is another 10 or 20 years of
vibrant usage.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"
Re: standard Perl [ In reply to ]
On 2024-03-19 15:32, Paul "LeoNerd" Evans wrote:
> The only reason I am
> here in core perl writing lots of core things is from all the
> interesting hackery I wrote that became first many Syntax::Keyword::*
> modules (and async/await and Object::Pad), all of which was only
> possible because of this deep focus on extensibility. The reason I
> added PL_infix_plugin was to continue to permit this kind of thing in
> the future.
>
> One thing that does worry me somewhat about this current focus on
> static parsing of source code at rest, is how well it will handle such
> extension mechanisms - I can't imagine it will go at all well. If the
> cost of using this static-analysis tooling is that now nobody can use
> any of these extended features from third-party modules, then I fear
> that Perl loses a big chunk of its reason to be - that extensibility.
> And in doing so, we'll lose a big experimental playground where folks
> try out a new class of features that can become future language.
> ((Yes I worded it like that on purpose ???? ))
>
> If you have to be constrained by only what was provided by the core
> language of a few years ago in order to use any of the tooling, then
> what benefit does Perl give you that you couldn't get out of
> Javascript, Python, ... any of that other crowd?
>
> It is well-known and well-acknowledged that "Only perl can parse Perl",
> but what goes along with that is, if we have all these extensibility
> features, then "Today's perl can parse tomorrow's Perl"
>
> Please don't break that.

Your work (particularly async/await) is the one single sole thing that
keeps me sane at my current $work, and as such, but also based on the
fact that your logic is sound, i agree wholeheartedly with everything
you said.

<3

--
With regards,
Christian Walde

1 2  View All