Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions

Submissions

comment 5y ago · link · parent

A lot of commercial sites do it because of lost ad revenue. Some of them, like Ars Technica, give you full-text RSS feeds, if you subscribe to them. I think that's fair.

There are some non-commercial blogs with no ads, nothing but text on them, but still giving you only the title in the RSS feeds. I suspect it's the default configuration of whatever software they're using for the blogs, and they may not even be aware that RSS is a thing. Maybe I should start writing mails to them to inquire why that is and maybe change their minds on that, since I really can't see a reason for it.

FWIW Most of the feeds I subscribe to are full-text.

comment 5y ago · link · parent

It sounds a bit like a generational garbage collector.

comment 5y ago · link · parent

> Not it wouldn't?

I'll defer to your knowledge on that. I generally don't work with Python. I've only looked into interfacing C# with Rust and it looked crazy, so that's where I'm coming from.

But yes, it's pretty clear that the results are more a consequence of what's in the source files than the languages used (if we can even say that e.g. C++ was used at all).

comment 5y ago · link · parent

You left out the explanation from your quote. The full is:

> Rust is not that fast beacuse it needs to copy data; using Pyo3 objects would probably lead to similar results as cython, but with an added library.

"It needs to copy data", because it's converting Python objects into Rust objects and back again. As the full quote states, it could be written in a different way, although that would make the code look really weird.

In this benchmark there is also no normal C++ involved. There is only Cython using some C++ ints, but operating on Python lists. And that's not handled by writing C++ code that operates on Python structures, but writing Python code in Cython in a "C++ mode".

Apples to oranges.

comment 5y ago · link · parent

Yes. You use std::function when you don't want every function/structure, that accepts a function as an argument, to be infected with templates, and instead be a plain function/structure. Thanks to that:

* there will be only one instance of it;

* you'll be able to export such a function in public interface of a dynamic library without exposing its source code in a header file;

* compilation will be faster, because the compiler won't have to instantiate N different versions of a template;

* you'll see fewer scary template errors.

Your life as a human being will be happier.

Of course there are better alternatives to std::function in the wild, but the general idea remains.

std::invokable will just make working with templates nicer. But not working with templates is nicer still.

EDIT: You can think of std::function as the LSP inside C++. There is a famous matrix where rows are for editors, and columns are for languages. In case of std::function rows are functions accepting functions as arguments, and columns are functions passed as function arguments. The matrix represents template instantiations, when you use templates. By using std::function you avoid the matrix and instead have just two vectors of length N and M, if the matrix was NxM (N functions accepting functions as arguments, M functions passed as arguments).

comment 5y ago · link · parent

Computer Systems: A Programmer's Perspective by Randal E. Bryant and David R. O'Hallaron

A bit of a look into how your computer works as a whole, from the CPU, through assembly, how C is translated into this assembly, a bit about caches, Amdahl's law, virtual memory, processes, threads, I/O and a dozen other things.

<https://www.pearson.com/store/p/computer-systems-a-programme...>

comment 5y ago · link · parent

> That the authors are more concerned with this or that isn't the point.

It is the point of the article. Author of the article didn't object to rejecting Stallman, and neither did I. They objected to doing it on the grounds of his beliefs and gave a wider perspective of the problem. If it was the first time something like that happened, I could say that it sets a dangerous precedent. Alas, we're long past precedent, we're just going deeper.

To be clear, there were other letters calling for Stallman's removal, such as the one from Debian, which don't have that flaw.

This article isn't about Stallman. It is about bigotry.

comment 5y ago · link · parent

Then make him answer for the harassment, not for his views.

When you make a case against a burglar, you don't base it on his views on capitalism and communism. You'd be laughed out of court. You base it on his act of burglary, with evidence/witnesses.

As far as the letter is concerned, it seems that its authors aren't really concerned with harassment. It's those other issues that stir real passion in them.

comment 5y ago · link · parent

> Okay, but what about error messages? A good error message tries to convey the nature of the error in a complete sentence or sentence fragment.

That's a fair point. I think I saw some compilers with translated error messages, which would solve that problem. But it was a long time ago, so I'm not sure. However, that is an issue external to the programming language per se.

> Comments are often written in English. Documentation is often only available in English.

When you get a programming book translated to Polish, comments are going to be written in Polish. Manpages have translations into many languages. As for library documentation, it's long past the point of an introductory programming course.

> Tooling suffers the same issue. Non English speakers are forced to learn English if they want mastery of the programming language, and this goes beyond mere symbol mappings.

True. However, I think it pays off big time. I think a world where people are forced to learn a language that everybody speaks is a much better world than one where different regions of the world have siloed repositories of knowledge, and collaboration can only happen on short distances. I think too often people complain that they need to learn A, in order to do B, even when A dramatically broadens their horizons and lifts the ceiling on what they can achieve. It's similar to the common antipathy towards being required to learn maths, if you want to do game engine programming, physics, etc. Without grasping a good chunk of maths, you're not going to be a good game engine developer or physicist. Same with English. Without it you're not going to be able to efficiently collaborate with others. Documentation is just one instance. There is also the usual asking questions on forums, reading blog posts, research papers. Those things may sound like restrictions to some, when in fact they're the opposite.

comment 5y ago · link · parent

1. It is in an annex.

2. This is the only sentence in the annex about it. The rest of it focuses again on beliefs.

Also, I didn't write it wasn't mentioned at all. However, that amounts to a marginal note, suggesting it's just a supplementary supporting point, but not the main issue. The main, damning, issue, according to this letter, are Stallman's beliefs.

comment 5y ago · link · parent

It is a response to (among other things) "An open letter to remove Richard M. Stallman from all leadership positions"[1]. This letter emphasised Stallman's beliefs over his behaviour. So if Stallman's behaviour was "the point", then the authors of the letter failed to make it. They could have focused on his behaviour instead and have an honest discussion. They didn't.

[1]: <https://rms-open-letter.github.io/>

comment 5y ago · link · parent

I started learning programming before I could speak English well. A programming language using English words isn't a barrier in any way. Those words aren't real English words, they are symbols. Instead of "and" you could very well have "/\" and it wouldn't make the slightest difference. As a non-English programmer you don't think of those as words, just symbols. And that's accidentally closer to the truth and probably even moulds your mind into a shape better suited for such an abstract task. Using "if" and "else" neither requires, nor is made easier by knowledge of what those words mean. (At the time when I learnt it, I knew what "if" meant, but not what "else" did. It didn't bother me in the slightest.)

comment 5y ago · link · parent

Try a cheap old Nokia. Not everyone has a smartphone.

comment 5y ago · link · parent

This video looks like special effects in a Bollywood action film. :)

comment 5y ago · link · parent

Because you still need to manage your GPG keys with an obscure CLI. When I last switched computers, I tried just copying my "~/.gpg" directory. Didn't work. GPG was confused, produced even more confusing messages, which didn't really help me understand what the problem was. I needed to google for the right incantation of commands to export my keys from one computer and import them on another. Compare that to what you have with KeePassXC: switching computers? Just copy this single file and everything will just work.

And I don't want to know if I'm holding GPG right. I just want the tool to work for my specific case. But GPG wasn't designed specifically with this case in mind, so, as usual, it will be terrible. It tries to be too many things.

comment 5y ago · link · parent

It is a file-based key-value store, where only the values are encrypted[1], with GPG to make it worse. For these reasons, I moved to KeePassXC. It is cross-platform, has a nice Qt GUI and you don't have to resort to hacks to have several values associated with a single key (i.e. not just password, but also username and others).

[1]: Keys and Git history are not encrypted.

comment 5y ago · link · parent

Another site with moderated comments is Ars Technica. It works out great for them.

On the other side there is unmoderated Phoronix, which has the worst comment section that I've ever seen.

comment 5y ago · link · parent

> I will give it two decades max, for everything to get back to the old way of selling software.

It would be nice to get back to Turbo Pascal-like and old Adobe business models, instead of the divide between subscriptions and free (as in beer) open source funded by a bigcorp making money from something else. So I'll take that.

comment 5y ago · link · parent

> Also requiring the provide the type every time you retrieve an element from a JSON string again seems odd. JSON already has the data type, why do I need to provide the type every time I retrieve the data?

Because JSON is a serialization format, so as such it is external to your code. One day an element in the JSON you receive is a boolean, but another day it's a string, because another system had a bug and started producing junk data. Now in your code it's good to 1. document what type you expect, 2. trigger an error if the types don't match. It also has the benefit that all types can be checked statically, without providing any surrogate input. A schema integrated somehow with the language could be a more optimal solution though. But no schema, and no type annotations in the code is a no-no from me.

UPDATE: Now that I'm thinking about it, I'm wondering why JSON was used in the Zig example at all, instead of using builtin data types. Seems like a really odd choice.

comment 5y ago · link · parent

The Scheme example is shorter than any of the Python ones.

comment 5y ago · link · parent

> What else do you do with a pointer, other than eventually dereference it?

I could check whether two objects were stored at the same location (like comparing id-s in Python). Or I could write a crappy random number generator based on the pointers that I get from heap allocations. Or I could inspect the memory layout of a struct based on member offsets (pointer::offset_from method - perfectly safe).

Pointers whose pointees are tracked by the compiler are called "references". If you fetch a pointer instead, then you opt-out of this tracking.

> One situation where you might conceivably want to do something with that dangling pointer is if you were writing an allocator. But in this particular example, we’re not writing an allocator; and if we were, we wouldn’t call .as_ptr() on one of the allocated objects — that would be working at the wrong level of abstraction.

I can see someone writing an allocator based on std::vec::Vec, and then ".as_ptr()" is useful.

> If you really do just need to store the value and not dereference it, shouldn’t it be stored as some integer type? Then to dereference it, you’d first need to cast it to a pointer, and that operation could be marked unsafe.

You can't dereference a pointer in Rust per se. You need to convert it to a reference and then use the reference. This conversion is marked unsafe in Rust. There are also some "read" methods defined on pointers - also marked unsafe. But in the example in the article the pointer was dereferenced by C code, so Rust can't do anything about it.

Now imagine how an ".as_ptr()" which prevents taking pointers to temporary objects would need to be implemented. Well, you'd need to be able to write a method in Rust, which couldn't be called on temporaries. So the type-system would need to be able to express something like

  fn as_ptr(&'non-temporary self) -> *Self
But then you'd be able to write this just fine:

  let ptr;
  {
      let path = CString::new(filename.as_str()).unwrap();
      ptr = path.as_ptr();
  }
Because path is not a temporary in the above code. The issue is ptr outlives the lifetime of path. So if the type-system had a special facility for avoiding pointers to temporaries, it would be trivially circumventable by creating a variable. Doesn't sound very human-friendly and doesn't sound like a big gain. This complexity doesn't pay for itself. We really need lifetimes (which we already have for references) for that.

The solutions here are:

1. Borrow checker for objects with predictable lifetimes.

2. Smart pointers for objects with hard-to-predict lifetimes.

3. For calling C code, being careful, because it's C code and we can't fix C. Also, a linter with checks for common errors like those.

comment 5y ago · link · parent

I don't see anything unsafe here. Merely storing a pointer, whatever it may be, doesn't violate memory-safety. Dereferencing a pointer in some cases does. The article contains one of those cases: use-after-free. If the pointer wasn't dereferenced, all code would be fine, including the line with ".as_ptr()".

comment 5y ago · link · parent

This website breaks scrolling (it's jumpy). For others experiencing it: this issue (and the floating top bar) can be fixed by disabling JavaScript.

comment 5y ago · link · parent

"Selective highlighting"? "Making a list and going from the top"? Looks like my comment went completely over somebody's head.

If you read the complete thread, you'll see that it's not random. And I disagree that bringing up something negative after someone dies is bad taste.

Yeah, I don't think we'd get along.

comment 5y ago · link · parent

Annotate video with frame numbers:

  ffmpeg -i input.mp4 -vf "drawtext=fontfile=font.ttf: text=%{n}: x=48: y=48: fontcolor=white: box=1: boxcolor=0x00000099: fontsize=72" -y output.mp4
Remove audio track from video:

  ffmpeg -i input.mp4 -c copy -an output.mp4

comment 5y ago · link · parent

I find such whataboutism reprehensible. It's common in my home country, where a lot of people in response to pointing out our history of repressions against Jews start pointing fingers at other countries with a vague "they were worse", or worse "we were provoked"; instead of admitting to the past and learning something from it. Pointing out someone's shortcomings shouldn't trigger a review of the shortcomings of others.

comment 5y ago · link · parent

The suggestion at the end is a more drastic version of what is done at <https://flak.tedunangst.com/>. I prefer the latter for the added artistic aspect. :)
1
495051
55