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

I doubt it. Eating healthy is already cheap and easy (rice & legumes as a base, fresh or frozen veggies based on what is cheapest at the time). It just doesn’t taste as good and gets boring fast.

I respect that some prefer just to use SQL, but that isn't where most stand.

Also, instead of a reactionary "all ORMs are trash," where ORM probably means different things to different people, maybe you could provide some value to the conversation by providing specific points and/or arguments supporting your feelings about ORMs. At the very least, you could provide some citation to an article that does the summarization.


It happens in the US with how fed, state taxes interact with social security and Medicare (income capped)


The easy solution is to tax vacancy at a rate that makes this strategy not profitable.


Canada and the UK (among others) have toyed with these kind of "use it or lose it" penalties for unnecessary empty premises. I think they're a great idea, but they don't seem popular, maybe because the benefits are spread widely while the costs are paid by relatively few, but politically powerful, landowners.


IMO corporate ownership isn't bad as corporations rent housing to individuals who can't afford mortgages. Let's say corporations are 100% banned from the housing market. 85% of Americans cannot qualify for a mortgage, where would they live?


Good thing this would have no impact on home values. Hedge funds getting involved is a symptom, not a cause. Hedge funds buy properties *because* home values go up due to limited supply. The only thing that can lower housing prices is a dramatic increase in supply.


The issue here is that, after M110, there is little the police can do to prevent *public* usage of hard drugs like fentanyl. Drug addicts will be smoking fent in front of a K-5 school and all the police can do is fine them. There is more enforcement of public alcohol consumption than fent / meth.


Isn't this preferable to forcing drug addicts into prison? Someone using fentanyl on the street isn't actually hurting anyone but themselves


Respectfully, have you ever lived next to an encampment? I have. Is your assertion "Someone using fentanyl on the street isn't actually hurting anyone but themselves" based on past experience, or how you imagine the world ought to be?


I haven't but I've visited for a week with a friend who does. Of course it was sad to see people in so much pain, but beyond that I'm not sure exactly what you mean.

Even if you have more specific issues with living next to homeless people, that doesn't mean they deserve to be in jail for drug crimes. They should be given housing.

Even if you did want to throw people in jail for being homeless, only about half of chronically homeless people use drugs (https://www.samhsa.gov/sites/default/files/programs_campaign...), so outlawing drugs wouldn't even solve the issue you want it to solve.


No, they are hurting both tangibles- because they steal and attack bystanders, and intangibles- like ruining neighborhoods, driving down prices, making drugs more accessible to young kids etc.


> steal and attack bystanders

That's a crime on it's own, and it's a crime that most drug users aren't committing.

> ruining neighborhoods

How?

> driving down prices

That's a good thing for people who need to buy homes.

> making drugs more accessible to young kids

Really? I have a hard time imagining someone using drugs on the street offering to share with a kid.


> Really? I have a hard time imagining someone using drugs on the street offering to share with a kid.

These people have families. They may be parents themselves. They are living in a community, one which has children. Here in Canada, with how things are now going -- I now see young children in the tent camps with their parents.

Public drug use almost certainly encourages children to uptake the behaviour themselves. Children are impressionable. They adopt the behaviours of their parents, of their older siblings, of their older siblings' friends, and yes, even just people they see on the street.

Along with that, simple physical accessibility - the widespread presence of the substance in society - means children will have more access.

When cannabis was legalized in Canada there was a sharp increase in the number of children showing up in the ER from cannabis poisoning. [1] Children steal their parents' drugs all the time, both by accident and by intention. The more proliferate and visible drugs are, the more people walking around with some fentanyl in one of their pockets, the more such exposure incidents will happen and the more such drugs will fall in the hands of children.

I'm pro-legalization, for what it's worth. But this is one of those downsides I'm worried about.

[1] https://www.sickkids.ca/en/news/archive/2022/hospitalization...


I agree that kids getting access to their parents drugs is a problem (although I don't think that's what the person I was responding to was talking about). It sounds like you might agree that if a parent is using drugs but is still capable of caring for their children, the best thing to do would not be to arrest them but rather to either make sure that they're preventing their kids from getting access to those drugs (by providing them with a safe, for example).


You can rationalize all you want but a bunch of junkies hanging around where you live ruin everything. They make everything dirty, they are themselves dirty, drop needles everywhere and shit on the sidewalk. One junkie jumped up and ran towards one of my buddies in Philadelphia once screaming “I have HIV”. Get your head out of your ass.


I’ve also seen people in the street do wild things in Philly. And yes, homeless people are often dirty because the way don’t have access to running water. And yes, drug users sometimes litter needles (the crime you’re complaining about is littering, which is still illegal).

None of those things are a reason why someone should lose their freedom for using drugs. Prison isn’t a punishment we should throw around to people we find distasteful or annoying, it’s an extremely serious measure.


It isn't a question of backwards compatibility, it is just way easier to iterate / evolve in a crate than it is in stdlib.

For example, Tokio has the concept of "unstable" features, which have stronger stability guarantees than Rust nightly. First, you can use them with the stable rust compiler, second we guarantee that unstable features will not break across patch releases. This may seem small, but it lets us experiment with new functionality and get real world usage. Many of our users cannot use Rust nightly but can use Tokio unstable features.


Can you elaborate on "heavy weight"? Tokio lets you opt-in to only what you need via feature flags. This lets you use a small subset of the lines of code & transitive deps.


Tokio author here. Generally speaking, I recommend strongly against using FuturesUnordered unless you know all the pitfalls. We are working on an alternative utility that should hopefully avoid the issues described here and others: https://github.com/tokio-rs/tokio/pull/4335


That's great news! Especially that the observed performance of the test program based on FuturesUnordered, even though it stopped being quadratic, it was still considerably slower than the task::unconstrained one, which suggests there's room for improvement. Probably due to the fact that you still pay with a constant number of polls (32) each time you go out of budget.


IMO FuturesUnordered should stop executing futures when it sees a "yield". An explicit yield signals control should be returned to the runtime. FuturesUnordered does not respect this.


IMHO the main problem is tokio introducing preempting behaviour which in subtle ways can mess with all kinds of normally fully valid rust futures.

Sure it sometimes magically fixes problematic code, but it's in effect still a magic extension to how rust polling works which can have surprising side effects.

In a certain way tokios coperative-preempting is not adequate to handle any future which multiplexes multiple futures but such futures are a stable of rust async since the get to go.


I don't think it is an issue w/ the pre-emption code. I believe FuturesUnordered is just doing the wrong thing: not respecting yields.


wrt. preemption - in Seastar we have maybe_yield(), which gives up the cpu, but only if the task quota (more or less a semantic equivalent for Tokio's budget) has passed. Wouldn't it make sense to have a similar capability in Tokio? Then, if somebody is not a big fan of the default preemption, they could run their tasks under tokio::task::unconstrained and only check the budget in very specific, explicitly chosen places - where they call maybe_yield(). That could of course also be open-coded by trying to implement maybe_yield on top of yield_now and some time measurements, but since the whole budgeting code is already there... Do you think it's feasible?


The problem is it requires you to write your code in a way which now _only_ will work with tokio.

Which isn't an option for a lot of libraries.

While the rest of the rust eco-system is increasingly moving to have increasingly more parts runtime independent...

Furthermore I think `maybe_yield` wouldn't be quite the right solution. The problem is that tokios magic works based on the assumption that a single task (future scheduled by the runtime) represents a single logical strang of exexution. (Which isn't guaranteed in rust.)

So I think a better tokio specific solution would be to teach tokio about the multiplexing effect in some way.

For example you could have some way which snapshots the budged when reaching the multiplexer, and reset the budget to the snapshot before every multiplexed feature is called. With this each logical strange of execution would have it's "own" budget (more or less).


Any extension of executors will require having a trait abstracting the executor used, and there just isn’t one in std yet. Your code already has to be tokio specific if you do something as mundane as spawn a task.


> mundane as spawn a task.

There are only a few things you need the specific runtime for:

- spawn

- IO

- timeout

But you can mix the executor and reactor doing the IO (not recommended but you can).

Similar you can run your own timer.

And you can abstract in various ways about all of this, sure with limitation, hence why there is no std-abstraction. But there are enough high profile libraries which do support multiple runtimes just fine.

But tokios preemting-cooperated threads to require any code which does any form of future multiplexing to:

- be tokio specific (which btw. isn't fully solving the problem)

- add a bunch of additional complexity, including memory and runtime overhead

If you multiplex features on tokio you must:

- use custom wakers to detect yields

- (and) do not poll futures in a "repeating" order (preferable fully random order).

This is a lot of additional complexity for something like a join_all (for a "small" N).

(reminds me I should check if I need to open an issue with futures-rs, as their join_all impl. was subtle broken last time I checked).

And even with that you have the problem that the multiplexed futures as subtle de-prioritized as they share a budged.

The problem I have with this feature is not that it's a bad idea, it isn't it's in general a good idea. The problem is that it completely overlooks the multiplexing case. And worse, further in subtle ways divides the ecosystem (that is what I'm worried about).

So maybe we could find a way to provide a std (or just common-library) standardized way for just that feature. (I mean it's a task local int, it might not even need to be atomic, maybe. So there might be a way which doesn't have the problem async-std standardization has).


maybe_yield may or may not be the right solution here, but I think it may be useful in general - e.g. when you have long I/O-less computations. In such a case, I'd like to be able to say "yield here if my budget is drained, but continue otherwise and don't put my task at the end of the queue". Although for that the only thing I really need is a way to peek at your budget - with that, open-coding maybe_yield is trivial


It wouldn’t be too hard. The trickiest bit would be putting together a consistent API.


Now that I think of it, it would probably be beneficial even outside of the unconstrained scope, especially for long computations. When iterating over millions of elements, it would be great to have a mechanism for maybe yielding if we're past the budget, but we don't really want to force-yield on every X iterations and put the task at the back of the queue. If the maybe_yield API is potentially controversial, a sufficient building block would be a function that allows peeking into the state of your budget - and then, if you're out of it, you just explicitly call yield_now().


How could it respect them? The Future trait doesn't let it distinguish between "please yield now" and "please poll again".


It wouldn’t be too hard to tell it apart. A yield is defined as the task waking itself vs something else waking it. The yield methods already do this.


Again, FuturesUnordered cannot know the difference between a task wanting to yield and a task that wants to be polled immediately. The waker does not get this information, either. It cannot distinguish.


Here is the PR: https://github.com/rust-lang/futures-rs/pull/2551

Yield = wake the `waker_ref`. Avoiding the yield would be clone().wake().

That said, "poll immediately" isn't actually a thing nor was it ever a thing except in incorrect implementations.


But polling multiple futures independent of each other inside of a future is a thing (like join, race, etc.).

And that means that just because you get "Pending" (i.e. not ready) from one of the futures, doesn't mean you should return Pending now. I only means this future is not ready, but other futures might still be ready.

But in tokio it means this future is not ready, and we magically as a side-effect might have forced all other futures to be non-ready even if they are.

Which means tokio redefined what Pending means in a subtle but potentially massively-braking way.

Which is a problem.

And not a problem of futures-rs, but one of tokio.

And forcing all of the eco-system to increase the complexity of their code by trying to subtile detect weather something yielded or was force yielded IS NOT OK. That's not how rust standarized yielding or polling.


> wrong thing: not respecting yields

This is not quite right.

As far as I understand they did respect yield in the way it's defined by rust.

There yields mean just that your future returns `Pending`.

Which means only _this_ future is not ready.

But in tokio returning `Pending` means "not-ready" and "maybe as a _magic side effect_ also make all other futures return pending even if it is ready internally".

So lets step away from FuturesUnordered for a moment and instead just look at a future which multiplexes X-futures and polls each (not completed one) once and then yields, which should be 100% fine.

But with tokio it isn't as after just polling the first few, the "budget" might be consumed and polling all other will forcefully fail where it shouldn't, adding a lot of overhead. Worse if you just poll them in the same order every time you will de-facto starve all futures later in the list. Which means you need to add a bunch of complexity which should be unnecessary just because tokio changed what `Poll::Pending` means.

Also if you write scheduler independent futures (you should if you can) then you can not opt-out of it. Generally in a multiplexed future you don't want to opt. out anyway, you want to have a budged per logical strange of execution, which tokio doesn't provide.

Instead tokio assumes a task (which in the end is just a future polled by it) represents a single logical strange of execution. But that is simple NOT how rust futures are designed!! (Through often it happens to play out that way.)

This doesn't mean that tokios idea is bad, it's just not compatible with rusts future design in subtle edge cases.

I think it would be a nice thing to add it to the future design, but then you would need a standardized way to properly handle multiplexing. (Which as a side not tokio doesn't provide, it only provides opt. out `unconstrained`, but what you need is to snapshot and restore the budget or something similar, i.e. snapshot it when entering the multiplexer and restoring it after each multiplexed future or similar, the only solution futures unordered could take is speculative adding yields, but that's _not_ a proper solution as it subtle de-prioritize multiplexed futures compared to spawned futures and also can easily fall apart if you nest multiplexed futures....).

Also I have no idea why they call it cooperative scheduling. Futures are cooperative scheduling. What they do is preemting futures (i.e. force full yield them), but only in places where they could have yielded in context of cooperative scheduling. So it's some in between solution.


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

Search: