[HN Gopher] 93% of paint splatters are valid Perl programs (2019)
       ___________________________________________________________________
        
       93% of paint splatters are valid Perl programs (2019)
        
       Author : ellieh
       Score  : 248 points
       Date   : 2024-04-29 11:30 UTC (11 hours 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".
        
         | 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  ...
        
       | 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?
        
           | 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...
        
         | 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.
        
       | 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!
        
         | 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
        
           | 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.
        
         | 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.)
        
       | 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.
        
         | 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
        
       | 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.
        
       ___________________________________________________________________
       (page generated 2024-04-29 23:00 UTC)