4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions
comment 5y ago · link · parent
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
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
> 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
* 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
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
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
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
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
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
comment 5y ago · link · parent
comment 5y ago · link · parent
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
[1]: Keys and Git history are not encrypted.
comment 5y ago · link · parent
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
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
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
comment 5y ago · link · parent
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
comment 5y ago · link · parent