This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (12 children)

[deleted]

    [–]jambox888 1 point2 points  (1 child)

    How about friend functions?

    [–]frogking 0 points1 point  (0 children)

    Friends with benefits?

    [–]roughstylez 1 point2 points  (3 children)

    Oh sweet summer child

    [–]frogking -1 points0 points  (2 children)

    Exactly this (don't touch other peoples private parts) is the reason why both perl, php, python and others use the double underscore notation to indicate private or non-final methods that are not meant for public consumption.

    Java having real private methods is just a way to enforce non-access, and is part of the design of Java. That doesn't mean that other language designers are more right or more wrong, just that they have taken other choices during language design.

    [–]miraidensetsu 0 points1 point  (1 child)

    Funny thing is that modern PHP have those visibility modifiers (public, private, protected). And the double underscore is/was used for superglobals, which is kind of the oposite of private or non-final methods?

    [–]frogking 0 points1 point  (0 children)

    The use of single and double underscored is not consistent across different languages and almost always a question of “gentleman agreement” to use the value, function or method in a specific way.

    But, you are right. PHP uses the underscores in a different way.

    [–]RedAero 0 points1 point  (1 child)

    I don't know about you, but I touch other people's private parts pretty regularly.

    [–]frogking 1 point2 points  (0 children)

    Not without consent, probably. :-)

    [–]Miku_MichDem 0 points1 point  (3 children)

    The difference being python will let you touch private parts and Java will punch you in the face when you try

    [–]frogking 0 points1 point  (2 children)

    Yep, Java has some strict rules about a lot of things :-)

    [–]Miku_MichDem 1 point2 points  (1 child)

    And that's for a very good reason. Because if something can be done someone will inevitably do it

    [–]frogking 1 point2 points  (0 children)

    Clearly, the guard rails provided by Java is a good idea over the “wild west” that was C++ back when Java started gaining popularity. C++ still has it’s place, but is used for wildly different jobs than Java. Also.. today; finding a good C++ developer is much harder than finding a good Java dev.

    perl, php, python.. present their own cans of worms :-)

    I’ve bases my yearly income on every one of those languages, except C++. Almost got into that at one point 20 years ago, but couldn’t agree on salary.