2
leksyib
18d

My problem with coding golang or other strictly typed languages is that you have to do what it wants, meanwhile it’s meant to be the other way around. Bro, If i want to compare a string with a fucking int32 or float64, fucking leave me alone and just run it

Comments
  • 10
    The point of typed languages is that devs don't do such dumb shit.
  • 4
    @leksyib
    It smell like bitch in here.
  • 4
    Python/JavaScript have spoiled you too much lmfao
  • 5
    And then you will complain because meaningful compare between those depends on the context.

    Remember: Explicit is better than implicit.
  • 1
    @Bubbles python did not allow such blasphemy as using strings instead of numbers the last time I've used it.
  • 0
    @iiii Well, yeah, it will most likely crash at some point, but there's nothing in Python to prevent such code from running into that condition ahead of time. Static analysis helps a lot, but it's optional and AFAIK there's still no way to enforce types in Python (and there won't be, I guess).
  • 0
    @iiii can’t you compare floats and ints in python?
  • 0
    @gronostaj python is strongly typed. It already doesn't perform any implicit conversions except for numerical ones as far as I remember. Also there are type hints in 3.6 which can be statically checked.
  • 2
    @Bubbles floats and integers are comparable almost in any language. The question was more absurd: comparing strings and numericals.
  • 0
    @iiii ohhhh okay yeah
  • 0
    The point of strict typing is that *you* control what the compiler does, to know exactly what kinda of data you work with.

    Meanwhile weak typing lead to python which gives you bullshit like
    None, [], (), {}, "", range(0), 0, 0.0
    All defaulting to false in an if statement
  • 1
    @iiii Well, that sounds like what I wrote above ;) You learn about the issue at runtime, and at the spot where it becomes problematic rather than where the problem takes its root. Static analysis is optional and type checking in runtime is frowned upon. Sure, it's better than crap like "0xf" == 16, but still - it lets you run into issues that could be easily avoided ahead of time.
  • 0
    @gronostaj I mean there's a way to scan the code ahead of time and verify whether you try to call it with incorrect types of you have type hints. Though I'm not sure how good it works.
  • 4
    @iiii if you're already putting type hints, why not just put in a proper type system :p
  • 0
    @RememberMe yeah, I know, I wish that would be the case, then Python could become the New C++. But there is a strong type system in Python. The problem is dynamic typing: every variable label is not bound to point to a specific type. With that paradigm it's basically impossible to impose types statically.

    Also I like the Python's approach to typing: typing by interface. That shit is coming to C++20 BTW.
Add Comment