[HN Gopher] 93% of paint splatters are valid Perl programs (2019)
       ___________________________________________________________________
        
       93% of paint splatters are valid Perl programs (2019)
        
       Author : ellieh
       Score  : 469 points
       Date   : 2024-04-29 11:30 UTC (1 days ago)
        
 (HTM) web link (www.mcmillen.dev)
 (TXT) w3m dump (www.mcmillen.dev)
        
       | stcredzero wrote:
       | "is it possible to smear paint on the wall without creating valid
       | Perl?"
       | 
       | This is just a matter of syntax, right? So could it be determined
       | by a stack machine? Unfortunately, the answer is no. Perl is not
       | context free!
       | 
       | https://perlmonks.org/?node_id=663393
       | 
       | As just a guess, this question maps to the Halting Problem.
       | (EDIT: That would have to be the question where the input is a
       | programming language, not just for Perl. That question has been
       | answered empirically.)
        
       | mrighele wrote:
       | Now I am wondering the percentage of programs written in Piet [1]
       | that are also valid Perl programs, and if there is any instance
       | where the are two are actually the same.
       | 
       | [1] https://esolangs.org/wiki/Piet
        
       | tromp wrote:
       | Concatenative languages [1] have the property that every token
       | sequence is a valid program.
       | 
       | For languages using single bits as tokens, every bit sequence is
       | a valid program. One such language is Chris Barker's zot [2].
       | 
       | Inspired by zot, I defined a concatenative version of Binary
       | Lambda Calculus that shares the same property [3].
       | 
       | [1]
       | https://en.wikipedia.org/wiki/Concatenative_programming_lang...
       | 
       | [2] https://en.wikipedia.org/wiki/Iota_and_Jot#Zot
       | 
       | [3]
       | https://cstheory.stackexchange.com/questions/32309/concatena...
        
         | deathanatos wrote:
         | > _Concatenative languages [1] have the property that every
         | token sequence is a valid program._
         | 
         | I don't think this is correct? Concatenative languages have the
         | property that if a and b are both valid programs, that the
         | program a || b is valid (where || means "concatenate"). But
         | that property doesn't imply that every sequence of tokens is
         | valid.
         | 
         | For example, in Cat,                 [1 2
         | 
         | is not grammatically valid.
        
           | tromp wrote:
           | You're right. I should have qualified it as "some
           | concatenative languages".
        
             | joshmarlow wrote:
             | Is there a particular term for concatenative languages with
             | this property?
        
           | YeGoblynQueenne wrote:
           | So does Prolog count as a concatenative language given the
           | standard definition of concatenative languages?
           | 
           | For context, a Prolog program is a set of definite clauses so
           | the union of two Prolog programs is a Prolog program.
           | 
           | In fact, this property forms the basis of the concept of
           | (syntactic) generality in Prolog: if P1, P2, P3 are three
           | Prolog programs such that P1 is the union of P2 and P3, then
           | we say that P1 generalises each of P2 and P3. Does this
           | concept of generality also exist for concatenative languages?
        
           | dheera wrote:
           | They used an OCR program though, which probably has a bias
           | toward attempting to close parentheses.
        
         | kqr wrote:
         | > making Jot a natural Godel numbering of all algorithms.
         | 
         | This sounds very cool. I wish I understood both Jot and that
         | sentence.
        
           | tromp wrote:
           | A Godel numbering is simply a mapping to integers (that is
           | easily decoded). If your programs are arbitrary binary
           | strings, then you're basically already done, since bitstrings
           | are in 1-1 correspondence with integers:
           | empty  0  1  00  01  10  11  000  001  ...             0  1
           | 2   3   4   5   6    7    8  ...
        
             | Dylan16807 wrote:
             | > A Godel numbering is simply a mapping to integers (that
             | is easily decoded).
             | 
             | "easily" is arguable. Sure, I _could_ multiply /factor an
             | enormous number and count how many copies of each prime it
             | has, but I'd much rather concatenate/split some digits.
        
               | thaumasiotes wrote:
               | Factoring numbers is difficult. Manipulating digits is
               | easy, or it looks that way, but this is partially an
               | illusion resulting from the number being given to you
               | with the digits already known.
               | 
               | If you have a quantity in mind but you're not sure what
               | its digits are, it can be a lot of work to learn.
        
               | Dylan16807 wrote:
               | I don't know what you mean by "not sure what its digits
               | are".
               | 
               | If you mean what base to represent the number in, that's
               | no more arbitrary than knowing the exact way Godel
               | numbers use primes.
        
               | pmontra wrote:
               | Maybe it's an unfair example but: the number of people on
               | Earth. We know the quantity more or less, the leftmost
               | digit in base ten, then it's a lot of work to figure out
               | the other digits.
        
               | Dylan16807 wrote:
               | Definitely unfair, because we're discussing this as a way
               | to encode and decode a string of numbers into a single
               | number, no measurements involved.
               | 
               | And factoring the number of people on earth would be just
               | as hard.
        
             | kqr wrote:
             | But doesn't Godel numbering imply some sort of uniqueness,
             | i.e. that each algorithm is only present once?
             | 
             | Otherwise, wouldn't any language assigning a valid meaning
             | to any sequence of 0 and 1 be a Godel numbering, even if
             | only by saying that "an unrecognised sequence is a noop"?
        
               | tromp wrote:
               | Yes, in order to be decodable it must be an injective
               | mapping.
        
               | DougBTX wrote:
               | No, an algorithm may be written in many ways, each of
               | which would encode to a different Godel number.
               | 
               | > _To encode an entire formula, which is a sequence of
               | symbols, Godel used the following system. Given a
               | sequence (x_1, x_2, x_3, ..., x_n) of positive integers,
               | the Godel encoding of the sequence is the product of the
               | first n primes raised to their corresponding values in
               | the sequence_
               | 
               | https://en.wikipedia.org/wiki/Godel_numbering
        
       | gofreddygo wrote:
       | serious question: What good is perl in 2024.
       | 
       | Follow up: where do you see it going.
       | 
       | Full disclosure: never implemented anything useful in perl in my
       | personal or professional capacity for the last decade, except for
       | debugging a few scripts here and there.
        
         | tootie wrote:
         | Perl is a Turing-complete language that runs on any platform
         | and has maybe the longest-standing repository of open-source
         | libraries. I haven't seen a benchmark recently, but I'd bet it
         | still outperforms Python or node. But yeah, you'd be laughed
         | out of any job for suggesting it be used for any serious work.
         | It lost the PR war years ago.
         | 
         | I used it as my primary language for several years and it's
         | extremely capable and intuitive. The learning curve of it's
         | syntax is really only slightly longer than any other language.
         | And I have the very strong opinion that syntax contributes less
         | than 5% of readability and the rest is up to the developer to
         | factor smartly and name things well.
        
           | diputsmonro wrote:
           | Agree! I will add that it's actually very possible to write
           | Perl in a readable way (at least no more unreadable than your
           | average bash or python script). It's all up to the developer
           | to write readable, maintainable code instead of trying to
           | impress themselves with their esoteric one-liners.
           | 
           | With the light syntax and giant, well-documented community
           | repos, it feels a lot like Python With References to me,
           | which is honestly pretty great imo. I wish more people
           | respected Perl.
        
           | xandrius wrote:
           | To be fair neither node nor python are where they are today
           | because of their performance.
           | 
           | I wish we could leave them behind as a fun phase of mass
           | adoption of programming and fully switch to strongly typed
           | languages alone. One can dream.
        
             | tootie wrote:
             | As much as I enjoyed Perl, I also cannot fathom how these
             | kind of languages got so much adoption. For me,
             | productivity is most strongly correlated with IDE support,
             | debuggers and documentation. These are the kind of things
             | Java and C# beat everyone else at. But it seems like a lot
             | of devs are just dogmatically tied to their text editors.
        
               | xandrius wrote:
               | Yeah, many people are happy with their IDE not letting
               | them do something incorrectly (if they have extensions X,
               | Y, Z installed), I prefer having something incorrect
               | being impossible to exist.
        
               | krupan wrote:
               | correct vs. incorrect encompasses so much more than
               | memory safety and types that agree. You could spend a ton
               | of time making the ADA or Rust compiler happy only to
               | discover your program doesn't solve the problem your
               | customers want solved. That's why Python is still so very
               | popular
        
               | krupan wrote:
               | "cannot fathom how these kind of languages got so much
               | adoption"
               | 
               | The other options built into your UNIX (maybe Linux)
               | machine were:
               | 
               | - C
               | 
               | - C++
               | 
               | - tcsh/ksh/bash
               | 
               | - awk
               | 
               | - TCL
               | 
               | What would you have chosen?
        
               | kamaal wrote:
               | Apart from Python, even today what are the options?
               | 
               | golang/rust/c doesn't fit well the kind of tasks you
               | would use Perl to do. There is simply too much verbosity
               | and at some point in time you will bail out of the
               | sisyphean nature of the task. Kotlin etc are more for
               | mobile apps.
               | 
               | To me, back end work is-
               | 
               | 1. Any serious application, that needs to run for years
               | with performance - Java.
               | 
               | 2. Glue work- Python/Perl.
        
               | xandrius wrote:
               | I wouldn't dismiss Go that quickly, and same for C#.
        
               | tmtvl wrote:
               | Perl has a very strong documentation culture. One of the
               | things I miss in Common Lisp is the ability to just do
               | 'perldoc List::Util' and get an overview of all
               | subroutines in that module, with examples and clear
               | explanations of how it all works.
        
               | troglodynellc wrote:
               | A lot of the "dogmatically tied" comes from experience;
               | it's why the common refrain is that IDE means "It Doesn't
               | Exist" (where you have to fix the code). E.G. a "this is
               | why we can't have nice things" situation.
               | 
               | This is why a lot of us still use vi/emacs; it's just
               | what's available where we have to fix the problems.
               | 
               | I'll give you an example. I used to contract with
               | booking.com, where they gave us a crippled little windows
               | "amazon workspace" over vnc which we had to use to talk
               | to their systems. They're transitioning from a perl shop
               | into a java one, so naturally they use an IDE.
               | Unfortunately, they have configured this little workspace
               | such that SSH mounting your dev VM into an IDE isn't
               | possible (due to it not having a workable ssh agent), and
               | you can't install anything not pre-approved (so x11
               | forwarding a locally installed IDE is right out).
               | 
               | Minor changes could have been made to these workspaces to
               | address this; requests for which went ignored for years.
               | 
               | The only thing I could rely on was what I am used to
               | writing perl in. An SSH console session with vim and
               | tmux.
               | 
               | I was quite glad to have java experience from before the
               | days when java IDEs were any good. I'd have been screwed
               | if I didn't know how to use the debugger and javac
               | directly.
               | 
               | We've all had to work with our hands tied behind our
               | backs often enough we just "skip to the end" and use the
               | tools we know for a fact will always be available.
               | 
               | It's probably that same reason that perl persists to the
               | level of popularity it has. Like vi, I know it's going to
               | be there on basically any server I have to work on, and
               | the client probably doesn't care/want or even know how to
               | provision me something less primitive.
        
           | selimthegrim wrote:
           | I am reasonably sure Rentrak in Portland still uses Perl.
        
         | legitster wrote:
         | I'm sure there are a few professional applications that support
         | Perl, but the one that comes to mind is Radiator.
         | 
         | https://radiatorsoftware.com/
         | 
         | My understanding is that Perl is still _somewhat_ popular in
         | the sysadmin world - where just being able to push code that
         | works is valuable.
        
         | interroboink wrote:
         | I think the old comment by Larry Wall about "manipulexity" vs
         | "whipuptitude" still holds true. Perl occupies a powerful
         | ecological niche in the space of programming languages. The
         | space has become more crowded over the years, but it's still
         | hard to beat Perl if you're experienced with it. CPAN is a big
         | part of this.
         | 
         | As to the future... Perl 7 is coming (:
         | 
         | https://www.perl.com/article/announcing-perl-7/
        
           | seti0Cha wrote:
           | Looks like that plan was abandoned:
           | https://blogs.perl.org/users/psc/2022/05/what-happened-to-
           | pe...
        
             | melagonster wrote:
             | perl developer community found this probably isn't good
             | ideas, so they decided to keep this version number for some
             | important updates. maybe after the experiment end of "class
             | feature" in newest version.
        
         | gfldex wrote:
         | > What good is perl in 2024.
         | 
         | Making Debian possible. Allegedly, the German banking system is
         | held together by Perl scripts. Which is good. Perl got 0
         | bitrot. And you don't want your bank account to rot, do you?
        
           | exe34 wrote:
           | leftpad not found. Your fortune has been deleted.
        
         | toast0 wrote:
         | I learned Perl in or around 1996; and it continues to work well
         | for practical extraction and rubbish listing.
         | 
         | I've used Python when it was convenient, but I dislike it. So
         | Perl remains my go to when I need to process data for more than
         | a shell script.
         | 
         | Things I've written in Perl that I've run recently (or are
         | croned so they run frequently) include: scripts to monitor
         | shared directories for changes (kqueue) and publish the changes
         | to a remote server so my spouse can drop images or other files
         | to be shared on a share and get a link to send, or edit a
         | recipe and check it from the web while shopping; my monitoring
         | script that checks if my computers are working and emails me if
         | not, it also reboots my dsl modem when it needs it; (for work)
         | a tool to grab stats files from production, compute a summary,
         | and then upload it so clients can be routed to the servers that
         | are best for them.
         | 
         | I've done all sorts of stuff with Perl in the past, it's a very
         | capable language.
        
         | kqr wrote:
         | After over a decade of programming in various more and less
         | popular languages, I became a manager. I no longer had time to
         | write real code but I needed to be able to automate things
         | still, so I learned Perl.
         | 
         | Then I discovered one of Perl's best kept secrets: it allows
         | you to write real code, if you want to.
         | 
         | Now I'm back to being a regular programmer again but I just
         | happen to be more productive with Perl than anything else.
         | 
         | I have written about it before[1] but it boils down to one
         | thing: it runs anywhere with no modification or installation,
         | even 20 years from now.
         | 
         | [1]: https://two-wrongs.com/why-perl.html
        
         | 0xbadcafebee wrote:
         | A few years ago I used it do to a KeyPass migration, because
         | the KeyPass libraries in every other language didn't work.
         | 
         | I wrote a different Perl script as a Sysadmin 20 years ago and
         | used it last year. Still works.
         | 
         | Another time I was doing something and wanted to grok some
         | horrid DSL ( _cough_ HCL _cough_ ) and in 20 minutes wrote a
         | script to parse thousands of files give me what I wanted. Still
         | use that script.
         | 
         | Where's it going? No idea, don't care, I'll probably keep using
         | it for the next 25 years.
        
         | HeckFeck wrote:
         | I've found that I can most easily express myself in Perl. I
         | love the feeling that you can never truly exhaust the language.
         | I hated the indentation at gunpoint and overall sterility of
         | Python, and JavaScript is much more disjointed than what anyone
         | imagines Perl to be.
         | 
         | My most recent task using it was writing a backup script that
         | connects to various systems, archives stuff, then copies it to
         | a NAS and then updates a backup log.
         | 
         | Before that I created a demo site for a business idea using
         | Mojolicious (Perl web framework) + DBIx::Class (Perl ORM), and
         | I believe we could have completed the project using them. But
         | due to concerns that we couldn't find or pay Perl programmers
         | when we scale we abandoned it for a rewrite in C#/ASP.NET. A
         | heart vs mind decision, but business needs came first. I'm
         | aware that I'm the only one of my age (early 30s) in my circles
         | who has learnt Perl.
         | 
         | And that previous sentence is why I fear for its future.
        
         | layer8 wrote:
         | You can be certain that a Perl program will still work
         | unchanged in 2034. And it's probably not going anywhere, both
         | in the good sense and the bad sense.
        
         | daneel_w wrote:
         | As Larry Wall said, Perl makes easy things easy and hard things
         | possible. Almost the entire backend of my telecoms employer is
         | written in Perl, and as a result of sticking with it we have a
         | code base which is lean and runs fast and efficiently. Both of
         | these are strong benefits that I'll always defend as far more
         | important than people are willing to admit.
         | 
         | I don't see Perl going anywhere. Neither back towards
         | popularity, nor further into obscurity.
        
         | kelipso wrote:
         | Perl is flexible and cool while Python is for dorks and rules
         | nerding losers. _nasally voice_ huehuehue required indentation.
        
         | hnzix wrote:
         | FastMail runs on Perl:
         | https://blogs.perl.org/users/neilb/2019/09/fastmail-and-perl...
        
         | emmelaich wrote:
         | I only use it as an alternative to a stream of awk/grep/sed/...
         | 
         | Usually much more concise, readable and faster.
        
           | drivers99 wrote:
           | I use it for in-place search and replace within files.
           | 
           | perl -pi -e 's/change this/into this/g' filename(s)
           | 
           | -p assumes an input loop around your script. Lines are
           | printed.
           | 
           | -i in-place editing of files
           | 
           | -e may be used to enter a single line of script. Multiple -e
           | commands may be given to build up a multiline script.
           | 
           | Combined with "find" with -exec and/or pipe the filenames
           | into xargs and you can do a global search and replace across
           | a whole tree of files.
        
         | kamaal wrote:
         | >>What good is perl in 2024.
         | 
         | Pretty much anything that has to run on Unix(or unix like
         | machines). Its special niche is glue code and automation
         | related work. Use case for that happens quite frequently than
         | one imagines.
         | 
         | There is a also a 'blub' nature to it as well. Many times
         | unless you have used a tool, it can be hard to see what use
         | case it fits in. Last two weeks I had to do a fairly heavy
         | automation related thing at work. Bash was not suitable because
         | the code would get big as the situation evolved. The tool has
         | to be something using which is present everywhere(rules out
         | things like golang, java), something in which you can rapidly
         | prototype, something that is very good at manipulating text and
         | something that works very well with Linux utils(Rules out
         | python, golang). Over two weeks its size grew to something like
         | 3K lines, and I have used it to automate hours of boring manual
         | work, overall I think I ran it like 30 times or so.
         | 
         | Perl is also good at generating text which has some structure.
         | So I have used in the past like a macro utility in languages
         | that don't have macros. Basically I generate code using Perl. I
         | have used this to generate python, pig and even java code many
         | times.
         | 
         | Other types of work are for glue, like cron scripts, clean up,
         | regular test scripts, rapid prototyping etc.
         | 
         | CPAN makes the whole experience awesome. Its still the fastest
         | evolving library base compared to any language, only
         | competition may be is js. You will find a library for nearly
         | anything you want. And for something that you can't find, Perl
         | is good at rapid prototyping. Compare this with something like
         | Clojure, where even language goes without maintenance for
         | months. Perl is still actively developed.
         | 
         | Another big factor can be commitment to backwards
         | compatibility, you can be sure your scripts from years back
         | will run on newer versions of Perl.
         | 
         | >>Follow up: where do you see it going.
         | 
         | Perl is here to stay. Its installed on nearly every machine you
         | can put your hands on, and even teams don't use it, Over the
         | years I have seen individuals use it as some sort of a personal
         | automation and productivity language. Like a secret tool.
         | 
         | I guess a lot of banks, telecommunications, manufacturing and
         | early internet companies use it heavily till date.
         | 
         | Basically so as long need for automation exists, Perl would
         | exist.
        
         | troglodynellc wrote:
         | I make my entire living modernizing various firms' perl stacks.
         | 
         | There is a never-ending amount of work for people who are good
         | at modernizing older mod_perl/cgi stacks into psgi, and
         | profiling/optimizing stuff.
         | 
         | Where I see perl going:
         | 
         | I see the big firms running away from it as fast as they can,
         | and getting pikachu face when they inevitably get second-system
         | effect, but nevertheless doubling down, because admitting
         | failure is a no-no unless during a reorg.
         | 
         | I see the mittlestand and small biz expanding their existing
         | use of perl, as they cannot afford to re-tool. Perl programmers
         | will continue to have active careers for another 20 years,
         | which is at least as long as I need to remain employed.
         | 
         | The language itself will continue to evolve at a snails' pace
         | due to being design-by-committee since our BDFL retired.
         | Thankfully this doesn't seem to be a particularly serious
         | problem, as no advances in programming language design have
         | come forth which are the kind of quantum leap in either dev
         | productivity or performance to matter for our use cases.
        
       | lupire wrote:
       | Cute idea, and useful research to answer the question, but the
       | experimental result is essentially nothing. None of the examples
       | generated anything semantically more complex than `0-0`.
       | 
       | Many scripting languages will tolerate meaningless input.
       | 
       | Instead of these extremely non-character-istic splatters, I think
       | scribbles or random raster bitmaps would be better input.
        
         | eternityforest wrote:
         | If it tolerates meaningless input, that means you could
         | accidentally hit a key, type garbage in a file and the compiler
         | would have no complaints...
         | 
         | I've done this many times, trying to use the search bar and
         | then having the debugger suddenly plop my cursor into a
         | file....
         | 
         | I get what people are going for, but I don't think I would
         | enjoy coding in Perl!
        
           | thyrsus wrote:
           | 1. git complains about the uncommitted changes
           | 
           | 2. When intentionally writing perl, half the time my "perl -c
           | foo.pl" complains about syntax or badly used names (usu.
           | misspellings), with the typo to correct being obvious. As a
           | practical matter, it's not a problem.
           | 
           | I see a lot of semicolons in that ocr output, which might be
           | cheating.
        
         | mrguyorama wrote:
         | >but the experimental result is essentially nothing.
         | 
         | Sir, this is SIGBOVIK.
        
       | interroboink wrote:
       | I enjoyed footnote 5:
       | 
       | 5 This feature does enable a neat quine: the Perl program
       | "Illegal division by zero at /tmp/quine.pl line 1.", when saved
       | in the appropriate location, outputs "Illegal division by zero at
       | /tmp/quine.pl line 1." The reason for this behavior is left as an
       | exercise for the reader.
        
         | LeifCarrotson wrote:
         | Can you help out a reader who does not know any Perl?
         | 
         | I tried it in the REPL and found that "Illegal division" can't
         | locate method "illegal" in package "division", so presumably
         | that gets ignored, same with method "by" in package "zero", and
         | that "at /tmp" is the simplest version of the string that
         | produces the error message, which apparently is more severe
         | than the missing package warnings and terminates the program?
         | 
         | I'd guess the / is the operator for division, and the "tmp" is
         | getting initialized as a variable and coerced into an integer?
         | But "/tmp" doesn't do it, and "/tmp/" does something with
         | regex, so I'm not sure why the parser would split it there.
        
           | hoytech wrote:
           | Easiest way is to Deparse it:                   $ perl
           | -MO=Deparse tp.pl
           | 'division'->Illegal('zero'->by('at' / 'tmp' / 'quine' .
           | 'line'->pl(1)));         tp.pl syntax OK
           | 
           | So I believe this is what causes it (note that "at" and "tmp"
           | and such are "barewords"):                   $ perl -e 'at /
           | tmp'         Illegal division by zero at -e line 1.
        
           | interroboink wrote:
           | The footnote is originally referenced here:
           | Figure 6 represents the string "gggijgziifiiffif", which by
           | pure         coincidence happens to accurately represent the
           | authors' verbal reaction         upon learning that "unquoted
           | strings" were a feature intentionally         included in the
           | Perl language.5
           | 
           | So, the hint is that this has to do with the "unquoted
           | strings" feature (aka "bare words"[1]).
           | 
           | See the sibling comment about the actual parse -- "at" and
           | "tmp" are seen as strings.
           | 
           | The strings get coerced into numbers due to being used with
           | the numeric "/" operator (that's normal Perl behavor). Since
           | the strings can't be parsed as numbers, they become "0". So,
           | you get division by 0.
           | 
           | [1] https://perlmaven.com/barewords-in-perl
        
             | andai wrote:
             | Non Perl user here: why do people love Perl but hate JS? I
             | imagine Perl had a lot more thought put into it (than JS's
             | 10 days), but this kind of implicit conversion sounds like
             | exactly the kind of thing that bites me in the ass
             | constantly in JS land.
             | 
             | (Actually, implicit unquoted strings sound so nightmarish
             | it's comical, but let's do one question at a time...)
             | 
             | I used to think the solution was static typing, but then I
             | found none of the same infuriating bugs in Python, which
             | has dynamic but strong typing, forcing you to be explicit
             | about type conversions.
             | 
             | Edit: I think I've hit the nesting limit, so please reply
             | to parent comment and I will find it.
        
               | TheDauthi wrote:
               | When using Perl you should `use strict; use warnings;`
               | and you have something approaching a real language with a
               | lot fewer warts, in which said quine is not a valid
               | program. It isn't the default because Perl people have an
               | obsession about not breaking backwards compatibility.
               | 
               | I think the people that love perl love its
               | expressiveness. It has a little bit of functional
               | programming here, and a system for making an object-
               | oriented language, and all of these handy tools and you
               | choose which ones you need or find most readable. I've
               | heard Ruby called a better Perl, and - as someone whose
               | day job is largely those two things - that's completely
               | fair.
        
               | smueller1234 wrote:
               | Many moons ago, I made a case for making strict mode the
               | default in Perl. We settled on the current backwards
               | compatibility compromise, which is that breaking changes
               | are hidden behind a minimum version toggle:
               | 
               | Eg. putting "use v5.14.0;" or similar on top of your file
               | (or compilation unit/scope) will indeed turn on strict
               | mode for you, along with adding a number of features as
               | well.
               | 
               | At the time, also auto-toggling warnings was considered
               | unacceptable because technically, using the warnings
               | pragma anywhere had some edge case action at a distance.
               | This has been remedied in some later release after I
               | wasn't involved in the language development anymore, and
               | from some more recent version, warnings are also part of
               | the standard import.
               | 
               | I imagine you (TheDauthi) already know that, though.
        
               | araes wrote:
               | Javascript has a Much larger user community. You get much
               | different behavior and discussion when the community's
               | enormous, it's one of the most used computer languages
               | anywhere, and it's available on almost every device with
               | no additional software. Partial example, StackOverflow
               | question counts (measure of community volume and topic
               | need). 2,529,945 questions on JS. [1] Perl? 68,116. [2]
               | (as of 4/30 when linked)
               | 
               | Possible effects: People that must use Javascript, but
               | don't want to (only choice, only framework). People that
               | use Javascript because it's hyped or hot, not because of
               | personal interest. Larger volume of talk, so more
               | opportunities for griping. Much larger perception of
               | griping (blogs, HN links, news. You almost have to work
               | to find the Perl griping locations). The talk tends to
               | more work issues (stuck on project, annoyed at issue),
               | and not discussing a language you write with because you
               | enjoy the features.
               | 
               | [1] https://stackoverflow.com/questions/tagged/javascript
               | 
               | [2] https://stackoverflow.com/questions/tagged/perl
        
               | smueller1234 wrote:
               | Former Perl language contributor here. A sibling comment
               | to this already pointed out that you must use strict mode
               | with Perl to retain your well being.
               | 
               | The two languages certainly both have their terrible
               | warts. I think in the implicit conversion gotchas, JS is
               | actually markedly worse. Perl has polymorphic values, but
               | somewhat typed (for its basic types) operators (eg "eq"
               | for strings, "==" for integers). JS has both implicit
               | value type conversions and overloaded operators. That
               | leads to an unholy level of indeterministic mess.
        
               | lozenge wrote:
               | I think developer experience was bad all round "back in
               | the day". Eg PHP didn't have stack traces, query
               | parameters were automatically set as variables (and
               | quotes escaped with backslashes... Depending on your
               | sysadmin's config...) Compilers would produce broken
               | binaries instead of erroring. By comparison, most people
               | learning JS since Web 2.0 have experience with friendlier
               | languages.
        
             | thaumasiotes wrote:
             | > The strings get coerced into numbers due to being used
             | with the numeric "/" operator (that's normal Perl behavor).
             | Since the strings can't be parsed as numbers, they become
             | "0".
             | 
             | Huh, that's an odd failure of Perl's normal ethic of doing
             | things that appear to make sense in context. A number
             | should be 0 by default in additive contexts and 1 by
             | default in multiplicative contexts.
        
             | asddubs wrote:
             | PHP had this too in earlier versions. so if you missed an
             | import that defined constants, the constants would just
             | evaluate as their names. People liked to use this
             | particularly for associative array indexes like
             | $array[userid] instead of $array['userid']. Naturally a
             | terrible idea because the inverse is also true in regards
             | to constants, defining a constant named "userid" would then
             | change the meaning of the program
        
           | kqr wrote:
           | It might be when you run Perl with no qualifier you get a
           | recent version of Perl which turns on strict warnings for
           | you, and (rightly) warns about undefined words instead of
           | quietly trying to evaluate them anyway.
           | 
           | But yes, it converts the strings to integers and divides
           | them, as shown in the sibling comment.
        
             | TheDauthi wrote:
             | By default, even on a recent perl it'll act like you're on
             | a really old perl and run just fine.
             | 
             | With warnings, it runs, but tells you about all of the
             | mistakes you made. With strict, it doesn't run.
        
         | fanf2 wrote:
         | I wrote a blog post to explain it at
         | https://dotat.at/@/2019-04-04-a-curious-perl-quine.html
         | 
         | And also a superficially-related but actually rather different
         | Python quine:                 File "quine.py", line 1
         | File "quine.py", line 1        ^      IndentationError:
         | unexpected indent
        
         | teaearlgraycold wrote:
         | You can do this with Python as well for indentation errors
        
       | rrr_oh_man wrote:
       | I love the splatters -- what's the copyright on those?
        
         | Manabu-eo wrote:
         | They gathered images from pinterest.
        
       | neilv wrote:
       | Clever variation on the old "indistinguishable from line noise"
       | jokes.
       | 
       | (For those who weren't frequently exposed to "line noise"...
       | Imagine an ASCII character video terminal that's interpreting a
       | stream of bytes, to display meaningful text. Now imagine that the
       | communication channel gets corrupted somehow (say, someone picks
       | up the phone handset while modem is online, or there's
       | interference on the cable), and there's no error correction or
       | checksumming, so the bytes being interpreted are effectively
       | become randomized. So random letters, digits, punctuation,
       | control characters, etc., are being interpreted and displayed,
       | and this is familiar, and you know it's random and why... but the
       | joke is that it's still actually a valid Perl program.)
        
         | saalweachter wrote:
         | Great, now you've made me realize that line noise is in the
         | same category of things I'll never be able to explain to Kids
         | These Days (like broadcast schedules), and now I might as well
         | get it over with and tie an onion to my belt.
        
       | gfldex wrote:
       | $ cat ~/.signature         --              raku -e 'try { not
       | :2(.fear) } and do not die'         perl -e 'do not $fear and do
       | not die'         raku -e 'say ,,The Road to Wisdom"; $*ERR and
       | $*ERR and $*ERR but Less and Less and Less'
        
       | legitster wrote:
       | Unrelated, but what a garbage original tweet that this is taken
       | from. Getting taught useful skills is not mutually exclusive to
       | kids being kids.
       | 
       | It would have been nice to have learned how to use a drill press
       | in school rather than the Dewey Decimal System. What do you even
       | think school is for? I didn't come from a very privileged
       | background - no one was going to hand me a career when I turned
       | 18.
       | 
       | "I wish I'd had more time to be a kid". I'm a grown ass man and I
       | still read books too late and splash in puddles. It sounds like
       | you just decided not to be fun one day and are blaming other
       | people for you being boring.
        
         | tedunangst wrote:
         | If you learn the Dewey Decimal system, you can go to the
         | library and find a book to teach you to use a drill press. On
         | the other hand, if you take a drill press to the library
         | looking for a book, ...
        
           | laurowyn wrote:
           | ...you can mark all the books you've checked with a hole so
           | you know you've checked them.
           | 
           | Work harder, not smarter. /s
           | 
           | Jokes aside, I still agree with GP, in that there are more
           | practical skills that are left out of education that would be
           | far more useful in day to day life. The Dewey Decimal System
           | has been replaced with search engines.
           | 
           | I don't need to know how a search engine works in order to
           | type in "how to use a drill press" and read the results. But
           | that's because the knowledge and understanding of how
           | computers work at a high level circumvents the need to do
           | that - a search engine is a form, give it something to search
           | and hit the submit button. Easy.
           | 
           | Being taught by someone to use machining tools helps build an
           | understanding of how every day items are made using those
           | tools, so you have a more fundamental understanding of the
           | items could be combined together into other more interesting
           | things, repair them, take them apart and service them.
           | 
           | It's almost the opposite problem of maths in schools. We're
           | taught maths in various incresasingly complex ways, all the
           | way up to calculus. Those methods teach us how to use maths
           | to do clever things. But every day maths doesn't need that.
           | We're taught compound interest, but we have to use that to
           | figure out how to do our taxes by ourselves without any help.
           | Wouldn't it be nice to have an overlap there, hit two birds
           | with one stone and we all walk away with a stronger
           | understanding of the world?
           | 
           | If we're not taught how to make things, we struggle to learn
           | how things are made, which means less things get made.
           | Learning how to make things early, and embedding the
           | knowledge of how things are made, enables more things to be
           | made in future.
        
             | tedunangst wrote:
             | Yeah, sure, today we can teach people to use a search
             | engine and whether you should believe the first result. Is
             | the chatbot always truthful? Not sure when or why it was
             | decided that media literacy isn't a useful everyday skill.
        
         | sandworm101 wrote:
         | >> What do you even think school is for?
         | 
         | At that age? Daycare. Sending all kids to government-run
         | schools freed up the parents to work longer/harder jobs. But I
         | would never argue for kids not to get schooling. I know too
         | many adults who cannot read properly, who cannot write a
         | cohesive paragraph, who don't know affect from effect. Kids
         | need more reading, not less.
        
         | prisenco wrote:
         | I agree with the original tweet, because I interpret it as a
         | message to parents pushing their kids. There are a lot of
         | parents these days that are hyper-obsessed with their child's
         | success and that can easily lead to a loss of childhood. I've
         | seen it happen, I'm sure you have too.
         | 
         | This is not about the kids who love to learn things that end up
         | being useful skills. By all means, let them learn. But don't
         | stop the kids who like to run around in the woods or
         | fingerprint or pop wheelies on their bike for the sake of their
         | future career prospects.
        
           | legitster wrote:
           | I don't disagree with your sentiment, even though I am also
           | not a person who looks back fondly on my childhood.
           | 
           | The fact that the tweet specifically calls out schools
           | "teaching vocational skills so young" makes me interpret the
           | tweet as a generic luddite response - as if Montessori
           | schools don't make working with hand tools an explicit part
           | of their early childhood curriculum! This does seem like she
           | is opposed to her kid learning and not an anti-Tiger Mom
           | take.
        
           | lern_too_spel wrote:
           | This is a privileged Western attitude towards child rearing.
           | "I turned out fine without hard work, so you will too." I've
           | seen far too many of those kids get a rude awakening when
           | they reach adulthood.
        
             | itishappy wrote:
             | Playing outside, painting, and bicycles are privileged
             | Western things?
        
               | lern_too_spel wrote:
               | Not stopping them from doing that when it risks their
               | future prospects is a privileged Western attitude.
        
               | prisenco wrote:
               | "risking future prospects" in this context has not been
               | clearly defined.
        
               | lern_too_spel wrote:
               | It was clearly defined in the comment I replied to, which
               | is the context of this thread. I am using the same
               | definition.
        
         | diob wrote:
         | I think you're reading way too much into it with little
         | context. For instance, we don't even know how old the kid is,
         | or if the workload on the kid from school is super high.
        
         | zer00eyz wrote:
         | I learned about computers so very young. Not in the sense of
         | consumption in the sense of "what you can do with code"
         | 
         | TO this day, writing code, feels like play. I get the same
         | child like satisfaction that building something out of lego
         | would give me, that sense of "Look what I did".
        
       | mlhpdx wrote:
       | Interesting, but the social relevance would be improved if the
       | input images were graffiti.
        
       | iamleppert wrote:
       | With Generative AI, you can create new and innovative paint
       | splatters that evaluate to working software, faster than ever
       | before. Generative AI enables a new class of creators to harness
       | and leverage text to image workflows, driving value for
       | businesses of all sizes. New AI models are capable of embedding
       | working software and machine readable codes into a wide variety
       | of high resolution content, engaging viewers and providing
       | creators new and exciting ways to grow their audiences.
        
       | jhdias wrote:
       | Posted 1st April. This implies something.
        
       | dmbche wrote:
       | More cutting edge computational research here :
       | https://sigbovik.org/
        
       | dang wrote:
       | Related:
       | 
       |  _93% of Paint Splatters Are Valid Perl Programs (2019)_ -
       | https://news.ycombinator.com/item?id=27929730 - July 2021 (163
       | comments)
       | 
       | Also:
       | 
       |  _93% of Paint Splatters Are Valid Perl Programs (2019)_ -
       | https://news.ycombinator.com/item?id=38754686 - Dec 2023 (1
       | comment)
        
       | 0xbadcafebee wrote:
       | as a Perl programmer, I consider that non-functional 7% a bug
        
       | glenstein wrote:
       | I understand that this discusses recognizing paint splatters as
       | characters with a given "optical character recognition" program,
       | which seems disposed to almost always recognize pain as _some_
       | combination of characters. Of the many possible ways this could
       | be realized, this is absolutely welcome and in the spirit.
       | 
       | However, it did give me the initial impression about other
       | possible ways to do this, such as taking patches of color and
       | empty space as 0s and 1s, and the totality of it as a program. I
       | think the vast majority of those cases would be pointless noise.
       | 
       | So there's two extremes, one with mostly noise, one with mostly
       | meaning. I suppose the game-within-the-game here is to find what
       | form of interpretation does the most to credit paint splatters
       | with the most possible meaning where, to the greatest extent
       | possible, the meaning truly comes from the structure and not from
       | how aggressive the rules are at choosing to see meaning.
        
         | bee_rider wrote:
         | > disposed to almost always recognize pain as some combination
         | of characters.
         | 
         | Well, break out the eeg, let's see if pain is also a valid perl
         | program.
        
           | EvgeniyZh wrote:
           | The opposite is definitely true
        
           | akurtzhs wrote:
           | "What's in the box?"
           | 
           | "Perl."
        
           | hnzix wrote:
           | Just make sure you don't accidentally autoviviy another
           | instance of yourself.
        
       | luxuryballs wrote:
       | why is Perl like this??
        
         | ramon156 wrote:
         | "is he stupid?"
        
       | Iris2645 wrote:
       | Such a bullshit article.
        
         | Bjartr wrote:
         | That's entirely the point.
        
       | broken-kebab wrote:
       | Jokes aside, isn't it wrong that OCR software still always
       | produces textual result from images wich are not text? More than
       | a decade ago I OCRed an old book, and I remember how annoying it
       | was to deal with all the garbage text produced from small
       | pictures, smudges, and dirt. It looks like there's not much
       | progress done since in the field
        
         | jonahx wrote:
         | > It looks like there's not much progress done since in the
         | field
         | 
         | LLMs help here. From my own experiments chatGPT is pretty good
         | "smart, context-aware" OCR agent.
        
           | Kubuxu wrote:
           | Using image embedding and evaluating 100s billion parameter
           | LLM for OCR is like hunting rabbits using Yamato's 18in naval
           | gun.
        
             | manquer wrote:
             | Well using a human is bring an interstellar rail gun to
             | hunt rabbit so i guess it still better ?
        
             | jonahx wrote:
             | Not really. Proper OCR in the broadest sense (extracting
             | text from arbitrary pdfs that intermingle tables, images,
             | etc, or from hand written artistic posters) requires a full
             | understanding of semantic intent.
             | 
             | You are perhaps imagining more constrained scenarios of
             | straight lines of consistent text on a page with well-known
             | artifacts of "noise" (smudges, print imperfections, and so
             | on).
        
         | petters wrote:
         | Yes, there has been progress. But the featured article is meant
         | to be fun!
        
         | kzrdude wrote:
         | That question seems to be the same kind as the question in the
         | OP. Isn't something wrong when a random scribble creates a
         | valid execution in Perl?
        
       | sakesun wrote:
       | More than a decade ago, I heard a big consulting firm executive
       | stated that he deliberately base his project on Perl, because his
       | team will have less chance to find a new job elsewhere from this
       | skill. :|
        
       | Jsisn wrote:
       | I don't understand how that is done. Can someone explain to me
       | how to do the same? Whether it is reading the raw image, a
       | particular format or the bytes of the print. Surely it's not like
       | that, like I said I don't understand.
        
         | tlarkworthy wrote:
         | The OCR (optical character recognition) is doing the heavy
         | lifting, essentially forcing the blotches into strings... which
         | then turn out to be valid perl programs
        
       | cies wrote:
       | I've come to prefer languages that score very low on this metric
       | of "paint splats OCRed yield valid $PROG_LANG programs".
       | 
       | A lot of fun I had with a language called Elm, in which runtime
       | errors are nearly impossible to express.
        
       | syadegari wrote:
       | Tangentially relevant to this is Perl Secrets, a list of
       | operators and constants discovered by various users:
       | https://github.com/book/perlsecret/blob/master/lib/perlsecre...
        
       | tenderfault wrote:
       | is the ocr system written in perl by any chance?
        
       | Mathnerd314 wrote:
       | > (source code not available yet because i am bad at GitHub)
       | 
       | Lost forever I guess. Certainly it's not at
       | https://git.mcmillen.dev/explore/repos
        
       | methods21 wrote:
       | I so wish Perl was still in the 'mainstream' and Perl 6 didn't
       | fizzle. Love Perl.
        
       ___________________________________________________________________
       (page generated 2024-04-30 23:01 UTC)