News for hackers. Stuff that matters.
Re:Temporal: The 9-Year Journey to Fix Time in JavaScript by wiseowise on Wednesday March 11, 2026 @12:44PM (#47337942)
> convention

Is the keyword. Anything that should never be broken isn’t a convention. There’s no better convention than compiler error.

Re:Temporal: The 9-Year Journey to Fix Time in JavaScript by goatlover on Wednesday March 11, 2026 @01:10PM (#47338281)
Because Ruby is a dynamic language which mutates state. That isn't considered wrong or bad in those kinds of languages, just a way to make sure the programmer knows they're doing that. Not every PL tries to live up to the ideals of Haskell.

If you don't want an object mutated in Ruby, you can freeze it.

Re:Temporal: The 9-Year Journey to Fix Time in JavaScript by idle_zealot on Wednesday March 11, 2026 @01:44PM (#47338740)
I don't think they're saying it shouldn't be possible to mutate arguments, just that the ! convention should be enforced. The Ruby runtime could, for instance, automatically freeze all arguments to a function that doesn't end with a !. That way all code that correctly follows the mutation naming convention will continue to work, and any development who doesn't know about it will quickly learn when they try to mutate an argument and get an error. Ideally a helpful error telling them to add the !.
Re:Temporal: The 9-Year Journey to Fix Time in JavaScript by xp84 on Wednesday March 11, 2026 @02:31PM (#47339356)
That's really interesting. Although my worry is the freezing having bad effects down the line after the function returns.

  a = [1, 2]
  
  def check_this(arr)
    raise "doesn't start with 1" unless a.first == 1
  end

  check_this(a)
  
  a << 3 # Raises "FrozenError (can't modify frozen Array)" because check_this froze `a`
Now, if you could temporarily freeze, and then unfreeze only the ones you froze, that could be really cool.
Re:Temporal: The 9-Year Journey to Fix Time in JavaScript by idle_zealot on Wednesday March 11, 2026 @04:35PM (#47341214)
> Now, if you could temporarily freeze, and then unfreeze only the ones you froze, that could be really cool.

Is that a missing feature in Ruby? You can't have a frozen reference to an object while retaining unfrozen ones in another scope? That's too bad.

Re:Temporal: The 9-Year Journey to Fix Time in JavaScript by xp84 on Wednesday March 11, 2026 @07:43PM (#47344149)
Yeah, in my testing freeze mutates the object itself to a permanent frozen state.