Jul 15
22:02:00.876 ▶▶ Permalink

Pigrizia, Impazienza, Arroganza

Libera traduzione/parafrasi di un mio vecchio pezzo su PerlMonks

Larry Wall, il geniale creatore di Perl, è noto per i suoi molti ed arguti aforismi. Uno dei più famosi vuole che le tre virtù dei programmatori siano pigrizia, impazienza ed arroganza. Inoltre sostiene che il Perl è stato disegnato intorno a tali principi. Non si tratta solo di una affermazione scherzosa, ma ha anche un fondamento molto serio. Per come la intendo io, è una sinergia fra di esse che le rende virtù. O almeno, due qualsiasi di esse. Io ad esempio eccedo in pigrizia. Invero sono così pigro che spesso faccio delle cose in maniera inefficiente perché non mi va di scrivere quelle due righe di codice (in più) che mi renderebbero la vita più facile, e nel complesso il tutto mi prende più tempo di quanto sarebbe realmente necessario. Ma se ho poco tempo, l’impazienza fornisce qualche motivazione in più. Esattamente quella che serve per scrivere quel codice. Un simile ruolo potrebbe giocare l’arroganza. E l’arroganza da sola, senza le altre due, potrebbe farti fare qualcosa di completamente diverso, come usare qualche ingombrante e stupido linguaggio di quelli che ti farebbero perdere un mucchio di tempo, solo per potertene vantare. E l’impazienza da sola? Beh, quella forse potrebbe essere sufficiente per spingere uno ad usare perl, ma magari anche qualche altro tool RAD di cui poi uno non andrebbe tanto orgoglioso…

Sep 05
0:49:10.992 ▶▶ Permalink
“Perlguy” & Larry Wall (via The Camel Tattoo Pictures)


Visto che oggi il post principe continua ad essere abbastanza da nerd, ci sta anche la foto di un altro tatuaggio da nerd: certo che di questo non dico “che tristezza!” Eccerto: è un po’ il simbolo, ancorché non ufficiale, del più bel linguaggio di programmazione del mondo…

“Perlguy” & Larry Wall (via The Camel Tattoo Pictures)


Visto che oggi il post principe continua ad essere abbastanza da nerd, ci sta anche la foto di un altro tatuaggio da nerd: certo che di questo non dico “che tristezza!” Eccerto: è un po’ il simbolo, ancorché non ufficiale, del più bel linguaggio di programmazione del mondo

Oct 11
15:53:56.620 ▶▶ Permalink
Yes, we really will [have Perl 6.] We have a complete parser now, written in Perl 6, that parses itself, and can spit out an AST. All that remains is to come up with a VM with sufficent support for lazy functional OO semantics, and write an emitter for it. Simple!
TimToady a.k.a. Larry Wall, or was it vice versa? (With links inserted by me.)
Oct 12
23:03:00.918 ▶▶ Permalink

Serendipità: Perl 6

Cosa è la serendipità? Ne abbiamo già parlato; una delle “definizioni” più belle e significative che ho trovato è data in termini di una metafora:

Serendipity is looking in a haystack for a needle and discovering a farmer’s daughter.
— Julius Comroe Jr.

Nel mio caso, il pagliaio può essere un thread particolarmente fuffoso su PerlMonks; l’ago, un post non eccessivamente stupido su cui spendere uno dei miei voti quotidiani (sapete, durante il weekend è un po’ un mortorio…) e la figlia del fattore… un bellissimo post a sorpresa di Larry Wall a.k.a. TimToady, nello stesso thread fuffoso e noioso! Micacazzi!!

Il problema discusso era banale: quello di generare la successione 1, 11, 111... ed incline perciò a far partecipare ogni sorta di niubbi che si son sentiti autorizzati a fornire la loro “autorevole” soluzione, cioè, come spesso accade in tali casi, a passare informazioni se non proprio sbagliate, quanto meno inclini agli errori, mentre altri, più esperti, si sono divertiti a darne di “alternative” o fantasiose o in altro modo giocose, cioè perfettamente funzionanti ma non corrispondenti in alcun modo a ciò che uno farebbe nella cosidetta “vita reale” sempre che ne esista una! Ad un certo punto, qualcuno menziona Haskell, ed è a questo punto che $Larry interviene, col suo solito wit:

Tsk, tsk, Haskell is such a verbose language. :) In Perl 6 it’ just:

[\~] 1 xx *

where that just says “make an arbitrarily long list of 1’s and reduce them using concatenation (the ~ operator), returning partial results in a list.”

Ciò che ho imparato di nuovo, da questo post, è il metaoperatore, [\ ] variante di [ ], come mi è stato gentilmente spiegato. Ma non è finita qui! La novità più nuova è:

the new spiffily readable ... infix, it’s even shorter:

1...{$_~1}

That just extends the list on the left by concatenating a 1 onto the previous last value of the list.

Che dire? Fantastico!

Oct 18
15:05:00.586 ▶▶ Permalink
And in the backslashed form, [the reduction metaoperator] needs something with a vertical feel on the left representing the “left margin,” or we lose much of the triangular feeling, so square brackets work nicely together with backslash that way. It all adds up to an almost overwhelming feeling of necessity — which is why the language designer must also guard against adding up too many apples and then comparing them to orangutans.
TimToady a.k.a. Larry Wall, or was it vice versa?
Oct 24
19:15:27.760 ▶▶ Permalink
What a confusing language! We really should fix it some millennium or other—preferably this one. So if you happen to invent a time machine (or even if one just appears on your doorstep from the future,) please let me know, because some of us are planning to go back to the year 2000 and perform a brain transplant on Larry so he starts thinking straighter.
TimToady, slightly adapted and with links added, but it is not fun if you don’t know who he is, and the links will tell you…
19:22:11.765 ▶▶ Permalink
Bad idea. Very bad idea. [To take a time machine and go back to year 2000 to perform a brain transplant on Larry] The transplant might not well resonate with what is Larry, and Larry might start inventing really weird stuff: not only unreasonable, but unresonating, i.e. cacophonic as well.
shmem
Oct 27
20:49:00.867 ▶▶ Permalink
Indeed, that is precisely the Perl 6 solution to the problem: time travel. Context in Perl 6 is not determined at compile time or even at evaluation time, but rather at binding time, which is even later than that. Think of it as JIT context. […] Unfortunately, you also need time travel to have a finished Perl 6. Fortunately it’s the kind of time travel that can be implemented by waiting, as long as someone else isn’t…
TimToady a.k.a. Larry Wall, or was it vice versa? Every intervention, a witty quotation…