Remix.run Logo
▲ pjmlp 2 days ago

Eiffel or Smalltalk are two languages, among others I could chose from, where primitives and others types are differently implemented, yet unless you dive into the nitty gritty details, they look exactly the same to the developer as the compiler handles them exactly the same, and there are no extension methods to be seen.

▲kragen 2 days ago | parent [-]

However, it would be impossible to implement a #toggle method in Smalltalk that behaves like this, because you're calling it on the singleton True (or False) object; Smalltalk local variables, like Lisp variables, are references to objects rather than objects themselves.

(You obviously know this, but it might be a surprise to many people reading this thread.)

▲pjmlp 2 days ago | parent [-]

Yes, but that is orthogonal how primitives and reference types get exposed to the developer.

Something like toggle is also impossible in languages that favour immutability and forward progress requires creating new variables, like several functional and logic languages.

▲kragen 16 hours ago | parent [-]

Agreed.