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

10 of 729 comments (clear)

  1. Powershell by Anonymous Coward · · Score: 5, Interesting

    -eq as the equality operator in Powershell is pretty odd.

    1. Re:Powershell by Vlad_the_Inhaler · · Score: 5, Funny

      I'm from a different generation. When I was learning things there were attempts made to make languages somewhat failsafe by avoiding ambiguity. Then I saw the C syntax.
      - if (a = b) assigns the contents of b to a and executes the code following if b <> 0. Who the hell thought that would be a good idea?
      - 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?
      - strings terminated by a binary zero rather than their physical size. Who the hell thought that would be a good idea?

      Kids grew up with this idiocy, I program in Fortran, Cobol, even Assembler to avoid that mess. Oh, and buffer-overruns have been a serious security problem for years now. Well what a f****** surprise.

      --
      Mielipiteet omiani - Opinions personal, facts suspect.
    2. Re:Powershell by Bacon+Bits · · Score: 5, Interesting

      Two reasons:

      1. POSIX environments have already been done on Windows, and they universally suck. SFU/Interix is shit. Cygwin is shit. MKS Toolkit is shit. MinGW/MSYS, which does a better job than any of them, is mostly shit. Even UnxUtils, which is just binaries modified for use with the actual Windows cmd shell are mostly shit. There are so many fundamental differences of philosophy that make working with a Windows system as though it were a POSIX system fundamentally untenable. You're stuck with mostly just munging text files in a binary world.

      2. Powershell is what .NET developers think Windows administrators want in a shell. That's why you're allowed to do stuff like import .NET assemblies and use essentially unmodified C# code, but there's still no native SFTP client or server.

      Powershell is about 90% of what an administrator actually wants in a shell, and it's actually not that bad. Compared to cmd.exe or VBscript it's balls out fantastic. However, an administrator shouldn't need to learn about .NET objects to be able to write a script, and they shouldn't feel like there's such a fundamental separation between what the shell can do with .NET piping and what executable programs can do. There's a very real encouragement to make everything in Powershell written in and with Powershell exclusively. Like no calling of a binary to do something unless you have no other choice. The shell and the community philosophy very much discourage that... for no real reason other than it's more difficult to get a .NET object out of a binary file and manipulate it with arbitrary .NET methods. I've seen people re-implement a command line zip program with [System.IO.Compression] instead of just using 7z.exe. Why? Just so they can use .NET objects that they never do anything with.

      Honestly I really love Powershell, but I wish the philosophy were geared more around getting shit done than getting shit done with .NET.

      --
      The road to tyranny has always been paved with claims of necessity.
  2. a fucking slideshow? by Anonymous Coward · · Score: 5, Insightful

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

  3. Lua[0]? by ThisIsSaei2561 · · Score: 5, Interesting

    Lua's standard is, for things like arrays, to start counting from 1. The unlearning of old habits made this a hard adjustment.

    1. Re:Lua[0]? by Anonymous Coward · · Score: 5, Funny

      Bookkeepers, shepherds, scientists and mathemaitcians have for centuries counted starting with 1. It is recent computer scientists that started this crazy standard break, as if they knew better how to count.

  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. If you print a lot and want a ink spare language by NotInHere · · Score: 5, Funny

    use whitespace. Be warned, several problems have been reported when posting source code to the internet.

  6. Stackoverflow's got a list by Tridus · · Score: 5, Informative

    http://stackoverflow.com/quest...

    That's a list of very strange language features. Unsurprisingly, Javascript makes many, many appearances.

    --
    -- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
  7. Re:Null Terminated Strings by zephvark · · Score: 5, Funny

    Nonsense. C is a more elegant weapon for a more civilized age. It's a shame that mass-produced coders have to rely on blasters.