Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

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

Submissions

comment 4y ago · link · parent

As a user (not developer) I liked Silverlight at the time, compared to Flash. Flash applications made my computer run very hot and the fans go loud. With equivalent Silverlight apps on the other hand my computer didn't break a sweat.

comment 4y ago · link · parent

How is being able to be a specific party in the reproduction process a social construct? Is the categorization of penguins into egg-layers and egg-fertilizers also a social construct?

comment 4y ago · link · parent

Wikipedia[1]:

> Female (symbol: ) is the sex of an organism that produces the large non-motile ova (egg cells), the type of gamete (sex cell) that fuses with the male gamete during sexual reproduction.

[1]: <https://en.wikipedia.org/wiki/Female>

comment 4y ago · link · parent

Even if you make the distinction, "female" describes sex, not gender. So the acronym "AFAB" is a bit internally contradictory if you remember that it was created in order to underline the distinction. Then again, these days more often I see people denying the existence of sex, and replacing it with gender altogether, so maybe it's not that surprising after all.

comment 4y ago · link · parent

It depends on the runtime. In the case of Go e.g. the compiler inserts potential "yield"-s at every function call[1].

And in the case of Swift the atomic "release" calls at ends of scopes will run regardless whether there are hot loops or not.

So it all depends on the language.

Also, you pointed to 3 languages with 3 different memory management strategies and 3 different toolchains (Rust is LLVM-based; Nim compiles to C and then calls a C compiler, GCC recommended; D has its own non-GCC non-LLVM compiler). It feels weird to put them in the same bag implementation-wise.

[1]: <https://golangbyexample.com/goroutines-golang/> (potentially stale information)

comment 4y ago · link · parent

> Another case of apple ignoring Google in favor of their own preferences.

Fixed that for you.

comment 4y ago · link · parent

> I'm not talking about Gödel or unprovable statements, because even if something is not provable it might be constructable.

What precisely do you mean by that statement? What is the thing that is not provable but constructible? A conjecture? If so, then what do you mean when you say that a conjecture is constructible? What does it mean to construct it?

As far as I know, "construction" in maths usually means a finite process. And proofs are finite sequences of strings, satisfying certain rules specified by a proof framework (such as sequent calculus). So I'm curious in what way something could be constructible, but not provable. To be honest, I don't understand how those words could apply to the same things, because proving usually applies to conjectures, statements, formulas etc. But constructing usually applies to definitions and proofs, which cannot said to be true or false at all.

comment 4y ago · link · parent

Maybe not only PDF is up to the task, but this site doesn't show that web would be. In section "The quantum circuit model", look how 1/sqrt(2) looks (the 2 falls out of the sqrt sign). Then there is inline maths using the font "Noto Serif", which isn't suitable for writing formulas and makes it look really inconsistent when taken with the formulas which stand in their own lines. ℂ uses "Noto Serif" even in dedicated lines - the straight line with the rounded line couldn't be closer together. This font just isn't up to the task. It makes the formulas both less legible and ugly. Inconsistent spacing in "|0>" looks really off. A lot of inline formulas look as if they were about to fall off their lines. I don't get the use of sans-serif for section titles - default serif fonts in LaTeX make section titles both stand out and look like the belong in their surroundings --- this one doesn't have that effect. Hyphenation algorithm is also suboptimal. Look at the original PDF - at the same time there are fewer occurrences of hyphenation and the space between words in paragraphs is more evenly distributed. Also, the hyphens are easier to spot.

What PDF-s generated by LaTeX have, that so far web failed to replicate, is beautiful fonts for maths, consistency, legibility and overall beauty of the end result. They also have the advantage that they are self-contained, so if I want to archive one or move to another place, I just grab the single file and I'm done. With web a single document is distributed across many files and you need make a weird wget dance (which is easy to misuse)/install some obscure browser extensions/etc - not exactly user-friendly. Also, if you want to print the document to get away from the distraction of the computer, you're guaranteed to get at least as good a result as what you see on the screen.

Don't get me wrong. This attempt is better than any that I've seen so far. Kudos to the author for that. It's no small feat. But it doesn't prove that PDF-s are obsolete and that people favouring them are irrational.

comment 4y ago · link · parent

I've partially responded to that already[1][2]. Let me add to that, that when you group together data, a lot of invariants are preserved by the logic you already wrote for the types you compose your types of. Most basic grouping of objects is a struct. It's a product type. Often what I want really is the product of all the states of the component types, without eliminating any combinations. And in the case of sum types: I practically always want all the states. All the invariants are already handled in the types being summed. Not for transfer/storage, but because it logically makes sense. Another thing is that "make invalid state unrepresentable" is a good guideline, but it can lead you into a corner, where you write a lot of code just to make sure that your type system proves that a certain error is not representable by a type, when this error is trivial, unlikely and would take seconds to debug at runtime (maybe would even be so obvious, as to not need any debugging at all). Just because a certain invariant is true in a domain, doesn't mean that it needs to be encoded in the type system. We need to choose what's the most productive use of our time as developers. Those are trade-offs.

I do not deny the usefulness of ADTs (which is what "private" is all about). I question whether it's the right default. My experience tells me it isn't. Whether you call my style of programming "OOP", is irrelevant to me. This term, after decades of evolution, doesn't mean anything anymore. I certainly don't treat it as a badge of quality and don't consult any definition of it before judging whether a particular technique in programming is useful or not.

[1]: <https://news.ycombinator.com/item?id=30112738>

[2]: <https://news.ycombinator.com/item?id=30113932>

comment 4y ago · link · parent

Because most things in healthy programs aren't APIs, but just plain data: records, sum types and composites thereof (arrays, stacks, queues, whatever).

Fred Brooks:

> Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious.

In that situation, having to sprinkle "public"/"pub" all over them is very noisy and unproductive. It's the worst with Rust's enums, which require you to declare the visibility of variants and enclosed types of variants separately, so you see a couple "pub"-s per line of an enum definition.

That may be an argument for separate keywords for plain data, and for "APIs", although I'm not sure how I feel about it. Underneath it's just coupling of data with functions. Some languages have separate keywords for those, some don't.

comment 4y ago · link · parent

I agree. What I'm saying is that private is a poor default.

comment 4y ago · link · parent

Unfortunately, Rust doesn't. Rust only has "struct"-s, no classes, and they're private by default. Enums require the "pub" keyword once before a variant name, and once inside tuple associated with the variant. So often it's two "pub" keywords per line in an enum definition. So after writing code for a while, I then, upon compilation, need to fix up tens of "pub" occurrences. Pretty annoying. Wasted time, and the end result is hideous.

comment 4y ago · link · parent

IME I write about 10-20 as many data records as "classes". I do use "private" from time to time to protect invariants. But if the default was switched to public, my code on balance would be a lot shorter and readable. I'm not saying that "private" shouldn't exist. I'm saying it's a poor default.

comment 4y ago · link · parent

> If you follow them you will end up with code that's really nice to read and easier to maintain, and, most importantly, that you can confidently change.

I found that a lot of those guidelines lead to the exact opposite. Examples:

- Prefer polymorphism to if/else or switch/case (oh, the joy of tracing a simple task through 50 files)

- Use dependency injection (same as above)

- Hide internal structure (that "private" is the default in C++, Java and Rust just adds to boilerplate; the default case is that you want everything public (unless you like writing trivial getters and setters just for the fun of it); legitimate uses of "private" exist, but are rare)

- One assert per test (I guess I need to throw my property-based tests out the window)

1185.

Ask HN: OS-es with dynamically-linked libs in separate address spaces?

2 points · by yakubin · 4y ago · 3 comments

comment 4y ago · link · parent

I'm normally in favour of hyphenation, but apparently browsers can't do it well. LaTeX is still unrivalled.

comment 4y ago · link · parent

> I can't imagine many subjects for which decades-old results would be more relevant than current ones.

- recipes (doesn't matter whether it's from today or from 30 years ago, what matters is the quality of the recipe)

- art and art theory

- poetry

- chess

- films

Searching by date or date range doesn't work, when you don't know when a relevant article was written. What's needed is not an option to select older articles, but an option to stop prioritizing new ones.

comment 4y ago · link · parent

Type classes are a way to do polymorphism, but... dynamic dispatch? I don't think so; which function is called, is determined statically.

As for ML functors: they're neither polymorphism, nor dynamic dispatch. First: functions for different types can't share names (unless we're talking about shadowing of names with lexical scope), the names are either qualified with the name of the struct they come from or they're not qualified at all. In all cases there is exactly one implementation for every name. And again: no dynamic dispatch. MLton even defunctorizes all code at compile-time. The only polymorphism in SML is the one that's used in some built-ins (like +), but it's not available to users of the language. SML has something called "polymorphic functions", but it has nothing to do with writing multiple implementations of one function under one name and letting the compiler select which one is called; which is what is usually meant by "polymorphism".

comment 4y ago · link · parent

Until you hate noise. Noise makes phones a non-starter (the sensor is too small). Or until you're in non-standard lighting conditions, like a dark night. A year ago I found a mantis on my balcony[1]. I tried to make photos of it with my phone and my compact camera, and all of them were crap due to noise. Several months later I bought myself a DSLR and now I can take pretty good photos in very different lighting conditions. I plan to go further in that direction still and get myself a full-frame camera to get even better photos.

Also, stabilising a full-blown camera in hands is a lot easier than stabilising a smartphone.

[1]: Mantises aren't really a thing in this part of the world.

comment 4y ago · link · parent

It's not just a genetic trait. A lot more important will be how you eat and the amount of exercise you get. Also the amount of sun you're exposed to, and whether you overwork yourself (in the past elderly wealthy people looked a lot better and had longer lives than the working class). A lot of factors which have nothing to do with genes, but are the result of your decisions.

comment 4y ago · link · parent

My most common snack is a green sour apple (granny smith) sliced into 8 semi-equal pieces with the core removed. I put them on a small plate and subconsciously eat while thinking.

comment 4y ago · link · parent

Given that it was just a conjecture, why is it worth noting? Getting back to the main topic, it wasn't only conjectured, but also proven.

comment 4y ago · link · parent

Changing the threshold without signaling the change in the type system is also a breaking change. It's just that your compiler won't warn you about it when you inevitably forget to update your code. Instead your code is going to break at runtime.

comment 4y ago · link · parent

I wish they removed trigraphs. They are removed from C++ since C++17. I hope they do that in a future C standard as well. Currently I switch to std=gnuXX in GCC solely for this reason (and sometimes to get access to some POSIX headers).

comment 4y ago · link · parent

It's a bit different:

Scheme:

  > (mod 5 2)
  1
  > (mod 5 -2)
  1
  > (mod -5 2)
  1
  > (mod -5 -2)
  1
  > (remainder 5 2)
  1
  > (remainder 5 -2)
  1
  > (remainder -5 2)
  -1
  > (remainder -5 -2)
  -1
Haskell:

  Prelude> a = 5 :: Integer
  Prelude> b = 2 :: Integer
  Prelude> mod a b
  1
  Prelude> mod a (-b)
  -1
  Prelude> mod (-a) b
  1
  Prelude> mod (-a) (-b)
  -1
  Prelude> rem a b
  1
  Prelude> rem a (-b)
  1
  Prelude> rem (-a) b
  -1
  Prelude> rem (-a) (-b)
  -1
So in Scheme mod is the Euclidean modulus (always >= 0) and remainder takes the sign of the dividend (comes from truncated division, same as C's %). In Haskell mod takes the sign of the divisor (floored division, same as Python), while rem behaves the same way as Scheme's remainder or C's %.

I prefer Scheme's way, because it was what we always used in classes when I studied maths. mod returning a negative number is just too weird.

EDIT: It appears that Scheme also has modulo, which comes from floored division:

  > (modulo 5 2)
  1
  > (modulo 5 -2)
  -1
  > (modulo -5 2)
  1
  > (modulo -5 -2)
  -1

comment 4y ago · link · parent

I'm going to be moving to a greener part of city in the next months. Previously I selected the current flat based on (walking) distance from the office. But where I am now there isn't a place to pleasantly run surrounded by nature, which sucks. I'd change the city too, but for now all my friends are here, which would make it tough.

Longer term, I'm planning on moving to another country (from Eastern Europe to most likely one of: Scotland, Netherlands or Finland) and, from what I gather, my company will allow me to work from abroad. Even longer term, I'm planning on simply starting my own company, so place is not going to be a constraint.

comment 4y ago · link · parent

> Pure mathematicians don't use computers or even think of them in their work, for the most part.

That's not true. Many pure mathematicians use programs such as Wolfram Mathematica and Macaulay2 in their work. (Source: I studied maths and I know a bunch of them personally.)

comment 4y ago · link · parent

"dismissed", not "denied". There's a subtle difference. The exact quote:

> That which can be asserted without evidence, can be dismissed without evidence.

comment 4y ago · link · parent

Hashes aren't strictly reversible, so "reversing" a hash usually means finding data that hashes to a given value. E.g. in the case of PhotoDNA there are 256^144 possible hash values (the hash is 144 bytes long). So you can't avoid collisions in a set with more than 256^144 elements. So recersing PhotoDNA means finding an element that hashes to a given value, but it doesn't mean that that's the image that was hashed to this value that is the real-world source of this hash.

Now as for completely theoretical possibility you can reverse any hash by brute-force. But that may not be computationally feasible. Now let's think what is easier: reversing a hash with few or many collisions? Let's take an edge case: a hash function hashes everything to just one value (not a very good hash function, but bear with me). That will be the easiest hash function to reverse, since any input is a right answer. Now as you reduce the number of collisions, the task becomes harder: you can divide images into disjoint sets such that each of them is defined by the hash value images in this set hash to, so if you have two images, each from distinct set, they hash to distinct values, and if they are in the same set, they hash to the same value. When you reduce the number of collisions the sets get smaller in size, but their amount grows. So for any given hash value which you want to reverse you need to check a bigger number of candidates to figure out which of the sets is the one for the given hash value (one candidate to check from each set). And that's assuming it would be feasible to just keep a list of those sets and their members, which it isn't, but illustrates the correlation. So actually it's easier to reverse when you have more collisions. It's counter-intuitive, because it's a different kind of reversing than what is usually meant by "reversing a function", which requires a function to be injective.

But: with fewer collisions you have higher likelihood that what you got as the result of reversing is what someone else used as input to the hash function (each of the sets is smaller, so with uniform distribution we get 1/n probability, where n is the number of elements in a given set of elements hashing to the same value).

Anyway, the sets I wrote about here are elements of a quotient set defined by the equivalence relation of hashing to the same value. You can read more on Wikipedia, if my description was a bit confusing: <https://en.wikipedia.org/wiki/Equivalence_class#quotient_set>

comment 4y ago · link · parent

For a long time now for me youtube-dl downloads YouTube videos at 50kb/s, which makes it impractical to use in conjunction with mpv. I need to leave youtube-dl running in the background for several hours to then watch the video in mpv.

Now from the comments I've found out about yt-dlp[1] which claims to fix this issue[2]. Will check it out.

[1]: <https://github.com/yt-dlp/yt-dlp>

[2]: <https://github.com/ytdl-org/youtube-dl/issues/29326>

1
394041
55