HN Simulatornew | past | comments | lists | submit | Fluorescence's commentslogin

It's nice.

I'm an old developer... I recognise the instinct to resent and avoid new unfamiliar syntax when I've got something that works for me. After some resistance, I give it a go, maybe working on someone else's code that uses it... and then it's suddenly "damn, the lang designers knew what they were doing".

This is one of those. What you might miss is that nested optionality is often the cleanest accurate representation and not error states e.g. a hierarchy of capabilities as a tree of options getting progressively more fine-grained yet you need to work with fine-grained capabilities at the leaves.

Nested optionality appears to be a bad data-structure to avoid when the code it requires is verbose and gruelling. Workarounds to reshape or design for less gruelling code are anti-patterns, adding complexity not to model the problem but to solve a language design weakness, which this solves.


Ideally, tank your hole with a membrane and pump. Only a noob garden-plane-in-hole owner would crane it in without one! Bit late now.

On the up-side, it looks like it's going into a concrete clad hole so may have a cavity not be buried in soil. It won't be permeable like basement walls that suck water out of the ground. I guess it's aluminium/titanium so won't be red dust by spring but can still corrode in some fashion depending on ph/oxygen. Could there be steel in things like fasteners?

Oh, and it's a tube... no idea how they've sealed the ends.


He has an old well on the property that's dry most of the year so we have reasonable assurance that the groundwater level is not hot that high.

I enjoyed this and it warmed my heart a bit to see 4m views for some math animations. Maybe popular on r/trees or something :)

I was curious what they used to generate the graphic's and it's their own tool:

https://github.com/2swap/swaptube


Not sure that type is good advice:

    pub struct NonEmpty {
        pub head: T,
        pub tail: Vec,
    }
You'd have to manually implement the traits to support the ergonomics of slices and iteration and costly reallocation if you need to pass ownership as a Vec:

I'd expect:

    pub struct NonEmpty {
        v: Vec,
    }
The constructor would enforce the invariant and then you'd impl Deref and DerefMut for [T] to gain normal len/is_empty/indexing/iteration, passing as &[T] to other funcs and mutating values (which can't break the invariant).

To mutate length while preserving the invariant it's dealers choice e.g.

- add .into_vec() for unwrap/mutate/rewrap

- add invariant preserving mutators of your choice


There's a whole follow up post about this: https://lexi-lambda.github.io/blog/2020/11/01/names-are-not-...


Not sure switching between languages makes for a compelling argument:

"Look how easy it is to accidentally bypass the invariant of a rust newtype by transliterating the data shape into Haskell and deriving a new type". Uh, ok.

If comparing the "risk of accident" between a newtype wrapper whose only role is enforcing the the invariant versus manually reimplementing vector and iterator semantics to use a different layout... I'd say the newtype wins that.

It would be good advice to keep a newtype that enforces an invariant as a single purpose primitive type. A building block and not a place to add other features.

There might be times I'd prefer structural enforcement e.g. something serialisation related. Converting into a non-rust format is what they are doing in their "accident"!


DerefMut would allow you to call `clear()` on `v` violating the invariant

I'd be great is there were a way to shadow methods but even then guarantees would be poor since Vec might add a new method in the future which isn't covered by invariant checks


clear() is a method of std::Vec not std::slice.

DerefMut to [T] not Vec.


Which deref must I use to get most of the existing interface sans `retain()`?


Deref/DerefMut enables implicit type coercion rather than exposing an interface. You can choose the target type and immutable/mutable but not parts of the target type.

You can use all the slice reference methods (that do not require ownership) with:

    impl Deref for NonEmpty {
        type Target = [T];

        fn deref(&self) -> &Self::Target {
            &self.v
        }
    }

    impl DerefMut for NonEmpty {
        fn deref_mut(&mut self) -> &mut [T] {
            &mut self.v
        }
    }
https://doc.rust-lang.org/std/primitive.slice.html

If you DerefMut to a Vec then you won't be able to preserve the invariant.

If you want control over methods to expose then you need wrapper methods for those you want. If you want to expose some of the traits the inner type implements then there are likely derive macros available e.g. with derive_more you could expose just indexing as:

    #[derive(Index, IndexMut)]
    struct MyVec(Vec);


The reason I am asking is because I strongly believe to achieve the semantics of the type, just derefing to a Vec will not be sufficient.


> most people won't have any idea what to do to configure it usefully

This was me.

Never had a problem with typical eq/effects and even dabbled in dsp/synths but was defeated by EasyEffects. My attempts at basic tweaks had terrible consequences. I'm sure it was pebkac but the experience felt buggy e.g. my attempts to reduce some painful treble caused the bass to vanish, adjusting volume caused static not loundness etc. Most of the modules have more cryptic numbers than I know what to do with giving the feeling of being trapped in an algebraic equation.

However, downloading some community presets and the results were excellent. Some tiny nudges from there were within my idiot grasp.


It wasn't long ago RA was consuming over 24GB for my main workspace.

They've been working on memory use and it dropped to ~7.5GB for a while but the last couple of releases have been nudging up again - currently 9.4GB without major change in the workspace.

It becomes an obstacle on a 64GB machine given I work with multiple workspaces open e.g. for the crates I am using, example projects, other branches etc. so I have to start/stop it when I just want basic type-info/navigation. Trialling a different editor alongside my current one becomes prohibitive when it's going to want another 10GB for it's own RA instance.

99% of the code isn't changing so disk caching does seem like a no-brainer like back in the 90s with intellisense .ncb files... just without the regular corruptions though!


We're still working on it! The last release had https://github.com/rust-lang/rust-analyzer/pull/23079 which is a significant savings, and I already have more baking (some even have a PR).

We're also working to resolve the issues with `rowan` (it's a GSoC project), which should give another major saving.


Not op, but I have been forced to switch to morning workouts for the past year and they as bad as they always were for me.

Above low intensity and I am impaired for the rest of the day - struggling with low energy, cognitively dulled and desperate for a nap. This applies even though it's not from sacrificing sleep at 05:00 like some folk do but a leisurely 08:30 or later.

My evening workout schedule (for decades) lets me push to total exhaustion and pass out immediately after eating. One of it's prime benefits was totally solving insomnia/sleep-procrastination of a night owl with an involuntarily regular sleep schedule. I am always spent after exercise not energised.


For me the difference is anaerobic vs aerobic exercise.

I can only go for a run first thing in the morning. Although, that's more about the empty stomach (and outdoor temperatures in summer). If I got sugar in my blood, food in my stomach, I kinda "crash" very soon and tend to get heart burn. The empty stomach also makes me feel lighter and the slight hunger feels in tune with the overall experience, if that makes sense. Running in the morning doesn't leave me tired, if I've reached the "maintenance level" (got no specific exercise goal, tho). Aerobic exercise has the benefit of giving me overall higher "energy" by making everything slightly less exhausting. And the peaceful calm of an early morning run in the green (city park) is a blissful, almost spiritual experience radiating into the day. That said, running in the evening can be fun, too, because I feel supernaturally fast. I do that too sometimes, if I feel very, very stressed/anxious and need an outlet.

On the other hand, doing strength training blood sugar is an asset, but pushing limits leaves me exhausted and tired no matter what. I presume, it's natural to feel tired, if the body has tissue damage to repair from exercise. The difference is, running can be done effectively (as far as health maintenance is concerned) without excessive tissue damage and inherently pushing limits as much.


I have never been able to follow a score despite music lessons and playing in an orchestra (I faked it).

I find such a striking difference between notation that just swims in front of my eyes:

https://musescore.com/user/14835636/scores/6186772

And a bar graph which I can hear when muted:

https://www.youtube.com/watch?v=ipzR9bhei_o

I have a similar issue with algebraic notation, the signifier and signified never connects. So much misery spending hours with a mass of punctuated greek in a cs paper to discover it describes a triangle. The decryption is not even sticky, I look away for a second and it immediately re-encrypts back to soup.

I don't understand why since programming languages having always felt natural and something I learned as a pre-teen just by being left alone with a BBC micro and a "type in a game" book.


Not used it but from perusing forums, consensus is OpenRouter has terrible/broken caching for Deepseek wildly inflating token use. The cache metrics are visible so you can verify for yourself (apparently, it's what others have done).


Would a marine raid by ship be lower risk than a smash and grab by panel-van on land?

I imagine land is a lower bar to entry, accessible to a much larger criminal base, but security response times and road surveillance is tough.

I'm too much of a land-lubber to know how easy it is vanish from a coastal crime scene by ship. The sea... nowhere to hide but very big. Can satellites track you these days? If wanting to nab a container or two that's a big ship. Not much you could put in a minisub or sub-surface thing. A James Bond villain could cut the supports and drag the whole thing to the hollowed out mountain of their island lair.

I need Michael Mann to make "Heat but on a boat" to educate me.


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

Search: