LWN: Comments on "An interview with Larry Wall (LinuxVoice)" https://lwn.net/Articles/651056/ This is a special feed containing comments posted to the individual LWN article titled "An interview with Larry Wall (LinuxVoice)". en-us Sat, 08 Nov 2025 11:02:58 +0000 Sat, 08 Nov 2025 11:02:58 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/841501/ https://lwn.net/Articles/841501/ flussence <div class="FormattedComment"> Writing it as 0.00001234e0 also works. Spelling out exponents feels odd at first, but it turns out the same trick works in C.<br> </div> Thu, 31 Dec 2020 15:07:33 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/841396/ https://lwn.net/Articles/841396/ raiph <div class="FormattedComment"> 2020 update of my own comment. One can now write type conversions like so:<br> <p> my Num() $bar = 0.00001234<br> <p> which will store a float in $bar by converting the rational 0.00001234.<br> </div> Mon, 28 Dec 2020 19:59:14 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652610/ https://lwn.net/Articles/652610/ dvdeug <div class="FormattedComment"> As long as you're writing 1.61803398, I don't see any justification for saying "If I wanted a fraction I'd write a fraction." A float is a fraction with a numerator between 0 and 2^24 and denominator of 2^24, times a power of 2. 1.61803398 looks a lot more like a decimal fraction then a floating point number. Maybe an explicit exponent, like 1.61803398E0, would make it clear that you wanted a float.<br> <p> It's a trade-off of speed for less user surprise, and for a language with as little stress on raw speed as Perl, that's usually a good trade off. Accuracy is probably a wash; I bet there's a lot of times where you get back the exact best answer you could get with rationals where floats are less then precise, especially for less experienced users who aren't thinking in terms of IEEE754. I don't know Perl or Perl 6, but I assume if you want floats, you can explicitly demand them.<br> </div> Tue, 28 Jul 2015 09:06:54 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652555/ https://lwn.net/Articles/652555/ Cyberax <div class="FormattedComment"> <font class="QuotedText">&gt;Don't you just hate it when mathematical operators are commutative and return *numbers*?</font><br> WHICH numbers? They behave differently.<br> <p> <font class="QuotedText">&gt; Maybe I should have used a more extreme example: "(a + b) * a / b". Does that return a number, a string, or a runtime error?</font><br> In Python it's either a floating number or a runtime error (barring bizarre operator overloads).<br> </div> Mon, 27 Jul 2015 17:13:51 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652552/ https://lwn.net/Articles/652552/ flussence <div class="FormattedComment"> <font class="QuotedText">&gt; Like not being able to tell whether it's float, rational or bigint.</font><br> <p> You're almost getting it now, yes. Don't you just hate it when mathematical operators are commutative and return *numbers*? How dare they.<br> <p> Maybe I should have used a more extreme example: "(a + b) * a / b". Does that return a number, a string, or a runtime error?<br> </div> Mon, 27 Jul 2015 17:08:45 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652506/ https://lwn.net/Articles/652506/ mchapman <div class="FormattedComment"> <font class="QuotedText">&gt; ... the scalar will "look like" an integer.</font><br> <p> And obviously that should be "... floating-point value".<br> </div> Mon, 27 Jul 2015 00:06:57 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652505/ https://lwn.net/Articles/652505/ mchapman <div class="FormattedComment"> <font class="QuotedText">&gt; Like not being able to tell whether it's float, rational or bigint.</font><br> <p> Perl guarantees it's a scalar. If the result is an integer, the scalar will "look like" an integer. If the result is a floating-point value, the scalar will "look like" an integer.<br> <p> "Looks like" in Perl is as strong a guarantee as "has a type of" in Python or some other languages. I would like to think you are merely unwilling to acknowledge this idea, not incapable of it. Either way though, I don't think there's anything more I have to say on the matter.<br> </div> Mon, 27 Jul 2015 00:03:43 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652502/ https://lwn.net/Articles/652502/ anselm <blockquote><em>In Python, "a + b" could return literally any type, any value. All it takes is the appropriate "def __add__ (a, b): return value" in some class somewhere.</em></blockquote> <p> That applies to Perl, too – see “perldoc overload”. </p> Sun, 26 Jul 2015 23:02:10 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652492/ https://lwn.net/Articles/652492/ dvdeug <div class="FormattedComment"> In Python, "a + b" could return literally any type, any value. All it takes is the appropriate "def __add__ (a, b): return value" in some class somewhere. That being "brain damaged" is an opinion I'm not going to get into, but it's not different between Perl and Python.<br> </div> Sun, 26 Jul 2015 20:06:47 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652484/ https://lwn.net/Articles/652484/ Cyberax <div class="FormattedComment"> <font class="QuotedText">&gt; I'd say any language where I can't be sure of the return type of "a + b" at a glance is more brain damaged.</font><br> Ah, so you do agree that not being able to tell what comes out of "a+b" is braindamaged. Like not being able to tell whether it's float, rational or bigint.<br> </div> Sun, 26 Jul 2015 18:57:24 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652483/ https://lwn.net/Articles/652483/ nix <div class="FormattedComment"> Let's expand that sentence:<br> <p> When compared to Haskell, Perl and Python look quite similar, both dynamic systems with heavy OO mixture and no type inference.<br> <p> </div> Sun, 26 Jul 2015 18:47:34 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652480/ https://lwn.net/Articles/652480/ flussence <div class="FormattedComment"> <font class="QuotedText">&gt; BTW, the fact that "+" happily works with strings without any errors is another braindead idea.</font><br> <p> Perl 5 has errors for that. You can enable them by typing "-w" on the command line. They're off by default; little things like that are why code from 20 years ago still runs correctly in it unmodified.<br> <p> I'd say any language where I can't be sure of the return type of "a + b" at a glance is more brain damaged.<br> </div> Sun, 26 Jul 2015 16:17:50 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652479/ https://lwn.net/Articles/652479/ flussence <div class="FormattedComment"> I get a strong impression you aren't even reading what you're arguing against, never mind who said it.<br> </div> Sun, 26 Jul 2015 15:56:33 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652462/ https://lwn.net/Articles/652462/ mathstuf <div class="FormattedComment"> <font class="QuotedText">&gt; no type inference</font><br> <p> Maybe I'm just not parsing your statement properly, but Haskell does all kinds of type inference…<br> </div> Sun, 26 Jul 2015 03:19:40 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652444/ https://lwn.net/Articles/652444/ dvdeug <div class="FormattedComment"> List comprehensions are listed as being derived from Haskell by one of the sources linked from Wikipedia. It's not that surprising a claim.<br> <p> "Considerable" is in the eye of the beholder. When compared to Haskell, they look quite similar, both dynamic systems with heavy OO mixture and no type inference.<br> </div> Sat, 25 Jul 2015 12:37:37 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652441/ https://lwn.net/Articles/652441/ anselm <p>It's pretty safe to say that Python's use of indentation for structure was not a Haskell influence. This is fairly obvious considering that the ABC programming language, which Guido van Rossum worked on at CWI before starting Python, also used indentation for structure. ABC had been around for more than a decade before Python was released.</p> <p>List comprehensions, OTOH, were only added to Python way later, namely with version 2.0, which was released in 2000. It would not be entirely unreasonable to consider them influenced by Haskell.</p> <p>As far as the type systems of Perl and Python are concerned, I think there are considerable differences. The observation that Perl doesn't really differentiate between numbers and strings, calling them “scalars”, while in Python strings are a special case of a (“non-scalar”) container type that also includes tuples and lists would be one's first clue that the type systems of Perl and Python are not really very similar at all.</p> Sat, 25 Jul 2015 11:56:49 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652427/ https://lwn.net/Articles/652427/ dvdeug <div class="FormattedComment"> Haskell's first release was in 1990; Python was created in 1990 and released in 1991. So it doesn't seem likely that indentation or any other early feature was influenced by Haskell. The type system, in particular, is very unHaskell. In these features, Perl and Python differ pretty marginally.<br> </div> Sat, 25 Jul 2015 05:02:18 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652426/ https://lwn.net/Articles/652426/ rsidd <div class="FormattedComment"> Python is heavily influenced by Haskell (indentation and list-comprehensions are two obvious examples). So it's not irrelevant. <br> </div> Sat, 25 Jul 2015 04:12:16 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652425/ https://lwn.net/Articles/652425/ raiph <div class="FormattedComment"> <font class="QuotedText">&gt; $foo[1] vs. @foo[1] tends to confuse them</font><br> <p> Yeah. That's gone in Perl 6:<br> <p> my @foo = 0,1,2,3; say @foo[1];<br> 1<br> <p> <font class="QuotedText">&gt; scalar context vs. list context</font><br> <p> Yeah. Context is still very much a thing in Perl 6.<br> <p> <font class="QuotedText">&gt; I'm getting the distinct impression that Perl 6 should not have been called Perl.</font><br> <p> Right. I can see it being renamed sometime in the next 5 years, with the leading candidate new name being Camelia. But Larry has refused to even consider that prior to getting a 6.0.0 shipped (which is currently scheduled for this Christmas).<br> <p> <font class="QuotedText">&gt; If it ever actually comes around it will create lots of confusion among our customers because they will have to figure out whether they want us to teach Perl 5 or Perl 6.</font><br> <p> I'm sure it's going to put in enough of an appearance globally to at least cause confusion. :)<br> <p> <font class="QuotedText">&gt; In any case, demand for Perl classes hereabouts has dwindled to near-zero anyway.</font><br> <p> Where's here?<br> <p> <font class="QuotedText">&gt; I'm teaching way more Python these days than Perl, and I can't even say I'm sorry.</font><br> <p> Sure. I like the Perl 5 community, and love Perl 6, but when I've eased newbies into scripting in the last few years I've started with Python, not Perl.<br> <p> <font class="QuotedText">&gt; I don't use Perl for new projects anymore. Not if the code will take more than one screenful of lines, anyway.</font><br> <p> I think the same is true of a lot of folk.<br> <p> The Perl 6 design is clearly aiming at programming-in-the-large just as much as it is scripting. But the only semi-serious test of its characteristics in that regard that I'm aware of is the compiler toolchain. So it seems like the jury is going to still be out for at least another few years on that.<br> </div> Sat, 25 Jul 2015 03:55:01 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652421/ https://lwn.net/Articles/652421/ anselm <blockquote><em>I'm curious what your student mix is between non-programmers learning programming by learning Perl and programmers in other languages learning Perl.</em></blockquote> <p> Most of the people I've taught Perl to over the years were programmers with experience in other languages, ranging from Visual BASIC to things like C++ or Java. These people have the advantage that they already know about things like variables, conditionals, and loops. Stuff like <tt>$foo[1]</tt> vs. <tt>@foo[1]</tt> tends to confuse them, as does scalar context vs. list context in general. As I said, this stuff has its own twisted logic behind it, but from a language-learner POV it wasn't the smartest idea to design the language that way. </p> <blockquote><em>say lines</em></blockquote> <p> I'm getting the distinct impression that Perl 6 should not have been called Perl. If it ever actually comes around it will create lots of confusion among our customers because they will have to figure out whether they want us to teach Perl&#160;5 or Perl&#160;6. </p> In any case, demand for Perl classes hereabouts has dwindled to near-zero anyway. I'm teaching way more Python these days than Perl, and I can't even say I'm sorry. I was a Perl programmer in the late 1980s when we were waiting for the first (pink) Camel book to come out, and have followed the language for a very long time – including, e.g., consulting with O'Reilly on the German translation of the Perl&#160;5 version of <em>Programming Perl</em> – but I don't use Perl for new projects anymore. Not if the code will take more than one screenful of lines, anyway. </p> Sat, 25 Jul 2015 00:15:16 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652420/ https://lwn.net/Articles/652420/ raiph <div class="FormattedComment"> <font class="QuotedText">&gt; [treating 123apples as a number] tends to throw people off at times when instead they expect their compiler or interpreter to complain about a type mismatch.</font><br> <p> Fwiw, Perl 6 no longer accepts "baz" as a number, insisting that a string must start with decimal digits if it's to successfully coerce to a number.<br> <p> There's a saying on #perl6 that every DWIM ("Do What I Mean") has a corresponding WAT. One has to weigh the supposedly positive value of DWIMs against the negative value of their WAT(s).<br> <p> I hear that, in your opinion, the WAT is not worth the DWIM, especially when it comes time to teach the language.<br> <p> I'm curious if you can see and thus express any significant value to the DWIM even while it's not enough to counter the WAT?<br> <p> <font class="QuotedText">&gt; I teach Perl classes (among other subjects) for a living and in my considered opinion it is not a simple language to teach.</font><br> <p> I'm curious what your student mix is between non-programmers learning programming by learning Perl and programmers in other languages learning Perl.<br> <p> There are a bunch of programming teachers in the Perl community and I've watched their input help shape Perl 6, which was in part about cleaning up the language and making easy things easier. Perhaps you yourself contributed.<br> <p> The upshot is that one can get a whole lot done with truly trivial code like:<br> <p> say lines<br> <p> <font class="QuotedText">&gt; Also, to really appreciate Perl you need to know C, the shell, sed, and awk</font><br> <p> Fwiw I don't think that applies to Perl 6.<br> </div> Fri, 24 Jul 2015 23:40:29 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652418/ https://lwn.net/Articles/652418/ raiph <div class="FormattedComment"> <font class="QuotedText">&gt; A nit: I'd say that treating operands of the `+` operator as numbers is explicit, not implicit.</font><br> <p> And, if I did, I'd be wrong.<br> <p> <a rel="nofollow" href="https://en.wikipedia.org/wiki/Type_conversion">https://en.wikipedia.org/wiki/Type_conversion</a><br> </div> Fri, 24 Jul 2015 22:36:39 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652411/ https://lwn.net/Articles/652411/ raiph <div class="FormattedComment"> Oh, I'm sure there are lots of ways. We're talking about Perl here. :)<br> <p> The first thing I came up with:<br> <p> ($a,$b) ~~ :(Int, Int) or fail; $a + $b;<br> <p> The `:(...)` bit is a literal signature, exactly like the ones that appear in function definitions. The `~~` "smartmatch" operator, with these operands, does a trial bind of the argument list on its left with the signature on its right.<br> <p> I skipped testing the result because an Int can store arbitrarily large integers, and if all of RAM was consumed by a truly vast integer, an exception would (should) be raised by lower levels of the stack.<br> </div> Fri, 24 Jul 2015 22:19:19 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652399/ https://lwn.net/Articles/652399/ raiph <div class="FormattedComment"> <font class="QuotedText">&gt; Apparently what has changed in perl6 is that the "+" operator no longer works on strings.</font><br> <p> Sorry, my previous comment may have been confusing. The default Perl 6 number parsing now rejects a string that does not start with a decimal number.<br> <p> <font class="QuotedText">&gt; $ perl6 -e 'say "2" ~ "2" '</font><br> <font class="QuotedText">&gt; 22</font><br> <font class="QuotedText">&gt; $ perl6 -e 'say "2" + "2"'</font><br> <font class="QuotedText">&gt; 4</font><br> <p> <font class="QuotedText">&gt; Why is this a good thing?</font><br> <p> There are several things I can do with your question. I can consider it a simple, well-formed question and process it that way. I can consider it potentially dangerous, in part or whole, and process it on my own terms, picking out what's non-dangerous about the question and deal with that bit. Or I could just reject it as not something I am willing to process.<br> <p> For subjective input, Python tends toward the third option, to keep itself and its users sane in their world. Perl tends towards the middle, to keep itself and its users sane in theirs.<br> <p> <font class="QuotedText">&gt; Why isn't it telling me that I can't use the "+" operator on strings?</font><br> <p> Well, first, because you can. :)<br> <p> If you don't want that you can stop it in a given lexical scope:<br> <p> multi sub infix:&lt;+&gt; (Str, Any) { fail "nope" }<br> say "2" + 4 # dies with "nope" message<br> <p> One of the design assumptions in Perl 6 is that companies, teams and individual developers, will want to tighten or loosen strictness to suit their own view of what's dangerous, what's ill formed. Perl 6 makes it simple to bundle such policies in to single `use` statements that apply lexically. And these can be added to the ecosystem so that those with a similar philosophical mindset for a particular use-case can easily follow the same policies.<br> </div> Fri, 24 Jul 2015 21:52:29 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652408/ https://lwn.net/Articles/652408/ dvdeug <div class="FormattedComment"> In C, if you run across<br> <p> r_t funct (a_t a, b_t b) {return a + b;}<br> <p> a, b and the return value all have specific types known at compile time and invariant at runtime. On the other hand, you can pass values of arbitrary type to <br> <p> def add (a, b): return a + b<br> <p> and a and b and the return value have no types at compile time, and can have a number of different types during the runtime of the program. There's a big difference there.<br> <p> And it seems weird to say that Python variables are typed in this sense; it's like bragging that Python supports lowercase characters, except that way more programming language (implementations) have had problems with lowercase characters then have not had typed variables in this sense. As far as my memory will reach, only BLISS of all the non-assembly languages has not had types attached to their values either at compile or runtime.<br> </div> Fri, 24 Jul 2015 21:46:36 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652404/ https://lwn.net/Articles/652404/ dvdeug <div class="FormattedComment"> As the old quip goes "If you want Haskell, you know where to find it."* It really seems out of place in a subthread comparing Python and Perl.<br> <p> * I found that frustrating in the early 90s, as C was widely available and PL/I was not.<br> </div> Fri, 24 Jul 2015 21:21:26 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652396/ https://lwn.net/Articles/652396/ raiph <div class="FormattedComment"> <font class="QuotedText">&gt; Perl did not guess their format when it read them in; it read them in as strings.</font><br> <p> Perl 6 lets users directly specify input types for command line args:<br> <p> perl6 -e 'sub MAIN (Int $int, Rat $rat, $string) { .print and "\t".print and .WHAT.say for $int, $rat, $string }' 42 2 Foo<br> <p> Usage:<br> -e '...' &lt;int&gt; &lt;rat&gt; &lt;string&gt; <br> <p> perl6 -e 'sub MAIN (Int $int, Rat $rat, $string) { .say and .WHAT.say for $int, $rat, $string }' 42 2/10 Foo<br> <p> 42<br> (Int+{orig-string[Str]})<br> 2/10<br> (Rat+{orig-string[Str]})<br> Foo<br> (Str)<br> <p> Perl 6 displays an automatically generated usage message until you pass arguments that correspond to the specified types.<br> <p> When you do, it stores the typed values and the original string values so you can use either as appropriate to your needs.<br> <p> The design docs suggest a similar mechanism is supposed to be applicable to input other than command line args but Rakudo doesn't support that yet afaik.<br> <p> <font class="QuotedText">&gt; You implicitly told Perl to convert them to numbers when you used a numeric operator on them</font><br> <p> A nit: I'd say that treating operands of the `+` operator as numbers is explicit, not implicit.<br> </div> Fri, 24 Jul 2015 20:43:36 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652391/ https://lwn.net/Articles/652391/ raiph <div class="FormattedComment"> <font class="QuotedText">&gt; Floats should not silently convert to rationals.</font><br> <p> I can't imagine any language doing that. If your comment is aimed at Perl (5 or 6) then I think this is another manifestation of overall confusion about decimal fractions.<br> <p> <a rel="nofollow" href="https://en.wikipedia.org/wiki/Decimal#Decimal_fractions">https://en.wikipedia.org/wiki/Decimal#Decimal_fractions</a> <br> <p> <font class="QuotedText">&gt; Merely writing "3.14159" makes perl6 treat it as 314159/100000.</font><br> <p> Just for emphasis: <a rel="nofollow" href="https://en.wikipedia.org/wiki/Decimal#Decimal_fractions">https://en.wikipedia.org/wiki/Decimal#Decimal_fractions</a> <br> <p> Hopefully you'll spend a few seconds reading this wikipedia link and you'll go "ahhh". :)<br> <p> <font class="QuotedText">&gt; What happens when interfacing with a C library (say GSL)?</font><br> <p> One uses explicit typing in the signature (the list of parameters) of the Perl 6 functions that call the C functions. For example:<br> <p> sub add(int32, int32) returns int32 is native("libcalculator") { * }<br> <p> means that one must call the `add` function with two native 32 bit ints.<br> <p> See <a rel="nofollow" href="http://doc.perl6.org/language/nativecall#Passing_and_Returning_Values">http://doc.perl6.org/language/nativecall#Passing_and_Retu...</a> for some more details.<br> <p> <font class="QuotedText">&gt; Are these "rationals" then converted into floats before calling?</font><br> <p> They can be. It's controlled by explicit types and explicit type coercions in the signature. For example:<br> <p> sub foo(Num(Rat), Num) ...<br> <p> would be callable with:<br> <p> foo(13/17, 26e3)<br> <p> <font class="QuotedText">&gt; And are the return values converted back to "rationals"?</font><br> <p> Rakudo does not currently support signature based coercion of the return value; I don't know whether there's a plan to one day support that.<br> </div> Fri, 24 Jul 2015 19:19:02 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652393/ https://lwn.net/Articles/652393/ raiph <div class="FormattedComment"> What's the simplest way to get that fixed width code display? Are you having to use HTML mode to get it?<br> </div> Fri, 24 Jul 2015 18:58:05 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652380/ https://lwn.net/Articles/652380/ anselm <p> As far as Python is concerned, it is counterproductive to think of variables in terms of “slots” that can have “values” stored in them because that isn't really how the language works. Names in Python are really more like sticky labels attached to objects. If you stick your label on a new object, the type of the previous object you stuck it on doesn't matter, but as long as the label sticks to the same object, the type of that object determines what you get to do with it. Also, objects can have more than one label sticking to them. </p> Fri, 24 Jul 2015 16:15:29 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652375/ https://lwn.net/Articles/652375/ peter-b <div class="FormattedComment"> Well, to be perfectly pedantic, there are three things involved here:<br> <p> 1. The symbol<br> 2. The slot bound to the symbol<br> 3. The value stored in the slot<br> <p> Most programming languages attach type annotations to (2) or (3).<br> </div> Fri, 24 Jul 2015 16:00:46 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652372/ https://lwn.net/Articles/652372/ anselm <p> The problem is really that, as far as the “+” operator in Perl (5, at least – I haven't looked at Perl 6) is concerned, <tt>"123foobar"</tt> or for that matter <tt>"bazquux"</tt> are bona-fide <em>numbers</em> and therefore perfectly eligible to be added numerically. This tends to throw people off at times when instead they expect their compiler or interpreter to complain about a type mismatch. </p> <p> Having said that, in Perl you wouldn't expect “+” to do string concatenation because that operator is called “.”. Now as far as the “.” operator in Perl 5 is concerned, 123 and 3.1415 are bona-fide <em>strings</em> and therefore perfectly eligible to be concatenated. </p> <p> I teach Perl classes (among other subjects) for a living and in my considered opinion it is not a simple language to teach. Perl's idiosyncratic approach to evaluating expressions is something that many people find difficult to get to grips with, and previous experience with saner languages doesn't really seem to help a lot. It's not that what Perl does is illogical – it does have a certain twisted logic to it –, it's just that it's strange. Also, to really appreciate Perl you need to know C, the shell, sed, and awk, and few people nowadays do (at least the ones who end up in my classes generally don't). These days I prefer teaching Python because for all its shortcomings it is much easier to explain to people. </p> Fri, 24 Jul 2015 15:59:56 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652330/ https://lwn.net/Articles/652330/ mchapman <div class="FormattedComment"> <font class="QuotedText">&gt; Because it may be a bug?</font><br> <p> It could be, yes. All code can be wrong.<br> <p> I'm sure Perl 6 has a way to say "test that $a and $b are both Ints, throw an exception if they're not, otherwise add them together and, if the result can be stored in an Int, return that result, else throw an exception". You'll probably find it's a few more characters than + though.<br> </div> Fri, 24 Jul 2015 12:28:05 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652331/ https://lwn.net/Articles/652331/ mchapman <div class="FormattedComment"> <font class="QuotedText">&gt; You're changing the binding: the new a is different from the old a.</font><br> <p> OK, this just sounds like a problem of nomenclature. When I think of "variable", I think of "the symbol typed by the programmer", not "the value to which that symbol is currently referring".<br> <p> </div> Fri, 24 Jul 2015 12:24:31 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652328/ https://lwn.net/Articles/652328/ rsidd <div class="FormattedComment"> You're changing the binding: the new a is different from the old a. You can do that in any language, perl, C, even haskell. You're going to tell me haskell variables aren't typed? <br> </div> Fri, 24 Jul 2015 12:11:05 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652323/ https://lwn.net/Articles/652323/ rsidd <div class="FormattedComment"> Because it may be a bug? Oversmartness is bad whether it's pwrl or MS Excel. When I try to add strings the compiler/interpreter should tell me and not silently change the type! There is a reason programs in Haskell tend to run correctly the first time. <br> </div> Fri, 24 Jul 2015 12:03:56 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652322/ https://lwn.net/Articles/652322/ mchapman <div class="FormattedComment"> <font class="QuotedText">&gt; They're typed.</font><br> <p> No, they're not. Your code is printing out the types of the *values* inside those variables.<br> <p> Python quite happily lets you do:<br> <p> <font class="QuotedText">&gt;&gt;&gt; a = 4</font><br> <font class="QuotedText">&gt;&gt;&gt; a = "forty two"</font><br> <p> If these Python variables were typed, then the second assignment would throw an exception. It doesn't.<br> </div> Fri, 24 Jul 2015 11:55:43 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652321/ https://lwn.net/Articles/652321/ mchapman <div class="FormattedComment"> <font class="QuotedText">&gt; Why is this a good thing? Why isn't it telling me that I can't use the "+" operator on strings?</font><br> <p> Why should it? You asked for numeric addition; you got numeric addition. Why would you want it not do what you asked for?<br> </div> Fri, 24 Jul 2015 11:48:30 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652315/ https://lwn.net/Articles/652315/ mchapman <div class="FormattedComment"> <font class="QuotedText">&gt; Who said that I want concatenation?</font><br> <p> Your Python code asked for it. It seems reasonable to expect that if you're comparing two code snippets you wanted them to do roughly the same thing.<br> <p> <font class="QuotedText">&gt; There's a fundamental difference here - with Perl6's braindead number treatment, $a + $b can mean DIFFERENT things for different numbers.</font><br> <p> When does it not mean "add them together and produce a result that is the closest representable value to the answer"?<br> <p> I have only passing familiarity with Perl 6, but I would be totally surprised if this were ever not the case.<br> <p> But in Perl 5, whether a particular scalar should be treated as a number or a string depends only on the operator or builtin doing the interpretation. The + operator, for instance, interprets whatever you give it as a number.<br> <p> There are rules as to how this interpretation is done, and those rules are consistently applied. It seems that you think those rules aren't legitimate because they are based on the value, rather than some "type" associated with that value. If that's actually the case, then I'm afraid no explanation is likely to satisfy you. That's simply how Perl works.<br> <p> <font class="QuotedText">&gt; Which number? Rational, float, integer, bigint?</font><br> <p> Again, I refer to Perl 5 only.<br> <p> Scalar::Util::looks_like_number returns a true value iff Perl thinks the scalar "looks like a number". It's really just as simple as that. "Looks like a number" is quite well-defined by Perl. It has nothing to do with "types", because Perl doesn't have types in that sense.<br> <p> In practice, something that "looks like a number" can be used as if it actually were an integer or a float, assuming Perl actually had such things.<br> <p> Why does it not matter whether it's an integer or a float? Simple: that only matters when you use the value. The integer-ness or float-ness of the value is not intrinsic to the value itself. If you use it in an operation that demands a float, it will act like a float. If you use it in an operation that demands an integer, it will act like an integer. Same for strings and booleans. The value isn't any of these, but it will happily act like one if you ask it to.<br> <p> I really hope this explanation makes sense to you, even if you don't happen to like it. I'm out of ways to explain it!<br> </div> Fri, 24 Jul 2015 11:46:33 +0000 An interview with Larry Wall (LinuxVoice) https://lwn.net/Articles/652318/ https://lwn.net/Articles/652318/ rsidd <div class="FormattedComment"> <font class="QuotedText">&gt; Python variables are not typed.</font><br> <p> They're typed. The following is an example of how it should work.<br> <p> <font class="QuotedText">&gt;&gt;&gt; a = "2"</font><br> <font class="QuotedText">&gt;&gt;&gt; type(a)</font><br> &lt;type 'str'&gt;<br> <font class="QuotedText">&gt;&gt;&gt; from fractions import Fraction as Fr</font><br> <font class="QuotedText">&gt;&gt;&gt; a = Fr(3,4)</font><br> <font class="QuotedText">&gt;&gt;&gt; type(a)</font><br> &lt;class 'fractions.Fraction'&gt;<br> <font class="QuotedText">&gt;&gt;&gt; b = 2.5</font><br> <font class="QuotedText">&gt;&gt;&gt; type(b)</font><br> &lt;type 'float'&gt;<br> <font class="QuotedText">&gt;&gt;&gt; c = a*b</font><br> <font class="QuotedText">&gt;&gt;&gt; print c</font><br> 1.875<br> <font class="QuotedText">&gt;&gt;&gt; type(c)</font><br> &lt;type 'float'&gt;<br> <font class="QuotedText">&gt;&gt;&gt; d = Fr(4,5)</font><br> <font class="QuotedText">&gt;&gt;&gt; e = a*d</font><br> <font class="QuotedText">&gt;&gt;&gt; type(e)</font><br> &lt;class 'fractions.Fraction'&gt;<br> <font class="QuotedText">&gt;&gt;&gt; print e</font><br> 3/5<br> <p> </div> Fri, 24 Jul 2015 11:26:26 +0000