News for hackers. Stuff that matters.
Re:The Fall Of Perl, The Web's Most Promising Language by pyre on Monday February 24, 2014 @01:48AM (#7289441)
> People make fun of Perl [...] but I think Python's [...] are much uglier

Do you really expect this to end well? There are endless flamewars raging across the Internet about the 'correct' way to place braces with both sides claiming that the other side's solution is 'uglier.'

> And no one will ever convince me that significant-white-space and not having block enders are good ideas

Insightful discussion doesn't usually stem from the phrase 'no one will ever convince me.'

> it makes refactoring and copy-pasting code hazardous

I see this bandied about a lot, but I'm curious if people actually run into this issue. I certainly haven't run into this issue, nor have I come across anyone who has had this issue.

A couple of points:

1) This comes across to me sort of like the arguments against git due to the user's ability to rewrite commits (e.g. "I can't use git because you can rewrite commits; therefore when someone fixes a bug they will rewrite the commit that introduced the bug rather than patch the current state of the repo"). Arguments that are theoretical, rather than practical. Similar to the other top-level poster claiming that significant whitespace will run into issues with all of the Unicode whitespace characters.

2) When you copy-paste Perl (or C, or Java, etc) code, do you not reformat that code anyways? I shudder to think of the code base where refactoring efforts rely on copy-pasting code without any sort of a consistent style since "it's between the braces, so we're all good."

3) This seems to be an argument that runs along the lines of static-vs-dynamic typing. One side argues that static-typing is "better" because you don't have to worry about type errors cropping up at runtime, since they are resolved at compile time. You're arguing that it's 'hazardous' to copy-paste or refactor code because you could mess up the indentation, but you don't have to worry about these things 'for free' when you have more concrete start- and end-block semantics.

Re:The Fall Of Perl, The Web's Most Promising Language by pronik on Monday February 24, 2014 @09:17AM (#7290829)
> 2) When you copy-paste Perl (or C, or Java, etc) code, do you not reformat that code anyways?

Yes, with Perl::Tidy and one keyboard shortcut bound to it. With Python I have to manually and very carefully block-indent the pasted fragment and then figure out how it fits into existing code. Even if there were a proper Python code formatter (hint: there isn't anything even close in functionality to Perl::Tidy) it wouldn't be able to figure out the code, since whitespace is significant. No such thing in Perl -- paste, tidy, rinse and repeat.

Re:The Fall Of Perl, The Web's Most Promising Language by ptx on Friday March 07, 2014 @06:55PM (#7363539)
> Yes, with Perl::Tidy and one keyboard shortcut bound to it. With Python I have to manually and very carefully block-indent the pasted fragment and then figure out how it fits into existing code.

No need to do it carefully or manually. The indentation within the fragment will be internally consistent, as will the indentation in the existing code you're pasting it into. So you just have to figure out the difference in indentation level between the two and use whatever keyboard command your editor has (e.g. C-c < and C-c > in Emacs) to shift the whole fragment.

> Even if there were a proper Python code formatter (hint: there isn't anything even close in functionality to Perl::Tidy) it wouldn't be able to figure out the code, since whitespace is significant. No such thing in Perl -- paste, tidy, rinse and repeat.

Right, but in Python there is no such thing as reformatting. The information about the structure is already encoded in the indentation, so it's neither possible nor necessary to reconstruct it from other formatting characters.

In other words, whereas in Perl and C-like languages you would 1) edit the braces so that they're correct and then 2) automatically reconstruct the indentation to match the braces, in Python you simply 1) edit the indentation so that it's correct.

Re:The Fall Of Perl, The Web's Most Promising Language by collyw on Tuesday February 25, 2014 @02:20AM (#7296158)
Yes, you have to think a bit more when reformatting Python, but it is worth it as you never get the missing brace problem that you can get when moving Perl blocks around. Its enough of a benefit for me.
Re:The Fall Of Perl, The Web's Most Promising Language by pronik on Friday March 07, 2014 @03:10PM (#7362450)
The point is: I don't have to think at all. Reformatting code with Perl is a matter of a save hook in the editor or a pre-commit hook in your VCS. No thinking necessary, it just works.
Re:The Fall Of Perl, The Web's Most Promising Language by chromatic on Monday February 24, 2014 @02:04AM (#7289490)
When you copy-paste Perl (or C, or Java, etc) code, do you not reformat that code anyways?

Sure, but you don't have to worry about reformatting making code that was correct suddenly and subtly incorrect.

Re:The Fall Of Perl, The Web's Most Promising Language by pyre on Monday February 24, 2014 @02:15AM (#7289512)
When I use C, I don't have to worry about subtle type errors cropping up at runtime. Should we all ditch dynamic-typing for Haskell?
Re:The Fall Of Perl, The Web's Most Promising Language by chromatic on Monday February 24, 2014 @02:24AM (#7289534)
I don't understand this analogy, unless either C or Haskell allows invisible characters copied and pasted incorrectly to cause semantic errors. (I've used both Haskell and C for non-trivial purposes and can never recall that to be the case.)
Re:The Fall Of Perl, The Web's Most Promising Language by pyre on Monday February 24, 2014 @03:48AM (#7289749)
> reformatting making code that was correct suddenly and subtly incorrect

and

> invisible characters copied and pasted incorrectly to cause semantic errors

are two different issues. Reformatting doesn't insert (unexpected) invisible characters[1].

As to copy-pasting, this issue already exists in other forms with other languages. How long would it take most people to find the error here:

  my $variable = “(#`д´)ノ”;

[1] I guess I should specify "if you are using a decent editor".
Re:The Fall Of Perl, The Web's Most Promising Language by Mithaldu on Monday February 24, 2014 @07:24AM (#7290391)
Perl points that out very nicely:

    C:\Users\Mithaldu>perl -e "  my $variable = “(#`д´)ノ”;"
    Unrecognized character \x93; marked by <-- HERE after ariable = <-- HERE near column 18 at -e line 1.
Re:The Fall Of Perl, The Web's Most Promising Language by pyre on Monday February 24, 2014 @11:07AM (#7291508)
That may be, but this thread seems to be "Python is a language with serious deficiencies because whitespace!" If that's the case, then people are pitting Python up against all other languages, not just Perl.

That being said, even with the helpful Perl error message, the less experienced developers may have issues trying to determine why Perl doesn't like their double-quote before they figure out what the real issue is.

I guess I should be clear, that I'm not hating on Perl. It's more that I see the "OMG! Semantic whitespace in Python!" argument as a bit of a red herring if that's your only reason for not using the language.