News for hackers. Stuff that matters.
Re:Effect of Perceptual Load on Performance Within IDE in Pe... by still_grokking on Friday July 14, 2023 @07:04PM (#36731132)
> For this code: > > from typing import Dict > x: Dict[str, int] = {2: "hello"} > print(x[3]) > class Hello: > def __init__(self) -> None: > self.x = 1 > b = Hello() > b.y = 2 > c: str = b.x > print(b.y) > > generates this: > > main.py:2: error: Dict entry 0 has incompatible type "int": "str"; expected "str": "int" [dict-item] > main.py:3: error: Invalid index type "int" for "dict[str, int]"; expected type "str" [index] > main.py:8: error: "Hello" has no attribute "y" [attr-defined] > main.py:9: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment] > main.py:10: error: "Hello" has no attribute "y" [attr-defined] > Found 5 errors in 1 file (checked 1 source file)

Nonsense.

Python "generates" this:

  Traceback (most recent call last):
    File "/home/me/test.py", line 3, in <module>
      print(x[3])
            ~^^^
  KeyError: 3
> You are completely Wrong on these statements.

You're completely wrong about almost everything you've claimed so far…

> The contents of a string can't be type checked […]

Nonsense.

This may be true for Python's type checking tools, but that's not a general limitation of type checking.

  class Test:
    // The annotation is unrelated to the demonstration of singleton types.
    @annotation.targetName("m_foo") // This avoids double definitions at the byte-code level.
    def m(p: "foo") = "I only work with 'foo'!"
    def m(p: "bar") = "I only work with 'bar'!"
  
  Test().m("foo")
  Test().m("bar")
  
  // Test().m("baz")
  // >> Compile time error:
  // None of the overloaded alternatives of method m in class Test with types
  //  (p: ("bar" : String)): String
  //  (p: ("foo" : String)): String
  // match arguments (("baz" : String))
Static dispatch, even with overloads, works just fine for (in this case string) singleton types.

[ Live Scala code at: https://scastie.scala-lang.org/5FW6EaAeQa2ybhM3XYhuyQ ]

> You made factually wrong statements. Perhaps you need to be more realistic about people and yourself in general. In life you will encounter people that disagree. It's not wise to rudely call them not "familiar" with the subject matter. All humans make mistakes and you are setting yourself up for failure when you make rude statements like that and then make a factually incorrect mistake right after.

Some people have indeed infinite egos. If there would be just anything else besides that…

I wonder every time why the most clueless are the loudest. That's so embarrassing.

Re:Effect of Perceptual Load on Performance Within IDE in Pe... by formulathree on Friday July 14, 2023 @07:23PM (#36731304)
>Nonsense.>Python "generates" this: Traceback (most recent call last): File "/home/me/test.py", line 3, in <module> print(x[3]) ~^^^KeyError: 3

So? python generates that but the point was demonstrating type checking. The output you see is not generated by python. It's generated by an external type checker. The type checker caught the python exception without running any code.

>> The contents of a string can't be type checked […] Nonsense. This may be true for Python's type checking tools, but that's not a general limitation of type checking.

The context is python. We're talking about python. I'm making a statement about python. Nobody is talking about scala. I don't know why you're getting into scala stuff.

There is literally nothing in my statement to indicate I'm making a general statement about type checking. But I will say checking for the contents of a string is rare for a type checker to do. That is a general statement that is generally true.

>Some people have indeed infinite egos. If there would be just anything else besides that… >I wonder every time why the most clueless are the loudest. That's so embarrassing.

Hey can you please stop being rude? The guy made factually incorrect statements and so did you. That's not an ego thing. It's just true that he's wrong. Everybody makes mistakes... people shouldn't get worked up about someone else identifying a mistake.

I too made a mistake. And I admitted my mistake. See my first couple of posts. I admitted I was wrong: the python interpreter doesn't do type checks. It was an error on my part for not clarifying I meant python development in general with external tools.

Re:Effect of Perceptual Load on Performance Within IDE in Pe... by still_grokking on Friday July 14, 2023 @10:26PM (#36732566)
> The output you see is not generated by python.

Obviously, as running the code generates a very different output…

> It's generated by an external type checker.

I know.

But again, you didn't say that.

You said the above code "generates" this…

Maybe you've heard that by now somewhere: Words matter… ;-)

> The context is python. We're talking about python. I'm making a statement about python.

No, you made a statement about type checking. Here the full quote once again:

> The contents of a string can't be type checked and if all methods are defined this way on a class none of it can be checked.

Nothing in this statement is about Python.

All I did was just proving your words once again to be nonsense: You can statically dispatch (which involves static type checking!) just fine on strings. My (Scala) code is prove of this fact.

> There is literally nothing in my statement to indicate I'm making a general statement about type checking.

LOL. Do you actually know what you're writing? Once more:

> The contents of a string can't be type checked and if all methods are defined this way on a class none of it can be checked.

That's a general statement… It couldn't be even more general, actually.

> But I will say checking for the contents of a string is rare for a type checker to do. That is a general statement that is generally true.

Once again complete nonsense.

There are whole libraries doing more or less nothing else than handling singleton types.

Whole software layers utilize that! But I guess you never heard of static data validation…

https://github.com/Iltotore/iron

You have so little clue, but such a big mouth… That's so embarrassing.

A helpful tip: Stop spiting out maximally general claims (because these are almost always wrong!), and think about what you're actually writing.

What's in your fantasy, or what you "may have meant" is irrelevant!

> The guy made factually incorrect statements and so did you.

That's exactly what I'm talking about: You're a severe DK victim as it seems…

> It's just true that he's wrong.

No, actually you are wrong with almost every claim, like I've proven now several times. And this nonsense still didn't stop… Oh, boy!

> people shouldn't get worked up about someone else identifying a mistake.

Think about that once again. Especially in the context that it's you who is wrong here with almost everything you say.

And no, nobody is "pedantic". It only gets quite unrealistic that someone who doesn't even get banal prose straight would be able to write any code. Because the computer is actually very pedantic. And after production is on fire you can't just come to your boss and excuse yourself with "but I've meant this differently, just the stupid computer did again not understand what I've meant".

But to be honest this would actually explain:

> I've likely worked for more companies then you in the last 5 years or so due to my personality. I don't stay at one place for long.

I have some suspicions to why you don't stay anywhere for long… And yes, that would be indeed related to personality…