o11c

joined 2 years ago
[–] [email protected] 2 points 2 years ago (1 children)

I likewise don't really use Godot, but for graphics in general, the 4th coordinate is important, even if it is "usually" 1. It's most obvious to correctly interpolate near the poles of a sphere with a single rectangular texture, but think for a minute what "near" means.

Back to the main point though: the important things we normally rely on for matrix math are associativity (particularly, for exponentiation!) and anticommutativity (beware definitions that are sloppy about "inverse").

[–] [email protected] 0 points 2 years ago

You should have part of your test harness perform a separate import of every module. If your module is idempotent (most good code is) you could do this in a single process by cleaning sys.modules I guess ... but it still won't be part of your pytest process.

Static analyzers can only detect some cases, so can't be fully trusted.

I've also found there are a lot of cases where performant Python code has to be implemented in a distinct way from what the type-checker sees. You can do this with aggressive type: ignore but I often find it cleaner to use separate if blocks.

[–] [email protected] 3 points 2 years ago (1 children)
from __future__ import annotations
[–] [email protected] 3 points 2 years ago (1 children)

The with approach would work if you use the debugger to change the current line I think.

I don't understand why this stop using ASTs in favor of buggy regexes - you're allowed to do whatever you want during the codec ...

Don't forget to handle increment before continue.

The main time I miss C-style for loops is dealing with linked lists and when manipulating the current iteration.

The former should be easy enough - make the advancement provide __getattr__ expressions.

The latter already works since it is in fact being transformed into a while. It's impossible if you try to use for though.

[–] [email protected] 3 points 2 years ago (1 children)

C++11 just standardized boost::thread, which has been a thing since ... at least 2001. Which was the same year POSIX standardized threads. Boost itself dates back to 1998, the same year C++ standardized.

Documentation prior to Boost 1.31 is hard to find.

[–] [email protected] 4 points 2 years ago (1 children)

What you are missing, of course, is the Rc<Refcell<T>> that you have to stick everywhere to make a nontrivial Rust program. It's like monads in Haskell, parentheses in lisp, verbosity in Java, or warnings in C - they're the magic words you have to incant correctly to make things work in their weird paradigms.

[–] [email protected] 1 points 2 years ago

2015 called, they said the same thing.

But e.g. the fact that they're talking about forcing fields to be final means Valhalla's value types are self-sabotaging anyway.

[–] [email protected] 1 points 2 years ago (1 children)

I'm increasingly convinced that Python/JS-style duck typing is always a mistake, since you can't do default function impls for traits. Just use inheritance.

Rust's enums are even weirder, since they mix structuring with discrimination. You end up having to write everything twice most of the time. Again, use inheritance, though you'll have to choose between if chains and virtual function calls.

Python's pathlib has a major footgun in that ./foo collapses to foo, negating the main point of writing it that way in the first place.

[–] [email protected] 1 points 2 years ago

The comments in the code explain exactly what the problem is and how to fix it, and it would take less than 30 minutes to implement and test that (assuming you don't just grab someone else's version - there's a reason I know the time), but nobody has committed it in ... at least 13 years since the comment was written; I'm not digging any further through imported SVN history.

[–] [email protected] 6 points 2 years ago

Javascript isn't one of my main language, but using class avoids a few of the footguns Javascript has. You can't forget new, and extends/instanceof are far saner than duck typing.

[–] [email protected] 5 points 2 years ago* (last edited 2 years ago) (2 children)

It's worth noting that the http.server module is based on socketserver.BaseServer.serve_forever, which is a atrocious.

It uses a busy loop with a delay, so it both burns CPU and is unresponsive.

(The fact that Python has had broken signal handling since 3.5 also hurts - EINTR should never be ignored from blocking calls)

[–] [email protected] 1 points 2 years ago (3 children)

Java lacks value types, so it can only be fast if you avoid classes and (pretty much) only use primitives. Some other JVM languages implement them hackily, but C# / .NET does this properly.

Valhalla has been calling for a decade, but the warriors must not be worthy, and looking at their demo stuff I don't think they understand what they're doing with the restrictions they're specifying.

view more: ‹ prev next ›