Hacker News new | past | comments | ask | show | jobs | submit | bluetech's comments login

> `ctx.Value` is an `any -> any` kv store that does not come with any documentation, type checking for which key and value should be available

The docs https://pkg.go.dev/context#Context suggest a way to make it type-safe (use an unexported key type and provide getter/setter). Seems fine to me.

> What if you just use a custom struct with all the fields you may need to be defined inside?

Can't seamlessly cross module boundaries.


That's not going to happen. Check out "induced demand".


Otherwise as selling dollara for dimes. At least in the last VC bavked iteration of it.


Some discussion on zio in loom-dev mailing list recently: https://mail.openjdk.org/pipermail/loom-dev/2023-March/00535...


Loom is useful as an underlying mechanism for an IO monad. What I mean is that Java as language still lacks important features so they have to deliver half-baked things like that "structured concurrency". From my point of view these new abstractions are evil - the better ones were out there for a while.


> Object.freeze does make an object immutable

If you look at the Hardened Javascript example:

    const makeCounter = () => {
      let count = 0;
      return harden({
        incr: () => (count += 1),
        decr: () => (count -= 1),
      });
    };
The "counter object" here is mutable. I think that's what they mean.


Well yeah, it's closing over a variable that is not actually part of the properties of the function objects that are returned.

Object.freeze makes the shape (and therefore the properties) of an object immutable. It makes no guarantees about variables being closed over by a function. Those are different semantics altogether.

That feels similar to my earlier example of properties of nested objects not being affected by Object.freeze. And in this case, being able to freeze closed variables would in a sense mean exposing those variables. Which is not how closed variables work in JS (in fact it's one of the best ways to mimic "private properties" - except they're not really properties).

It's a good example of a potential gotcha though!


There are two types of immutability in JS: one is rebinding a variable (forbidden by the const keyword) and the other is modifying an object (forbidden by freeze)

In javascript these are similar as environment closures behave sort of similar to prototype chains.


One way to work around this is to serialize the argument to harden back to source, eval() it and then harden, which will prevent the captures from working.


What advantage does pg_repack have when you only rebuild an index? Or do you mean it has advantage when pg_repack is run on the entire table?


> One possible solution currently considered is to ask Article 5 protections from NATO for the duration of the membership process.

The report discusses this, and mentions two reasons against doing that:

- What happens if you do it, and then the referendum votes against joining? You're screwed from both ends.

- Due to the previous reason, there will be extreme pressure to vote for joining in the referendum, making it not very democratic.


The book Radical Markets proposes the following tax (to replace most other taxes), quote:

Every citizen and especially corporation would self-assess the value of assets they possess, pay a roughly 7% tax on these values and be required to sell the assets to anyone willing to purchase them at this self-assessed price.


This is a horrible proposal. Do I have to put a price on my family's home? And if I price it just right, be forced to sell to some speculator who wants it just because he has more money than I do?


Another way to think about it is, that you adjust the price continuously. If a speculator offers you money, you are in the position to take the offer or raise your own valuation and pay the increased tax. At some point a sensible person would be like: screw this, I am moving out of the city because the offers are so high, resulting in very high taxes, which is the intended effect.


Or wealthy people buy up a ton of land and get the law changed.


Or not, because the law would force them to pay taxes on that ton of land, but maybe something like a $200,000 personal exemption would help.


Which is essentially what the current reality is, since such a law does not exist.


Maybe can work for some types of assets one doesn't use, like parked domains

In your example, you could also say "I have to put a price on our cat, and...?" Or your glasses, or your jeans and underpants. But the proposal probably didn't have such things in mind


Basically, their answer is yes.

First, under this system, long-term speculation is not really viable, due to the high tax. So the buyer must have some reason for paying higher than the price you set, which you don't see, i.e. you under-utilize the asset. Google/Facebook ads work this way - every slot is always up for auction. Also similar dynamics in partnership agreement's "shotgun clauses", etc.

Second, you can always factor in your sentimentality into your price, then the buyer will buy your neighbor's house instead. But you have to pay for it in the form of a higher tax. This is like a penalty for obstructing economic efficiency.

Third, this system pretty much does away with the strict idea of private property, into what they call "partial common ownership". It's basically a way to have shared ownership (as in communism) without the central planning, i.e. in a way that might actually work. (In fact, it quite reduces the role of government.)

I'm not advocating for this system, but I think it's fun to think about.


Java actually doesn't need to add any features for it to support this, it needs to remove them. I recommend reading this excellect article: http://habitatchronicles.com/2017/05/what-are-capabilities/

The gist is:

Rule #1: All instance variables must be private

Rule #2: No mutable static state or statically accessible authority

Rule #3: No mutable state accessible across thread boundaries


This is so obviously what needs to happen, it's really surprising it's not a feature in all major languages by now. I bet in 10 years time, giving dependencies complete control would seem crazy.

Here is an interesting proposal on how to possibly get there in JS with import maps: https://guybedford.com/secure-modular-runtimes

Deno uses ambient permissions for the entire process and unfortunately missed the opportunity to do it right.


PSI is a perfect fit for htop. I sent a PR to add it some time ago (https://github.com/hishamhm/htop/pull/890) but it hasn't been merged yet.


Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: