Thread: Worst language features, all languages?¿?

  1. #1
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877

    Worst language features, all languages?¿?

    Hello all,

    I've recently, for the past 3 months or so, been relearning JavaScript in order to build a game engine based on the new HTML5 canvas API.

    I first learned it as a young teen, and at that time was oblivious to it's downsides. Now that I've delved deeper into the actual language (rather than just making pretty effects), the downsides stick out more blatantly.

    For instance the same mechanism that makes closures possible (scope reference chain), also makes it possible to sneakily create global variables from undeclared ones.

    Also being able to call methods from different objects with a similar interface allows polymorphism, but when the same functions are called without an object, the 'this' is bound to the global object (called "window" in browsers), unless you state that you want to use strict mode.

    This isn't to bash any language, I just have a theory that bad features often come as a side effect of doing old things in new and interesting ways.

    So basically, I'm wondering what are the worst language features of any language you know? Also, any reasoning for their inclusion in the language of reference is a plus!

    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Alpo View Post
    So basically, I'm wondering what are the worst language features of any language you know? Also, any reasoning for their inclusion in the language of reference is a plus!
    That which annoys me most is dynamically typed languages where anything and everything is a variable and anything is a property or method, or "undefined" if it doesn't exist. *cough* javascript *cough*
    The reason is simple: so many bugs that are typically found at compile-time are now shifted to runtime instead.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    May 2014
    Posts
    121
    "Register globals" in PHP. It has been removed now but damn did it cause a lot of security issues when it was still widely used.

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Alpo View Post
    For instance the same mechanism that makes closures possible (scope reference chain), also makes it possible to sneakily create global variables from undeclared ones.
    Only if you actively do it.

    Quote Originally Posted by Alpo View Post
    Also being able to call methods from different objects with a similar interface allows polymorphism, but when the same functions are called without an object, the 'this' is bound to the global object (called "window" in browsers), unless you state that you want to use strict mode.
    Only if you actively do it.

    Quote Originally Posted by Alpo View Post
    This isn't to bash any language, I just have a theory that bad features often come as a side effect of doing old things in new and interesting ways.
    I have a different outlook. Bad features are either:


    • The absence of a feature. This is the cardinal of bad features. In a programming language, no feature means no dice. And not being able to do something with a computer language is pretty much the equivalent of limiting the English vocabulary to just the words we want. Which makes for a pretty lame conversation.
    • A feature that doesn't work as documented. This of course includes bugs but NOT features that kill/crash the application or burn the computer if this is explicitly told in the documentation. Exceptions are good features, and overclockers rely on multitasking to burn their test processors.


    As I tried to illustrate above in an answer to your worst features list, a feature with usage rules and documented patterns isn't a bad feature. It's a good feature and quite possibly even a great feature. It's your fault if you don't care enough about your programming language to learn its semantics and idioms.

    It is in trying to protect the programmer against itself that we have been devising ever more weak programming languages. It is in looking at programmers as irresponsible children that need orientation, that we have been devising ever more limited programming languages. And as a byproduct of all that, we have been breeding ever more weak and limited programmers.

    In fact one of the worst tragedies to ever happen to computer science was when the first person came up with the idea that programming languages should be created on top of Ideology.

    But, won't help to cry of spilled milk. Just know that you should really quickly drop your idea that a bad feature is a feature that expects you to think before you use it. That is exactly what constitutes a great feature.

    Just like with the example Elysia gave of a bad feature. (and that was unfortunately upvoted by a good deal of people).

    Dynamic typing is not a bad feature. It is in fact a good feature. In fact a great feature to have in many (but not all) contexts! Just learn to use its decades-old and well-documented patterns and idioms. If you do that you will realize the whole runtime debugging scaremongering BS he speaks of is complete and utter nonsense. But if instead you choose to stay anal retentive to different programming paradigms than the only bad feature in here is You.

    Bless the language that gives you the choice between dynamic and static typing, and, why not, between strong and weak typing.

    And the only reason I'm making this post so long is because this is an issue dear to me. I want programming languages that offer me choice and aren't afraid of programmers. And I want back those geek and unkempt intellectual programmers, instead of the vanity types polishing their tin medals on top of justin bieber programming languages.

    Now... to end this, two features I don't like about Python, the language I have been learning of late:


    • No function overloading
    • import this
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    No function overloading
    O_o

    No native function overloading
    o_O

    I fixed that for you.

    Sure, the example is simple. You need to instill quite a lot more power to give enough juice to be really useful, but the example shows the beginning of a possible path, and I would imagine that anyone using a version with decorators would prefer the sugar.

    Soma

    Code:
    class FunctionOverloadable(object):
        def __init__(self):
            self.mSignature = {}
        def __call__(self, *args):
            self.mSignature[tuple(c.__class__ for c in args)](*args)
        def overload(self, fSignature, fImplementation):
            self.mSignature[fSignature] = fImplementation
    
    DoSomething = FunctionOverloadable()
    
    def DoSomethingImplementation(f):
        print("int")
    
    DoSomething.overload((int,), DoSomethingImplementation)
    
    def DoSomethingImplementation(f):
        print("float")
    
    DoSomething.overload((float,), DoSomethingImplementation)
    
    DoSomething(1)
    
    DoSomething(1.0)
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  6. #6
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by Mario F.
    Only if you actively do it.
    I said, "makes it possible". The rules of the language make these things possible even when not actively doing it (else there would be no need to not do it).

    I like dynamic typing, but I also agree that the analysis tools that I have aren't the most helpful. JsLint is probably the best, and most of it's analysis is "Look here, you're letting JavaScript use its own type coercion!", or "Put the use strict statement at the top of your functions!". However, it can't deal with things like circular type declarations (that is if class b uses class a, and vice versa, then it will say you are using a type before its been declared).
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Mario F. View Post
    Just like with the example Elysia gave of a bad feature. (and that was unfortunately upvoted by a good deal of people).
    I didn't say it was a bad feature (i.e. a poorly designed feature agreed as a whole by a community or experts). I said it annoyed me.
    Dynamic typing can be both good and bad. Ups and downs. For me, the way javascript does it is a huge down for me. But that's me. For others, it may be a huge up.

    Quote Originally Posted by Mario F. View Post
    Just learn to use its decades-old and well-documented patterns and idioms. If you do that you will realize the whole runtime debugging scaremongering BS he speaks of is complete and utter nonsense.
    It's not.

    Quote Originally Posted by Mario F. View Post
    Bless the language that gives you the choice between dynamic and static typing, and, why not, between strong and weak typing.
    I'd like such a language.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    In my opinion the worst language feature and most oft-abused goes to C#.

    It is var. Its very name can spawn a debate in the friendliest of places. Likely even in this thread.

    Spawn of the devil. Let's hide the actual type of the variable from the person who needs to see it most (the developer) while maintaining its type under the hood to ..um...save typing. Valid use case for LINQ expressions but unfortunately its use was not limited to LINQ by the compiler. Now it's just a mess and has spawned a million debates.

    Worst offender and propagator of var nonsense: ReSharper.
    Last edited by VirtualAce; 03-17-2015 at 09:37 AM.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    That's interesting because I find features that deduce type to be the holy grail. They save on typing, and automatically match types so you can "forward" types in a local function without having to go back and change every type if you change one and they can make code less verbose by omitting the type. I'm sure there are all kinds of debates, but in my opinion, a good IDE should show you the type, or you can easily jump back to the definition. Visual Studio provides such features, making it easy to use these type deducing keywords.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    I also don't really like dynamic typing. Maybe it's because I started with languages that were statically typed but I feel the same as Elysia about it. That being said, I'm amazed at the power of languages like JavaScript and PHP. What they allow you to actually do is astounding to me but that might just be because I'm late to the web development party.

  11. #11
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Quote Originally Posted by VirtualAce View Post
    In my opinion the worst language feature and most oft-abused goes to C#.

    It is var. Its very name can spawn a debate in the friendliest of places. Likely even in this thread.
    I'm pretty sure JavaScript did it before C#. And probably other languages before that. I personally avoid using it in production code unless it's a LINQ result.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 21
    Last Post: 10-19-2005, 04:39 PM
  2. Replies: 12
    Last Post: 12-12-2004, 10:51 PM
  3. The worst and most useless programming language?
    By egrooker in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 12-12-2002, 08:08 PM