Live data from Hacker News

Jiff: Datetime library for Rust

github.com

81–90 of 249 posts

Re: Jiff: Datetime library for Rust

#81
post #49

The fact that we need a such complicated datetime library just means so many unncessary artificial complexities were introduced before (yes the daylight saving, leap seconds etc.)

Time library can be simple, it's just rust libraries tend to be philosophic for some reason, but it's only one of many design approaches.

Re: Jiff: Datetime library for Rust

#82
post #78

IMHO, unwrap() , expect() and company, has infected the Rust language so deeply that one wonders when (and not "if") will a library send a panic and crash the whole program. How could be erased those panic! methods that are used in most of Rust's libraries is something that may be is beyond the possible? beside is promoted from all the Rust's tutorials and reference code. So much correctness in the Rust language just…

What does this have to do with anything?

Re: Jiff: Datetime library for Rust

#83

Earlier quoted context omitted.

The unlicense is considered problematic in various jurisdictions, among them Germany - under German law, you cannot relinquish certain rights that are associated with the author at all. Dedicating something to the public domain is not a valid concept here. This means the whole license could be declared invalid in court. Other jurisdictions may be similarly problematic- thus the fallback to MIT There’s a stackoverflow…

My own summary and collection of information about the problems with the Unlicense: https://chrismorgan.info/blog/unlicense/ (I collected that mostly because I didn’t find all the relevant information in one place, or explanation of the reasonable alternatives.)

i love your site!!

Re: Jiff: Datetime library for Rust

#85
post #78

IMHO, unwrap() , expect() and company, has infected the Rust language so deeply that one wonders when (and not "if") will a library send a panic and crash the whole program. How could be erased those panic! methods that are used in most of Rust's libraries is something that may be is beyond the possible? beside is promoted from all the Rust's tutorials and reference code. So much correctness in the Rust language just…

> How could be erased those panic! methods that are used in most of Rust's libraries is something that may be is beyond the possible?

It's arguably quite possible, though not as straightforwards as one may hope. For example, there's no_panic, which results in a linker error if the compiler cannot prove a function cannot panic [0], albeit with some caveats.

> So much correctness in the Rust language just for to promote to all the community to crash the program from libraries without handling the error is something I can not understand.

Is there that much "promoting" of unchecked unwrap()/expect()/etc. going on? How do you distinguish that from "genuine" cases of violations of the programmer's assumptions?

I ask because Result/? along with libraries like thiserror/anyhow/etc. are right there and arguably easier/more concise, so unwarranted unwrap()/etc. would seem "harder" to write/justify than the alternative. The main exception I can think of are more one-off cases where the author is intentionally sacrificing robust error handling for the sake of speed/convenience, but that's a more language-agnostic thing that pretty much "doesn't count" by definition.

> I hope this philosophy do not reach the Linux kernel.

IIRC this is being worked on, especially given Linus's position on panics in the kernel.

[0]: https://github.com/dtolnay/no-panic

Re: Jiff: Datetime library for Rust

#86
post #78

IMHO, unwrap() , expect() and company, has infected the Rust language so deeply that one wonders when (and not "if") will a library send a panic and crash the whole program. How could be erased those panic! methods that are used in most of Rust's libraries is something that may be is beyond the possible? beside is promoted from all the Rust's tutorials and reference code. So much correctness in the Rust language just…

Eh? There isn't a single unwrap/expect in the examples at the top level crate documentation. There should be very few overall. But there are hundreds of executable doctests, so there are certainly some unwraps.

But I've already opined on this topic: https://blog.burntsushi.net/unwrap/

Re: Jiff: Datetime library for Rust

#87
post #82
post #78

IMHO, unwrap() , expect() and company, has infected the Rust language so deeply that one wonders when (and not "if") will a library send a panic and crash the whole program. How could be erased those panic! methods that are used in most of Rust's libraries is something that may be is beyond the possible? beside is promoted from all the Rust's tutorials and reference code. So much correctness in the Rust language just…

What does this have to do with anything?

Trying to figure this out as well... Tests have a bunch of .expect and .unwrap (which is to be expected), but core logic of the library doesn't seem to have any that seems they'll get in the way?

Re: Jiff: Datetime library for Rust

#88

The state of calendar libraries in Rust is less than ideal. When working with Pandas, there is .tz_convert() and .tz_localize() and that is basically it for timezone conversions. My benchmark for this is: given a date, get first hour of CET/CEST day in UTC. In Pandas a very simple operation. In Chrono, you have to have a NaiveDate, convert to DateTime and then to DateTime . And there is no pattern in those conversion…

That should be `date(y, m, d).intz("Europe/Rome")?`. If you want to get UTC from there, then add `with_time_zone(TimeZone::UTC)`.

> Jiff seems like a step in a right direction but the syntax is sometimes weird. I guess I’d wellcome something more predictable

Can you say more? How can Jiff be better?

Re: Jiff: Datetime library for Rust

#89

Earlier quoted context omitted.

The unlicense is considered problematic in various jurisdictions, among them Germany - under German law, you cannot relinquish certain rights that are associated with the author at all. Dedicating something to the public domain is not a valid concept here. This means the whole license could be declared invalid in court. Other jurisdictions may be similarly problematic- thus the fallback to MIT There’s a stackoverflow…

Never understood why anyone uses this one; it's just too potentially messy, and a permissive license like 0BSD provides the intended effect without the risk.

I wrote down why I do it years ago: https://github.com/BurntSushi/notes/blob/master/2020-10-29_l...

You may not agree with me, which is fine, but you should now understand.

Re: Jiff: Datetime library for Rust

#90
post #78

IMHO, unwrap() , expect() and company, has infected the Rust language so deeply that one wonders when (and not "if") will a library send a panic and crash the whole program. How could be erased those panic! methods that are used in most of Rust's libraries is something that may be is beyond the possible? beside is promoted from all the Rust's tutorials and reference code. So much correctness in the Rust language just…

That is not my experience at all. It’s very rare that libraries unwrap. Beyond example code and tests I rarely see unwrap.
Post reply on HN