Hacker Newsnew | past | comments | ask | show | jobs | submit | snackbroken's commentslogin

>If the IP address of the load balancer changes, Route 53 starts responding to DNS queries with the new IP address.

Doesn't this still leave you briefly vulnerable until the old DNS record's TTL expires?


Straightforward yes, syntactically nice no. Ideally you should at least be able to write

  fn view() -> impl Widget {
or

  fn view() -> impl BasicWidget {
but even that feels a little bit clunky. You could imagine this working by a) having traits let you choose one of a few different ways to implement them and automatically deriving the rest and b) either not forcing you to specify the <T> of a generic type when the T can be inferred, or making BasicWidget an alias for Widget<()>, or automatically deriving Widget<()> for types that implement BasicWidget.

nobody uses Widget<()> in real life, it's a contrived example

it's just Widget<Message> and Message is defined by the user of the library so can't be handwaved away in advance


Every browser will forever be KHTML, like Gecko.

And Mozilla 5.0, still waiting for it!

> no one is forcing you to use the quest markers

To further expand on this, the games that have quest markers are invariably terrible at giving directions without them.

Even within the same game series from the same studio the differences are stark. Compare Morrowind with Skyrim; In Skyrim, the quest markers tell you where to go and the NPCs give little to no information beyond "I went to a nearby cave" or whatever. The "nearby" cave in question could be anywhere between 50 meters away and halfway across the game world. In Morrowind, the quest journal is of marginal utility but NPCs typically give directions like "Take the road from here towards <town>, head east off the road when you see the dead tree and you will find the tomb. You will know you've found the right place if you see <distinguishing feature of the entrance>" or at worst hint at a region to search. How detailed their directions are usually makes sense from an in-world perspective.

P.S. If you like the FromSoft games, check out the recently released Queen's Domain. It has excellent level design and does very little hand-holding (some items glow to make them easier to spot, but that's about it). It's the first game I've played in a while where I felt it would be helpful to take notes. Secrets abound and paying attention to your surroundings is regularly rewarded. I should mention that combat in the first hour or two before you've unlocked a good amount of attack/movement options can feel a little tedious but is not representative of the rest of the game. ~30 hours to fight the titular queen, another ~30 hours to complete all of the post-game content. ~Halve those estimates if you are a veteran of the genre.


Yeah exactly! Once a feature exists, the game is designed around it.

I actually used to love Morrowind back in the day, it's definitely my favourite from 3/4/5 of TES, (I haven't played 1&2).

I dream of a Morrowind-like world with Souls-like combat.


That's a lot of post-hoc rationalization for justifying ruthlessly defending their competitive edge.

Spammers operate out of countries where they have no fear of legal consequences, so all Signal has to do to deter them from the crypto option is make it more expensive than bulk phone numbers are.

Every tool we bring to bear in programming, from control flow structures to type checking comes down to grappling with the fact that global mutable state is hard to reason about.

Viewing the CPU as a pure function from "state of the universe before a given clock cycle" to "state of the universe after said clock cycle" is not particularly helpful on its own, because you still need to care about all the state in the universe. What this change in perspective does however, is that it becomes a relatively small change to say "actually this part of the program doesn't care about the whole universe, and doesn't affect the whole resulting universe, only that tiny bit over there matters and only this tiny bit over here changes."

The win is that the compiler can help keep you honest about handling every possible state you depend on as input and that when you call a function, it doesn't unexpectedly change some state your function depends on behind your back. All the state you ever have to care about when writing (edit: or reasoning about) a pure function is "what are my arguments, and what are the return values of functions I call?"


Funnily enough, Youtube recently changed how they count views to be more in line with its competitors, so now they do count views as soon as the video starts playing.


Respectfully, talk is cheap. Every company says they take security and privacy seriously even after their database has been breached and their customers' plaintext passwords and credit card details have become public information.

If you were actually serious about prioritizing privacy above securing an ongoing service relationship you would ship local inference as the default and only (possibly later) offer a cloud service as an optional add-on for those who want/need it.


Map and Filter are nice because they let you reason locally about a single element in isolation. Reduce(Fold) forces you to reason globally about intermediate results. Reduce also forces you to conjure up a "zero" value of the relevant type, which isn't usually difficult but it does constitute some extra mental overhead.


> Reduce also forces you to conjure up a "zero" value of the relevant type, which isn't usually difficult but it does constitute some extra mental overhead.

It's always worthwhile to consider what the result will be when you pass in an empty list.


Right. It's just one more thing you have to think about with Reduce that's not something you have to consider with Map/Filter.


If you have need of a reducing operation though, you will still need to think about that value. If you are summing up a list of numbers, it doesn't matter whether you use reduce or a loop, you need to set some initial value.


I agree, although most of the time you do end up needing to consider it with Map/Filter. It's just, it doesn't force you to. Which means either you think about it later, or it bites you in the ass because you didn't consider the empty case. Not always—and for those cases where you don't end up needing the empty case, Reduce is probably not necessary, and Map/Filter is sufficient.


> Reduce also forces you to conjure up a "zero" value of the relevant type

It's more accurately an identity. If you are multiplying the identity is 1. While I think most people are comfortable saying the sum of no elements is 0 it's perhaps less intuitive that the product of no elements is 1. This makes me think reduce might be preferred by those with a mathematical background.


Isn't reduce usually used for monoidal operations? Or do people implicitly absue ordering?

If the algortihm doesn't work the same forward, backwards, and with a tree scan, it ain't reduce (as a first approximation not IFF)


That's what I'm used to as well, but in my experience a lot of programmers take fold and reduce to be synonyms. A monoidal reduce is much less "scary" than a general fold. I suspect most programmers have never[1] heard the word monoid, let alone know what it means, and having to remember the meaning of a weird new word is enough to make most people dislike something compared to the simpler more familiar operations.

[1]Or if they have, their only encounter with it is the "a monad is just a monoid in the category of endofunctors" meme.


I do know what a monoid is, but a monad in the category of endofunctors is the scary word for me :sob:


It just means if you have some functor F (generic type with a well-behaved `map` function, like List), then you have a `flatten` operation F[F[_]] - > F[_], and like a monoidal product, it's associative. So if you have a triply nested List, you can flatten inside first or outside first. Also, like a monoid, it has an "identity" function wrap: A->F[A] (e.g. x -> [x]). Identity in the sense that "multiplying" (flattening) with wrap does nothing. i.e. wrap(flatten(x)) = flatten(wrap(x)) = x when those things make sense.

So basically wrapping and flattening behave in a sane way. Flatten is your multiply, wrap is your multiplicative identity, and it's like a monoid if you squint.


You have become the meme.


"The meme" literally comes from a book that was offering it as an intuitive explanation of a long definition, assuming you know what a monoid is. All the laws and stuff boil down to "if you generalize the idea of a monoid a little bit, and if you have some functor+flatten+wrap forming a monoid, we call that a monad." If you don't know what that stuff means then obviously it's not for you, but if you do, then it's actually a concise way to give an intuition for "what (or why) it is," which is basically just that flatten is associative and wrap is neutral.

Like if someone says they know about rings and modules, you might say that an ideal is just an R-submodule of R, which grants an interesting perspective and gives a quick, memorable definition. But if they don't know about modules, you might not give them that definition.


The point is that the terminology surrounding this is impenetrable and non intuitive. Rather than acknowledge that, we get a lesson on category theory, which is missing the point.


The person I replied to said they know what monoid means, so they're familiar with algebra. The explanation is intuitive for someone familiar with undergraduate algebra (adapted to also assume some familiarity with programming and show how it connects). That's literally where the meme comes from, an intuitive remark from an introductory text on category theory. If you think it's impenetrable, it's not for you. You don't have the correct background, so ignore it.


It may have come from an old textbook, but its origin as a meme is a 2009 joke blog post that gets its humor from making fun of how obtuse and pedagogically inept that explanation is. When people reference it today, this is what they are referencing: https://james-iry.blogspot.com/2009/05/brief-incomplete-and-...


I'm aware of the meme, but it's not obtuse or pedagogically inept.

Like if someone says they're familiar with groups and Fourier transforms, but not what it means to say wavelets are the Fourier basis for the affine group, and I break that down, and you don't know what any of those words mean, that's not me giving an obtuse explanation of wavelets; that's you wandering into the wrong conversation.


Do you want to understand monads, or do you want to understand the original quote that the joke you referenced was based on?

For the record, the original quote by Saunders Mac Lane is "a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor."

That quote is a statement in category theory. The author probably never heard of, say, Haskell - he was a pure mathematician. You can't usefully express that quote in Haskell code. You can treat it as a kind of formal description of what monads are, and Haskell generally conforms to that. But in that context, the quote itself is essentially using category theory as a metalanguage, in the same sort of way as one might write a mathematical statement that captures the semantics of some programming language expression.

That said, the quote can be handwavingly understood if you know what a monoid is, and that for monads, the identity object is the identity functor, its product is `join`[1] and its unit and multiplication satisfy the usual monoid laws.

For a concrete example, consider this Haskell expression using the `Maybe` monad:

    do
      x <- Just 3
      return (x + 1)
That desugars to:

    Just 3 >>= \x -> Just (x + 1)
Which we can desugar to an expression in terms of the monad's monoidal product, `join`, by substituting the definition of `>>=` in terms of `join`[1] to get:

    join (fmap (\x -> Just (x + 1)) (Just 3))
You can evaluate that in Haskell and you'll get `Just 4`, just like the original expression.

So what happened there? The inner expression `fmap (\x -> Just (x + 1)) (Just 3)` applies the anonymous function to `Just 3` to get the double-wrapped `Just (Just 4)`. One of the `Just` wrappers is then eliminated with `join`.

(Btw, the fact that we have a Maybe within a Maybe here is related to the fact "monads are monoids in the category of endofunctors" - a category that maps to itself. That's where that part of the quote comes from.)

In this simple example, there's some unnecessary machinery - you can get the same result with `fmap (\x -> x + 1) (Just 3)`, without the extra `Just` wrapper or the `join` to eliminate it. But then you lose the ability to do things "in the monad": the anonymous function becomes just an ordinary function, it doesn't have access to the monadic wrapper. Many of the useful things that monads can do are because the wrapper is available in every function, so you can store state in it (Reader monad), create new wrapper instances with different state and pass those on (Writer and State monad), etc.

---

[1] x >>= f = join (fmap f x)


If the contraint is not in the signature, and cannot trigger a test failure with typical implementation, it doesn't exist.


It's pairwise, not global reasoning.


The accumulator is global state. If you're folding from list<int> to int you're right that it's (usually) effectively a pairwise operation on ints. If the fold is something like list<foo> -> tree<bar> then you have to reason about each intermediate (tree<bar>, foo) -> tree<bar>, i.e. how global state should evolve over time with each update.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: