Comment

Comment by jibal

> Types are properties of values, not variables.

In statically typed languages, variables and expressions have a compile-time type and values have a run-time type.

> Mutability is a property of variable, not of a value.

In which languages?

In D, mutability is a property of a type. And variables and expressions have a compile-time type and values have a run-time type, so mutability is also a property of variables, expressions, and values.

(Immutability is also transitive in D, so an immutable value cannot have mutable parts, including mutable references, and a variable with an immutable type cannot contain a value or reference with any mutable parts.)

parent jibal 1 month ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton