Fluorescence

Joined 3 years ago

Karma
1,271
Submissions
371
Member since
Aug 16
View on Hacker News

Recent submissions

Comment · 1 day ago
Comment · 1 month ago
clear() is a method of std::Vec not std::slice.

DerefMut to [T] not Vec<T>.

Comment · 1 month ago
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"!

Comment · 1 month ago
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<T> Deref for NonEmpty<T> {
        type Target = [T];

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

    impl<T> DerefMut for NonEmpty<T> {
        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<i32>);
Comment · 1 month ago
Not sure that type is good advice:

    pub struct NonEmpty<T> {
        pub head: T,
        pub tail: Vec<T>,
    }
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<T> {
        v: Vec<T>,
    }
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

Comment · 2 months ago
> 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.

Comment · 2 months ago
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!

Comment · 2 months ago
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.

Comment · 2 months ago
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.

Comment · 2 months ago
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).
Comment · 3 months ago
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.

Comment · 3 months ago
> because Klarna already specializes in precisely this kind of transaction

I think Apple gets sweetheart deals so their partners often lose money. Klarna likely sees this as a marketing coup to have their predatory sussness promoted by the Apple halo brand.

If there was profit to be had, I'm sure Apple could buy a small bank and spin it off as a subsidiary with little drama, it's just not the best of their options.

Comment · 4 months ago
First time I have seen this name.

Wikipedia is intriguingly inconsistent - claims that Marijn is the Dutch variant of Marinus meaning 'marine' like Marius, Mario etc. but other pages claim Marius is more likely to be from 'mars' or 'male' than 'marine'.

Comment · 4 months ago
It's very weird to consider "time consumed" as a positive not negative metric.

A good piece of art changes your consciousness and makes you a different person. The best part of a book for me is not in the reading but how it becomes a part of my own imaginative engine and a new lens with which I can view the world.

I play games too... but I'm aware they are cynical time-vampires that pad out their content with repetitive grinding to jump virtual hurdles hijacking my reward centre with one-arm-bandit psychosis to make draining my life away by a rng feel "entertaining".

Comment · 4 months ago
As a cyclist, I find sound such a poor signal I'd consider it optional. Too many threats are silent and sound is too late, misleadingly bounces of other surfaces and generally poorly correlated with significance.

Safe cycling is all about vision. If you can't see it's safe, it's not. It isn't simply seeing imminent threats but predicting them e.g. identifying drivers that aren't paying attention and where a car could suddenly emerge like blind turnings, car doors, pedestrians and such, and countering with appropriate caution / road position.

If you find noise useful, IMHO it means you aren't sufficiently aware of your environment.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton