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

In C++, preprocessor and template magic in dependencies tends to break such IDE convenience features as "go to definition" or "find all references".

comment 5y ago · link · parent

Gandi and OVH.

comment 5y ago · link · parent

I don't know what you mean. Linux containers don't contain operating systems. They contain processes. POSIX describes operating systems.

Every Linux process can read environment variables. They are contained in its address space. "cd" is a shell built-in. When there is no shell, there is no "cd". Not providing access to a shell sounds like great security practice tbh. Your applications shouldn't be using it anyway (they should create new processes directly).

comment 5y ago · link · parent

POSIX doesn't say anything about containers.

comment 5y ago · link · parent

In "linux embedded", absolutely. You take what's there. At some point I even had a debugging session through TeamViewer connected to a Windows machine which had Terraterm open connected to serial port of a linux box. Unfortunately, there was a lot of spam on the serial port, so even using vi was impossible, because the screen got garbled pretty fast. So I printed the files with cat, worked out a set of sed commands to get those files to the desired state and typed them back in. Crazy. But real.

(Add to that communicating with a guy on-site over notepad.exe. Mr. Robot vibes.)

comment 5y ago · link · parent

To be precise:

1. Just because there is Linux, doesn't mean everyone should jump on the Linux bandwagon and abandon all work on illumos, NT, QNX, Fuchsia etc. Focusing everyone on Linux would kill progress.

2. Just because there is x86 or RISC-V, doesn't mean noone should invent new architectures. Apple went with their own and that's what gives them their edge now.

3. Just because there is already Emacs, doesn't mean that all editors should be Emacs mods.

4. And back to compilers, just because LLVM already has optimizers, doesn't mean that other people shouldn't explore other designs for their backends. Especially that LLVM is really slow, and a major bottleneck for new compilers now (see Rust, Zig and Jai e.g.).

comment 5y ago · link · parent

> Thunderbird now operates in multi-process (e10s) mode by default

What does e10s mean here?

UPDATE: I've found an explanation[1]:

> In Mozilla documentation "Electrolysis" is often shorted as "e10s".

What a silly scheme.

[1]: <https://wiki.mozilla.org/Electrolysis>

comment 5y ago · link · parent

Because reinventing the wheel is how progress is made. You car isn't made with wheels from 17th century.

comment 5y ago · link · parent

What's interesting to me is how the memory used for buffering data is accounted for in system statistics. If we want to attribute this memory to a process, then attributing it to the writer seems to be the natural option, since they are the ones responsible for using this memory. However, killing the writer after they wrote to the pipe won't free up this memory, because it's buffered. So I guess it could be counted in the Working Set Size of all the processes that have the read end of the pipe[1]? In practice, I think it's counted as "system memory". I'd prefer the Working Set Size approach, since it gives you an indication that to free up this memory you need to kill those processes.

[1]: So for each reader process we would add S/N to its WSS, where S is the size of the buffered data for the pipe, and N is the number of processes holding the read end of the pipe.

comment 5y ago · link · parent

I don't spend much time with Haskell, only sometimes I'll read a blog post using it. But still, to me it's one of the most readable languages out there. Day-to-day I work with C++ and Rust and I'm really annoyed with the amount of irrelevant punctuation they force on the programmer. I look at the code, and instead of seeing what it expresses, first I need to peel off the noise, curly braces, colons in weird places, commas, just noise. Scheme and, to a greater extent, SML are really good here.

Similarly, even before dwohnitmok, I can read your Haskell example much faster than the curly example.

comment 5y ago · link · parent

I generally like using Qt apps, be it Linux, Windows or macOS. Development with Qt is also quite nice, with very well documented APIs. The only issue is that sometimes there is something really weird going on with fonts (on Linux at least). E.g. in Quassel sometimes text looks as if it went through a cheese grater. And even though I have all the necessary fonts, I don't see some Unicode characters properly (emojis mostly). In Gtk apps they are displayed perfectly. I've been told it has something to do with Qt limiting the number of fonts that it goes through, although I'm not really sure.

As for Electron, this is such a poor runtime. Chromium's C++ (not V8) garbage collector is so unsophisticated that it sometimes blocks for several seconds on lower-end devices. At $dayjob, I got reports about UI unresponsiveness[1] and after looking at the logs, sure enough, 2.5 pause times several times, and mostly revolving around 15ms, 50ms, 70ms, 110ms etc. - wtf. That's just bad press for garbage collectors. Add to that, that each release consumes more memory than the one before. After that you look at all the different garbage collectors for JVM and wonder who even makes the decision to go for Chromium and not JVM, not to mention the quality of languages that target those two platforms.

[1]: Not our app, but for us to debug. :|

comment 5y ago · link · parent

What do you mean?

comment 5y ago · link · parent

https://www.google.com/search?hl=en&q=recursion

comment 5y ago · link · parent

bpftrace has lower overhead, because, thanks to BPF, it can accumulate all the data needed in kernel and only send a summary to userspace to be displayed. strace on the other hand uses the ptrace(2) syscall to set a breakpoint on each syscall, including the ones that you do not trace (when you filter calls e.g.) and on each syscall data travels between kernel and strace.

It's possible that in the future strace will use BPF as well to lower its overhead.

bpftrace is also more versatile. You could use it to e.g. collect stack traces for all the syscalls a program makes. You can also attach actions to more things than just syscalls. You can e.g. use kprobes to inject code into kernel functions which aren't exported as syscalls.

comment 5y ago · link · parent

It would be impostor syndrome, if we were excellent, but fearing that we are frauds. But if we are in fact frauds, then "impostor syndrome" is the natural self-diagnosis self-defence protecting us from admitting to ourselves the bitter truth. Maybe it's a better idea to react to the feeling of being an impostor with the will to change something in one's life? I know I feel much happier knowing that I have a plan which I systematically put into life, that lets me do fulfilling stuff, instead of the usual theatre.

comment 5y ago · link · parent

1. It wouldn't segfault, because it's the kernel reading the data. It can read from anywhere.

2. Kernel already checks, whether the buffer is in a mapped memory region that your process has access to. If it isn't, the error is signaled with errno=EFAULT.

comment 5y ago · link · parent

Lisp Macros as a Service.

comment 5y ago · link · parent

Those two are connected. Without strict typing the compiler doesn't know really whether the error is in the definition of min() or in its use, so the compiler mangles the two together and lets the programmer figure it out.

> In case of C++ templates, is it possible to output one error like: eg "class UserData needs to implement operator< to be used in min() function" instead of 200 lines errors?

This is already handled by concepts, but concepts solve only half the problem. E.g. in my snippet, in the comment you replied to, if any of the structs didn't have the kId constant, the errors would be about that. Concepts correctly detect when someone passes to them things that don't implement required functionality (as long as this functionality is specified in the concept). The other half of the problem, which they do not solve, is checking the correctness of the definition of the template against the concept. E.g. in my snippet I could use the "value" field, even though the concept that I used didn't declare it anywhere. At that point, if I passed a struct, which doesn't have that field, the compiler wouldn't be able to tell where the error is: in the template, or in its use --- so it would emit one error for each template instantiation, just as it did for "kIs" (because it can't know that it's just one typo in one place).

comment 5y ago · link · parent

Zig looks overall interesting to me, but I don't like that it reproduces one of the pains of C++ templates, i.e. their dynamic typing. What I mean is, C++ templates aren't checked before being executed, and instead you get compilation errors (at c++ templates runtime) which mangle the use and definition of templates, e.g.

  template<typename T>
  concept HasId =
  requires (T a) {
      T::kId; // "the expression T::kId is a valid expression that will compile"
  };

  // A and B are expected to be structs, where each has an associated integer constant kId and a field "int value".
  template <HasId A, HasId B>
  int min_id(const A a, const B b) {
    if (A::kId < B::kIs) {
        return a.value;
    } else {
        return b.value;
    }
  }

  struct A0 {
    static constexpr int kId = 1;
    int value;
  };

  struct A1 {
    static constexpr int kId = 2;
    int value;
  };

  // etc.

  struct A180 {
    static constexpr int kId = 2;
    int value;
  };

  int main() {
      (void)min_id(A0(), A1());
      (void)min_id(A1(), A2());
      // etc. ending with:
      (void)min_id(A179(), A180());
  }

And now you get 180 errors about your typo (if not for max error number limits in the compiler), when really there is only one error in the definition of min_id. I used concepts to show that in the long tradition of C++, they're an additional feature that doesn't really help (quantity over quality of features).

Haskell solves that with typeclasses, Rust solves that with traits. What's really important about these solutions is that when you write a function generic over a trait or a typeclass, you are limited to using what is defined in the trait/typeclass. The trait/typeclass function both as documentation and as something that gets you better compilation errors.

"typename" in C++ is basically "any", but for values of template execution. Typeclasses/traits on the other hand are a sort of types for those values (which we normally call "types"). And similarly, in Zig there is an "any" type for types, just like in C++ --- it's called "type", and AFAIK there is no way to constrain your types with types of types.

comment 5y ago · link · parent

What is it a typo of?

comment 5y ago · link · parent

dang, I think HN automatic bot detection for new accounts kicked in for amseun (the dead comment). :/

comment 5y ago · link · parent

There is a difference between advocating for free software and saying that all non-free software is evil. To compare to the original meaning of "bigotry", there is a difference between talking about how great your religion is and talking about how all other religions are evil.

comment 5y ago · link · parent

According to the FSF[1]:

> To release a nonfree program is always ethically tainted, but legally there is no obstacle to your doing this.

It paints a picture of a bigoted organisation.

[1]: <https://www.gnu.org/licenses/gpl-faq.html#ReleaseUnderGPLAnd...>

comment 5y ago · link · parent

https://news.ycombinator.com/item?id=28025573

comment 5y ago · link · parent

When I say "non-official", I say that it has some commits that aren't on the main branch. You need to push them somewhere, or else they're going to be lost.

comment 5y ago · link · parent

If someone pushed a branch to remote, then there is a chance that they made a CI build for a customer based on that branch. Later you may need that branch to look at the source code, when you get a coredump, or logs or something.

(Every non-official build is made from a separate branch.)

comment 5y ago · link · parent

Apple and GNOME are even better examples of why designers should not try to be designers. Now what options do we have left?

comment 5y ago · link · parent

Not typing it with "checkout" gets in the way of good tab completion. At work we have at least tens of thousands of branches and if I hit tab after "git checkout file_path_prefix", my shell is going to freeze for a while, while tab completion is going over remote branches.

comment 5y ago · link · parent

> 2) The license for Element is Apache 2.0. A fine choice for any OSS project looking to maintain a healthy ecosystem of contributors for decades to come.

The problem with Apache 2.0 is that it's incompatible with GPLv2. That's the main problem with copyleft licenses, they are made as if they were the only FOSS licenses in the world and just introduce incompatibilites between different camps. Apache 2.0 vs GPLv2, GPL vs CDDL, GPLv2 vs GPLv3[1]. I prefer to go with permissive licenses and save myself the headache. Regarding Apache, a common solution is dual-licensing under Apache+MIT (e.g. the default for Rust projects created with Cargo), which takes care of this problem.

[1]: And "vN or later" is not a solution, since that's just a backdoor of a random org in US.

1
444546
55