Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming

Ask Slashdot: What Are the Strangest Features of Various Programming Languages? 729

itwbennett writes: Every programming language has its own unique quirks, such as weird syntax, unusual functionality or non-standard implementations -- things that can cause developers new to the language, or even seasoned pros, to scratch their heads in wonder (or throw their hands up in despair). Phil Johnson has rounded up some of the strangest — from the + operator in JavaScript to the trigraphs in C and C++ and indentation level in Python. What programming language oddities cause you the most grief?"
This discussion has been archived. No new comments can be posted.

Ask Slashdot: What Are the Strangest Features of Various Programming Languages?

Comments Filter:
  • by Anonymous Coward on Friday September 05, 2014 @12:24PM (#47835239)

    Posting a slideshow on Slashdot? Lame. What, was Buzzfeed not available?

  • Database Identity (Score:3, Insightful)

    by Baby Duck ( 176251 ) on Friday September 05, 2014 @12:26PM (#47835255) Homepage
    It's outdated database security models that cause me the most grief. I don't want jsmith logging in from gatech.edu to be considered a DIFFERENT HUMAN BEING that jsmith logging in from whitehouse.gov. I want to say, there's ONE PERSON, John Smith, username jsmith, who is allowed to login from BOTH domains with the SAME PASSWORD and GRANTS. Nope. Can't do it. Newer versions MIGHT allow you to swap in your own authentication module instead, but NOT the authorization piece, so I'm still screwed!
  • Infoworld... pass (Score:3, Insightful)

    by Anonymous Coward on Friday September 05, 2014 @12:26PM (#47835257)

    I envision an add filled slideshow with almost no content, and what content is there to be boring and well known so I’ll skip the article.

    To answer the question, most of perl seems to be built around bizarre unintuitive constructs that you just have to kinda know about, so pointing out any of that would seem unfair.

    In C, the first time I saw the size of elements of a struct specified (i.e. int something : 3) it threw me (and that’s a hard problem to google). It was being used to essentially overlay a struct onto a chunk of memory being received via an interface and extract values, which was actually kinda a cool use of the feature (though a comment woulda been nice unknown dev!).

    Some of the type erasure mechanics of Java can be a bit confusing the first time you hit up against them.

    The way javascript does dates, and timezones

    I dunno, most languages have their weird bits, but I can’t think of anything that is egregiously terrible.

    As far as tools, I'd say pacman (Arch's package manager) and git (yes, I'm an SVN fanboy) have the highest concentration of "the hell were they smoking" flags and usage instructions. Pacman seemed to pick it's arguments randomly, and git seems to go straight off the deep end if you want to do anything non-trivial.

  • Perl: TMTOWTDI (Score:5, Insightful)

    by i_want_you_to_throw_ ( 559379 ) on Friday September 05, 2014 @12:29PM (#47835305) Journal
    I used to think that Perl's feature of "There's More Than One Way To Do It" was great until I had to start modifying and maintaining the code of other developers, (several over the years). 20+ years I've been with Perl and I gotta say that through the years this has probably caused me more frustration than anything. Python, comparatively speaking, is a dominatrix and I'm starting to enjoy "There's Only One Way To Do It".
  • by Anrego ( 830717 ) * on Friday September 05, 2014 @12:30PM (#47835307)

    I don't even bother with infoworld links any more. It'll be a bunch of slides with a sentence of text, an unrelated image, and ads everywhere (ads on the slides, ads before the slides, an add in the middle of the slideshow, and an ad at the end). Content wise, usually they find one or two interesting things, then fill the rest of the slots with stupid shit everyone already knows.

  • by Tukz ( 664339 ) on Friday September 05, 2014 @12:33PM (#47835339) Journal

    And not only that, the slides slides to advertisements WHILE YOU'RE READING THEM!
    Closed the tab at that point.

  • by Anonymous Coward on Friday September 05, 2014 @12:41PM (#47835431)

    Posting a slideshow on Slashdot? Lame. What, was Buzzfeed not available?

    second this. I'm not going to click 12 times for a couple paragraphs worth of information.

  • by amicusNYCL ( 1538833 ) on Friday September 05, 2014 @12:43PM (#47835439)

    That was my experience. I opened the page, clicked Next past the intro slide, saw a picture of apples and oranges, some text talking about "+" in Javascript, clicked Next again, it faded out to show an ad that I blocked, and I closed the page. Bunch of crap.

  • by TheDarkMaster ( 1292526 ) on Friday September 05, 2014 @01:03PM (#47835651)
    The difference is that the "+" operator in a strong-typed language works without causing nasty surprises for you.
  • Re:Powershell (Score:4, Insightful)

    by VGPowerlord ( 621254 ) on Friday September 05, 2014 @02:22PM (#47836433)

    - sizeof(string) (I may have got the name of the function wrong) returns the length of a single byte rather than the length of the entire string. Who the hell thought that would be a good idea?

    Hey, just because you don't know the language doesn't mean it's necessarily wrong. Documentation for sizeof would have told you that it's for telling you the size in bytes of datatypes on a particular system. It's often paired with malloc to allocate memory for something.

    The C specification is remarkably lax on the size of its numeric datatypes, too. To the point where eventually a bunch of bit-specific sizes were introduced because the basic versions weren't. example: uint32 is a 32-bit unsigned integer, where as uint is an unsigned integer that's 16-bits or larger depending on the platform.

    For that matter, even pointer size changes depending on systems. For instance, it's 4 bytes for 32-bit Intel systems and 8 bytes for 64-bit Intel systems.

  • by SpaghettiPattern ( 609814 ) on Friday September 05, 2014 @04:16PM (#47837341)

    I believe none of you actually programmed in C. A string terminated by \0 can be represented by a single pointer and an have any length. You can also easily let the string keep growing (until the allocated memory is finished.) That is the epitome of KISS. If you use an 8 byte character at the beginning then you are limited to a string length of 255. A structure with a length and a string pointer (or a character array) is much more complex and that would reflect in more complex library functions.

    C was invented by exceptionally bright people. For a language that was primarily designed to program kernels its remarkably versatile. If you are seeking a language to write administrative applications then you should look further. COBOL back in the days or Java nowadays would suit you better. And yes, there is a difference in programming prowess between kernel / library programmers and application programmers. The latter "just" have to get the business logic going and are allowed to use every trick in the book. The former must be very concise and consider that their code will be used by a huge amount of other programs.

  • Re:Powershell (Score:5, Insightful)

    by nine-times ( 778537 ) <nine.times@gmail.com> on Friday September 05, 2014 @04:36PM (#47837477) Homepage

    You know, I kind of hated Powershell until I was forced to use it.

    I still hate it. But then I have to write a bash script, and I run across some specific problem while writing a bash script, and find myself thinking, "This would be easier in Powershell." So that's something.

    It's really not like Batch files, though. It really isn't that bad of a scripting language.

  • Platform lock-in (Score:4, Insightful)

    by Shompol ( 1690084 ) on Friday September 05, 2014 @04:39PM (#47837511)
    Platform lock-in is the strangest feature of some languages that purposely defeat all the progress we made since Assembler. This is why I will never C#

An Ada exception is when a routine gets in trouble and says 'Beam me up, Scotty'.

Working...