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

Piggybacking on this, I just want an alarm that I could tell “not tomorrow please, I’m off work. But keep the schedule otherwise, ok?”

Apparently that’s touch to ask in 2025.


The iPhone does that, when you have a sleep schedule set it will show you the alarm for the coming day and when you go turn it off it turns it off for the next day only (it prompts you to confirm you want to just skip the next one rather than edit the schedule). They've got that one figured out, works really well for me.

This (and all the rest) are true. But why isn’t every repeated alarm on (phone, calendar) equipped with “skip N nexts”?

Pixel phones have that (pause for a number of days) - not sure about other Android or iOS

Android in general has it. I have a Nokia phone that does the same thing.

If you happen to be an iOS user you can setup a bedtime. Then there are controls to change your sleep/wake times for "next wake up only". Or to skip for a day.

The default alarm system of iOS allows for this

A cursory glance at "setAccessible" usage reveals popular libraries such as serializers like gson and jaxb, class manipulation and generation like cglib, aspectj and even jdk.internal.reflect, testing frameworks and libraries including junit, mockito and other mocking libraries, lombok, groovy, spring, and the list goes on and on.

My bet is that this will be yet another "checked exception" or "module system", where many applications now need to add "--add-opens". If you'll use ANY of many of the more popular frameworks or libraries you'll end up giving this assurance away, which will make library developers not able to rely on it and we're back to square one.


We've addressed that in the JEP. Serialization libraries have a special way to circumvent this (until we get Serialization 2.0), and mocking libraries may, indeed, need to set the flag, but they're rarely used in production, so if they don't enjoy some new optimisation -- no big deal.

BTW, this JEP does not apply to setAccessible generally, as that's been restricted since JDK 16, but only to the particular (and more rare) use of setAccessible to mutate instance final fields. As the JEP says, static final fields, records' internal instance fields, and final instance fields of hidden classes cannot be mutated with that approach currently, so it's never been something that's expected to work in all cases.


Would be nice to have a single “--test-mode” flag that is only meant to be set when running tests, and allows for all this leniency, (add opens, etc) in a single flag.


We should separate the problem from the solution. The problem is that running tests may require relatively many integrity-busting flags. That is true.

There are, however, better solutions than a global test-mode flag that, invariably, will be used by some in production out of laziness, leaving no auditable record of what integrity constraints need to be violated and why. When a new team lead is appointed some years later they will have a hard time trying to reduce the entropy.

The better solutions will arrive in due course, but until then, build tools can automatically add most of the necessary flags. They should be encouraged to do that.


So make the flag remove some other feature, which is critical to production, like the ability to run main() or something.

On the other hand, I don’t think the solution to someone holding a shotgun to their foot and threatening to pull the trigger is to make everyone wear armored shoes. They’re already a lost cause, and there are a billion other ways they can shoot their foot off, if they are so inclined.

I agree with the principal of making it hard to screw things up assuming good faith efforts (making it hard to fall in the pit of despair), so overall I like the JEP.


> On the other hand, I don’t think the solution to someone holding a shotgun to their foot and threatening to pull the trigger is to make everyone wear armored shoes.

I don't think so, either, it's just that I think there are better solutions than a test-mode flag at the level of the `java` launcher. If the mechanism that runs the tests can automatically configure the appropriate capabilities without requiring the user running the tests to do manual configuration then the problem is solved for those who just want to easily run tests just as well as a test-mode configuration.

The idea of a test-mode flag has been floated before and considered; we're not ruling it out, but if such a mode is ever added, I can't tell you now what it would mean exactly. In any event, it's better to carefully study the nature of the problem and its origins before suggesting a particular solution. As Brian Goetz likes to say, today's solutions may well become tomorrow's problems.

> They’re already a lost cause, and there are a billion other ways they can shoot their foot off, if they are so inclined.

True, but our experience shows that it's not a good idea to make the bad choice the easiest one, or people may pick it out of laziness. Let those who want to shoot themselves in the foot work for it. If nothing else, it increases the chance that they learn what their (not-entirely-trivial) configuration means, and maybe they'll realise they don't want it after all.

Someone might point out that there are still ways to do the wrong thing out of laziness by blindingly copying a configuration from StackOverflow etc., but we're not done yet.


setAccessible is also used to be able to access private fields, and not just to be able to write to final fields. Most libraries shouldn't need to set final fields, and I say this as someone who was very against when they deprecated java.lang.misc.Unsafe. I've only had to set a final field once in my career and it was related to some obscure MySql/JDBC driver bug/workaround. This particular deprecation seems very sensible to me.


So how should GSON initialize an object?

The theory is, go through the constructor. However, some objects are designed to go through several steps before reaching the desired state.

If GSON must deserialize {…, state:”CONFIRMED”}, it needs to call new Transaction(account1, account2, amount), then .setState(STARTED) then .setState(PENDING) then .setState(PAID) then .setState(CONFIRMED) ? That’s the theory of the constructor and mutation methods guarding the state, so that it is physically impossible to reach a wrong state.

There is a convention that deserialization is an exception to this theory: It should be able to restore the object as-is, after for example a transfer over the wire. So it was conventionally enabled to set final variables of the object, but only at initialization and only for its own good. It was assumed that, even though GSON could reach a state that was unachievable through normal means, it was, after all, the role of the programmer to add the right annotations to avoid this.

So how do we do it now?


> So how do we do it now?

The JEP says:

> the developers of serialization libraries should serialize and deserialize objects using the sun.reflect.ReflectionFactory class, which is supported for this purpose. Its deserialization methods can mutate final fields even if called from code in modules that are not enabled for final field mutation.

I don't know enough about the details here to say if that's sufficient, but I imagine that it at least should be, or if it's not, it will be improved to the point where it can be.


> The JEP says: [...]

The JEP also says:

> The sun.reflect.ReflectionFactory class only supports deserialization of objects whose classes implement java.io.Serializable.

In my experience, most classes being deserialized by libraries like GSON do not implement Serializable. Implementing Serializable is mostly done by classes which want to be serialized and deserialized through Java's native serialization format (which is used by nothing outside Java, unlike cross-platform formats like JSON or CBOR).


Why would you use GSON for objects that go through steps of state? Why would you mark fields like State as final when it is actually mutable? This just sounds like poorly designed code.

Maybe I don't know of your use case, but GSON/Jackson/Json type classes are strictly data that should only represent the data coming over the wire. If you need to further manipulate that data it sounds like the classes have too much responsibility.


all state is immutable :) a change creates new state - which is immutable


:) no its not.


if you change the state, it is not same state, it is a new state


It strikes me that we could have a way to reflectively create an object from values for all its fields in a single step - similar to what record constructor does, but for any class (could even be Class::getCanonicalConstructor, returning a java.lang.reflect.Constructor). It would be equivalent to creating an uninitialised instance and then setting its fields one by one, but the partly-initialised object would never be visible. This should probably be restricted, because it bypasses any invariants the constructor enforces, but as you say, ultimately serialisation libraries do need to do that.


I don't know if Java serialization supports this kind of thing, but if you have object A has a pointer to object B and vice-versa, there's no order to deserialize them without passing through a partially-initialized state that preserves the object identity relationship. I suppose you can't construct this kind of loopy references graph with final fields without reflection in the first place, so it's kindof chicken and egg. For the very common case of DAG-shaped data or formats that don't support references I think the one-shot internal constructor works though.


Just do it like Rust


Yeah like the module system. Looks good on paper, is probably hard to deal with. There are still tons of popular libraries that have no module-info. Java does evolve, but the direction it does is so weird. And than the tooling is strange and it’s worse that there are basically two build tools, both with their upsides and downsides but they still feel more complicated than tools for other languages like cargo, go (if you consider that), msbuild (the modern csproj stuff/slnx)


Gradle is a general build tool, while cargo/go are only for their respective languages.

The moment you need to run some code from another language on your code to generate some other code or whatever, they break down, while Gradle can be used for pretty much anything.

In other words, cargo/go only solve the cache/parallelize/resolve task dependencies problem for "hard coded" special cases, the moment you strive away from that you are in a world of pain.


My impression is that this will be painful for the code I work on because the libraries you mention depend on being able to modify private and/or final fields.


private fields are no issue


"How is this our life?"

I asked that question so many times (for reference, see my comment on Jake's thread https://news.ycombinator.com/item?id=41163619 ). I asked it of my late wife. I asked it of my therapist. I asked it of my daughter, when she was sleeping.

"Is this my life now?"

The first few months were terrible. Then things started to get better. Before anyone jumps and says "a few months?! That's nothing!", there's a thing called "anticipatory grief". Look it up. (Besides, each grief journey is individual. Besides, who are you to criticize me?).

Then things stopped getting worse. For a while life was flat. Colorless. Dark. I moved through the motions. Dropped my daughter at preschool, worked from home, picked her up, went to the playground, went home, dinner, bedtime story, lie in bed doing nothing. Rinse and repeat. Go to sleep early to avoid feeling.

Then it started getting better. And better. And even better than that. Therapy, meds, pushing (omg so much pushing), friends, a new love. Things got continuously better. I'll never forget that year, but I also now know that I can survive what I think is the 2nd worst thing that can happen to a person. I know it cannot break me.

And I think Bess found that out too. Parts of us died with them, but new parts are growing. Parenthood parts. Discovery parts.

I remember watching my wife to make sure she was breathing. Then at the hospital. Then she wasn't. And it was terrible. A loss I cannot even describe, a part of your own soul that is torn out of you. Yet, that part was painful. Not just that, also in pain. In some sense, I was relieved she was no longer in pain. Even more relived she didn't have to witness her mom passing away. The world turning darker and more despair filling in. She missed on milestones, but also on sadness. And, at the end, I miss her but that part, slowly, became more bearable.

To Bess - I can't promise it'll be ok. No one can. But it'll get easier to bare.


I’m happy to see the reference to your comment from last year again.

It was a few months out from my wife’s passing, and your Irreverent Guide recommendation has been one of a few genuinely helpful things for me so far.

At the time I passed over the children’s book suggestions, but my daughter might appreciate them now.


I'm so happy (well... I'm something. happy is somewhat hard to come by these days) that I helped a fellow widower. We're in this alone, but together.

My personal view is to hide nothing, NOTHING, from my daughter. The tears, the grief, the pictures, the videos. Talking about death using "death" and not "passed away". Talking about the memories and feelings. About a person no longer being here (not spiritual so no "heaven" for us, no waiting to be reunited). And, so far at least (just closing on 2 years, daughter grew from 4.5 to 6.5), it seems to be working very well. She's happy, active, well adjusted, charismatic and not prone to tantrums or worrisome behavior more than any other 6 years old. And her being happy makes me happy. I KNOW my late wife would've been proud of us both.


"Explains Git so often, probably dreams in commit messages"

"So passionate about system design, probably tries to optimize their grocery shopping with distributed algorithms"

Both are so true!

And on a more serious note, "Will develop an open-source journaling platform focused on grief support and mental health" sounds like an amazing project to dive into. Possibly, deepseek, possibly...


Lost my wife about 1.5 years ago. It was expected and unexpected at the same time. Long metastatic cancer treatment that ended all of the sudden, in a few weeks of unconsciousness ("coma") with an auto immune brain disease, likely caused by chemo.

As the partner left behind, I nothing but empathy to Bess. As an avid, ultra pragmatic, HN reader though, I've gathered resources so I'll list them here:

Forums / chats:

https://www.reddit.com/r/widowers/ - This one I used immediately after. Yelling into the void. Crying. Having other people cry with me. Make sure I'm heard.

https://discord.gg/CFQfCdby - /r/widowers discord. This one is "good" for the first few days / weeks / months, when the pain is great and the sense of lost is overcoming and you just need someone to talk with, someone who's been through this, right now. Everyone is friendly, rules to keep things sane and not triggering are in effect.

Facebook groups - I know, ugh. But it helps to see other people in the same boat. Somehow. A little. For me it was "Young and Widowed With Children" (well, me) and some of the black humor groups e.g. "Widow(er) Humor". Find your tribe. It really does help.

Books:

It's ok you're not ok - https://www.amazon.com/Its-That-Youre-Not-Understand/dp/1622... - This is "the book". Everyone recommends it and it's justified. If you can't bring yourself to read, get the audible version. I did, it was easier to lie in bed with eyes closed.

Irreverent Grief Guide - https://www.amazon.com/gp/product/B08L5RRJ9D - this one is a "how to" guide. I mean a real "how to", emotionally. I, and possibly many on /r/widowers/ found it priceless.

Videos:

https://www.youtube.com/watch?v=dzOvi0Aa2EA - Huberman labs - a really short video on how your brain needs to reorient itself after loss.

Kids:

"The widow's survival guide" - https://www.amazon.com/Widows-Survival-Guide-Living-Children... - "you're not alone in the mess" kind of book. Again, audible version available.

Kids' books (mine was 3.5 so YMMV):

Reread over and over:

  - The invisible string - https://www.amazon.com/gp/product/031648623X
  - Fix-it man - https://www.amazon.com/gp/product/1925335348
  - Missing mummy - https://www.amazon.com/gp/product/0230749518
  - The sad dragon - https://www.amazon.com/gp/product/1948040999
  - Something very sad happened - https://www.amazon.com/gp/product/1433822660
Read once or twice:

  - Love is forever - https://www.amazon.com/gp/product/0615884059
  - I'll See You In The Moon - https://www.amazon.com/gp/product/1989123309
  - My heart will stay - https://www.amazon.com/gp/product/0578794578
  - The heart and the bottle - https://www.amazon.com/gp/product/0399254528
  - Always remember - https://www.amazon.com/gp/product/0399168095
  - The garden of lost balls - https://www.amazon.com/gp/product/B0BLQW27XX
  - Gone but never forgotten - https://www.amazon.com/gp/product/B09SNY9VF3
Therapy and meds:

Actually, therapy and meds before, if not already. Anticipatory grief is a thing and processing it can make later days a bit easier. Anti anxiety meds (NDRI) can create "inoculation" effect to some extent. SSRIs probably as well. Understand depression, the symptoms, the issues. Educate family and friends. Establish rapport with a therapist.

Friends and community:

Expect loss of friends. It's terrible but it happens a lot. Extremely common that friends will silently disappear after a few days or weeks. Not even just joint friends. People are awkward around grief. Community, however, does seem to work well. Rely on them. Don't say no to food offers, it helps. Doordash! Don't be shy about it, it's fine to eat junk food. Don't drink though and don't get high, it deepens and prolongs the grief symptoms.

Calls:

Don't forget your family or close friends. I've had daily calls with my sister. It helped a ton. Scheduled daily calls.


Forgot to add: Journaling helped me a lot. I favored writing this as "letters" / "texts" to my wife. As if she's here, just telling her about my day, feelings, emotions, what our kid did, what happened around us, family and friends. Venting, crying, blaming, being frustrated, being happy, being proud. All goes in there.


I think I will be forwarding funny animal videos to Jake on instagram for all time but the idea of them being delivered to no one is this weird minor detail that is just so hard.


That happened to me too. Then I switched writing in "notes" and eventually switched to https://dayone.me/ which has a webapp as well as mobile app, so it's easy for me to write on any device. It was less disheartening not to see that "delivered, not read" on messages.


Thanks for sharing, bironran, I ordered the irreverant guidebook, and appreciate the suggestion. I'm avoiding all medications because I'm 7 months pregnant, but have Tetris available to try and prevent PTSD https://www.ox.ac.uk/news/2017-03-28-tetris-used-prevent-pos...


Cannot be complete without a reference to Wat

[https://www.destroyallsoftware.com/talks/wat]


Also, my favorite collection of JS weirdness, “Return true to win”: https://alf.nu/ReturnTrue?world=true&level=id


What is supposed to be happening here? I keep getting a popup (on Orion browser) saying "Orion cannot open the page because the address is invalid." on every interaction, and nothing happens except it counts the characters of my input.


It is a known issue in Orion, tracked here https://orionfeedback.org/d/7856-cannot-open-this-page-becau...


Thanks -- assumed it was an issue on the app's side.

Also, that was fast. Do y'all have a script checking for Kagi/Orion mentions on HN?


I use the excellent https://f5bot.com


This looks really great, but I wish there was a setting for "SAT level English". That could've really helped me improve my own vocabulary. Also "used in a sentence" so I could actually type something in a sentence.

And... maybe ignore typos, spaces, commas etc in the non main word? The main word is important for sure but the rest is less, just forces you to focus on what you're learning.


Yeah that makes sense, some people complained about the definition punctuation. I'll remove the validation of the definition. We have only 20 words for now, but I'll make sure to update it and add levels. Thanks!


I can emphasize and relate. Unfortunately.

My wife of 10 years died of something called ADEM. "Acute disseminated encephalomyelitis". I'll save you the search, it means something (often immune system) strips the Myelin off the nerves in the brain. No Myelin, no proper electrical conduction. In my wife's case it was described as "fulminant", which means "severe and sudden onset". No kidding. She went from standing and talking to bed-ridden and not knowing who I am in 4 days. 3 days after she was "solement", meaning she wouldn't wake up fully. This is commonly described as "being in a coma". About a month and a half later I stopped supporting treatment, just like you did. I, she, were "lucky" (heh) that she didn't survive much longer and died just 3 days after.

I remember the doctors explaining the MRI (took a long while to get a sympathetic neurologist that actually sat and explained to me what's going on), the hopelessness, the decision to pull support and accept whatever happens next. I remember telling the hospital staff "just make her comfortable", though I didn't believe she was still there. Her brain was too far gone.

That decision was the hardest I had to make in my life. "yeah yeah" people might say (not you though, Lars, you know). But no. It was the hardest. To give up on the person that made your life whole. To know there will never be a replacement. Hoping (sorry, not a religious person, I don't really pray. I did try to make lots of deals with god during that time though) that things will get better, then just easier, then finally just end quickly.

Brain diseases are horrible. They frighten me beyond anything else in the world. You see your person change, disappear. That made me not believe in after life, souls, etc. What existence can there be after if you see memories disappear all at once, basic abilities like talking, moving, eating. Maybe there is something, but it's not the person anymore. That was the brain, the memories, the learned behavior and experiences they had in their lives. And when it's gone, it's gone.

I know what descending to that dark valley is like. What walking through it is like. I hope you can come back up towards the light. Eventually. Maybe.

One bit of practical advice: Reach out to psychologists (talk therapy) and to psychotherapists (psychoactive medicine). It's not a shame, it's a strength. Your brain undergoes significant changes and things get out of balance. Talking, pills - they both help. Today's psychiatric medicines are much more advanced and targeted than even 10 years ago, not to mention Hollywood's depictions. "But I'm afraid it'll change me, it won't be me anymore!" - sure, but is being you that great? You can comment here and I can share my own prescribed cocktail to your blog email.

Be strong. The sun will come back up. It won't be as bright or as warm, but it won't be dark forever.


Might be only my limited understanding but isn't that trying to recreate cooperative multitasking?

That was tried, and often failed, for many years in the OS space.


Sadly in the browser you have no choice but to perform cooperative multitasking, since the execution model prevents the browser from performing preemptive multitasking.


plays well on my ubuntu


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

Search: