5

Is it just me or after working with languages like C and java, javascript's practises seems out of place ? Like readability can go to hell i will write a whole function instead of arguments.

Comments
  • 1
    @rutee07 i was cringing all night over that, i cant imagine someone actually thought it be a good idea to do so.
  • 3
    What did you mean about writing a whole function instead of arguments? Can you give an example?
  • 0
    Believe me, after working with a real type system, Java, C++, C# etc. seem out of place... I mean, the whole languages. :D
  • 0
    @platypus something like this.
  • 2
    @techno848 Yeah, OK. To be fair, there's no way I'm leaving the blame for that code at JavaScript's door.

    Yes, it lets programmers hurt themselves, but whoever wrote that snippet was looking for pain.
  • 1
    @platypus in my recent project i had to work with JS for maps api and have never worked with JS before so these things are surprising when i see them in every snippet i go through, even in the sample code from google had the same thing.
  • 0
    @kpenc i dont have much experinece with web technologies but both php and javascript were surprising for me.
  • 1
    @techno848 This is not about web or not, it's about dynamic typing.
  • 1
    @kpenc wait, are you saying Java doesn't have a real type system? I'd love to hear more...
  • 1
    @franga2000 Of course it doesn't. Think about a value that must be of type X. Yes, it could be of type X, also might be Null. If a function returns the type X, the same thing applies, but also the function might never return due to infinite recursion for example, or it might throw. This type system gives a false feel of stability and security. Not to mention the verbosity.
  • 1
    @samblaise read up on the Hidley-Milner inference and the ML family of languages type systems. Why are you arguing without informing yourself first?
  • 1
    @kpenc sorry, but you can't just go out and call all other type systems 'not real' because they're different from the one you prefer (I'm guessing Haskell). What makes a type system real? I could argue that the only 'real' type system is one that is explicit and unambiguous. Since HM infers all types, the programmer can not explicitly define them, making it not a 'real' type system.
    This, of course, would be absurd.
    Also, as I understand it, HM is defined only for lambda calculus and thus only relevant for functional languages. This makes your statement equivalent to "The language [type] I prefer is the only real language [type]". I hope you can see how this statement could be received poorly.
Add Comment