a true programmer can write bad C in any language
@foone I love finding ways to abuse LWJGL’s MemoryUtil methods
@foone any true scotsman would know that this is a false positive.
@foone when you see some javascript zhat's like
```js
function f_cls(a, r, d1, d2) {
var x, y;
a.bf = r[d1].x;
x = c_n.res(d2, r);
y = r[d1--] = a.q++;
return x>y ? 3 : -1;
}
```
But can they write bad C in honest-to-gosh good C?
@foone i don't understand
I know programmers who use exceptions and they're all cowards
I think this coder may have been trying to do manual memory management in python
they do, like:
def get_url(url):
response = request.get(url)
document = json.loads(response)
response=None # <-- this line
return document
like, that almost makes sense in C, right? they're freeing the HTTP response. but this is python, we have a reference-counting garbage collector
@foone Actually, I believe in reference counting, but I have learnt, that I write "bogus" Python code, which is optimized for CPython (default) but may fail in other, faster Python implementations...
@foone no status checking either. It's beautiful.
Don't call list.extend and pass a dict, kids
@foone Python handing back the keys when you pass it a dict is its way of being politely wrong. It does exactly what you said, never what you meant.
as someone who has been a python programmer since I was struck by the beauty of language when I first encountered it around 2006, this code is doing something with python, where...
It's like being a concert violinist and watching someone use a Stradivarius to hammer in a nail.
@foone and its local so.. surely just leftover garbage from a previous edit right? surely?
@foone helping the garbage collector, because everyone needs a friend.
IIRC, it was a practice adopted in earlier days of python and javascript when the reference scope was sometimes not handled correctly. Probably not needed today, but it doesn't hurt. Hopefully these kinds of cases are properly handled in unit tests for each build target to ensure conformity.
@foone sooooooo, uh
sometimes it makes sense to do this.
I cannot imagine how that makes sense *here* though
@foone a true C programmer would've written
def get_url(url):
response = None
document = None
response = request.get(url)
document = json.loads(response)
response = None
return document
@foone Doesn't Python have del?
@foone I've had to do similar things in managed runtimes to band-aid other inefficient operations that I did not have time to redo.
@foone
I would never. You can take my result monad from my cold dead hands. And I'm a Java/Kotlin programmer.
@foone I once tried programming in Welsh but ended up with memory leeks