Slashdot Mirror


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

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?"

13 of 729 comments (clear)

  1. a fucking slideshow? by Anonymous Coward · · Score: 5, Insightful

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

    1. Re:a fucking slideshow? by Anrego · · Score: 4, Insightful

      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.

    2. Re:a fucking slideshow? by Tukz · · Score: 3, Insightful

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

      --
      - Don't do what I do, it's probably not healthy nor safe. -
    3. Re:a fucking slideshow? by Anonymous Coward · · Score: 0, Insightful

      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.

    4. Re:a fucking slideshow? by amicusNYCL · · Score: 4, Insightful

      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.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  2. Database Identity by Baby+Duck · · Score: 2, Insightful

    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!

    --

    "Love heals scars love left." -- Henry Rollins

  3. Infoworld... pass by Anonymous Coward · · Score: 3, Insightful

    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.

  4. Perl: TMTOWTDI by i_want_you_to_throw_ · · Score: 5, Insightful

    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".

  5. Re:+ operator for string concat? by TheDarkMaster · · Score: 4, Insightful

    The difference is that the "+" operator in a strong-typed language works without causing nasty surprises for you.

    --
    Religion: The greatest weapon of mass destruction of all time
  6. Re:Powershell by VGPowerlord · · Score: 3, Insightful

    - 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.

    --
    GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  7. Re:Null Terminated Strings by SpaghettiPattern · · Score: 4, Insightful

    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.

    --

    I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
  8. Re:Powershell by nine-times · · Score: 4, Insightful

    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.

  9. Platform lock-in by Shompol · · Score: 3, Insightful

    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#