Weeknotes 50
Fencepost error
-
I’m on holiday! 🎄
-
Community: Analysis of Cork-Based Networking. I got through season four without any real trouble; I’d braced myself for it to be terrible, but in practice it didn’t feel like a massive detour from the gentle downward trajectory of the show as a whole. It’s still entertaining enough that I’m going to watch it to the end, but it’s just not the same show as it was in the first couple of seasons, especially now that two of the main cast have left.
-
This week has been an emotional rollercoaster of Cyberpunk 2077 drama. I started out pessimistic that I’d ever get my money back, but on Monday the developer apologised and offered everyone a refund. Great!
Of course the developer didn’t sell me the game, Sony did, and Sony later responded to my refund request with the usual boilerplate that I wasn’t eligible because I’d already downloaded it. Oh no!
But then on Friday Sony flipped out, removed the game from sale entirely and set up a special refund system for anyone who’d bought it. IGN has a good summary of the whole mess. I haven’t actually had the money returned yet but it now seems almost certain that I will.
Overall this launch has been an unprecedented disaster. I’m glad I won’t have wasted money on a broken game, but the whole situation makes me grateful in hindsight that Naughty Dog delayed The Last of Us Part II and launched it properly even though that decision made me impatient at the time. It would be nice to think that this’ll serve as a cautionary tale for developers who are tempted to launch too early in future. Will it though? No.
-
In boring Ruby implementation news, one little job I did was to add support for fractional seconds to TruffleRuby’s
Time#inspect
implementation. This turned out to be trivial for most cases but surprisingly difficult in general because of how MRI treats times with sub-nanosecond resolution:% chruby 2.7; irb >> t = Time.utc(2007, 11, 1, 15, 25, 0, 123456.789) => 2007-11-01 15:25:00 8483885939586761/68719476736000000 UTC >> t.nsec => 123456789 >> t.subsec => (8483885939586761/68719476736000000)
Rather than the
.123456789
that you might expect, MRI displays the fractional part ofTime.utc(2007, 11, 1, 15, 25, 0, 123456.789)
as the rational number8483885939586761/68719476736000000
(i.e. 0.123456789000000004307366907596588134765625) since this is one-millionth (i.e. microseconds converted to seconds) of the exact value of the double-precision IEEE 754 floating point representation of 123456.789:>> 123456.789.to_r / 1_000_000 => (8483885939586761/68719476736000000)
This is potentially surprising because 123,456.789 microseconds isn’t intended to be sub-nanosecond resolution, given that 123,456.789 microseconds is precisely 123,456,789 nanoseconds, but the representation error in the floating point number means that it doesn’t work out as a whole number of nanoseconds in practice.
TruffleRuby represents times as
java.time.ZonedDateTime
instances which only support nanosecond resolution, so by the time we get toTime#inspect
we’ve already lost the original float and must work with whole numbers of nanoseconds instead:% chruby truffleruby; irb >> t = Time.utc(2007, 11, 1, 15, 25, 0, 123456.789) => 2007-11-01 15:25:00.123456789 UTC >> t.nsec => 123456789 >> t.subsec => (123456789/1000000000)
MRI’s behaviour here isn’t going to change so I don’t think there’s an easy way for TruffleRuby to be fully compatible with it. I’ll probably end up modifying
ruby/spec
to not testTime#inspect
at sub-nanosecond resolutions since it’s implementation-specific behaviour.None of this is particularly high-minded but I enjoy the tinkering and it’s helping to familiarise me with the details of the TruffleRuby code so that I can (hopefully) work on more difficult stuff later.
-
I coughed up £13.99 to watch Tenet in the comfort of my home to wind up Christopher Nolan. I think he might be bad at making films: it was a surprisingly rubbish execution of an interesting idea. There are some impressive set pieces but it’s otherwise completely empty and dull so I don’t understand how he ever believed he could save cinemas with something so inept.
The music’s good but you can get a comparable experience by watching The Mandalorian instead, which has the additional benefit of good words and pictures as well as characters who have motivations and (for the most part) facial expressions.
-
I couldn’t decide whether to celebrate this week for being “number 50” because I started at zero and that makes these my fifty-first weeknotes, so in that respect I already missed the opportunity to celebrate fifty. Tune in soon for more unnecessary and self-inflicted fencepost error confusion about when to congratulate myself for keeping this up for a year.