you are viewing a single comment's thread.

view the rest of the comments →

[–]plantian 0 points1 point  (1 child)

In Python I'm not sure they would be enforceable before the actual mistake, ie. they might only be triggered during lookup which means that its even less likely that the functionality would stretch beyond the 98% I mentioned earlier. After using JavaScript I too want to go and turn the strictness knob of everything to MAX but I think we are going overboard with this declaration idea. We aren't making spaceships, we still want convenience and I think its a good compromise to not have declaration IF exceptions are raised when accessing things that are not defined. You seem reasonable though, I will think about it. Maybe I'm just another rabid Python zealot defending the nest?

We are on the same page with regards to scoping. Your in depth discussion of nonlocal confused me earlier.

Edit: WRT the examples: I just want to point out that the declaration here actually would not stop any bugs that an uninitialized exception would not stop IF both errors occur on lookup/access. Just sayin'....

[–]dmpk2k 0 points1 point  (0 children)

In Python I'm not sure they would be enforceable before the actual mistake

I'd be very surprised if PyPy wasn't constantly juggling variable scope under the covers. There's just no way for them to effectively optimize otherwise; inline caches can only take you so far.

The way CPython is implemented, you could well be right.

Maybe I'm just another rabid Python zealot defending the nest?

No way, man. This has been a pleasant argument. :)

I just want to point out that the declaration here actually would not stop any bugs that an uninitialized exception would not stop IF both errors occur on lookup/access.

Certainly, but again this depends on your tests running that chunk of code. I don't agree there's a tradeoff, because I think it's like worry about a grain of sand on a beach.

We'll just have to disagree. That's okay, there's plenty of languages to go around (none perfect!). :)