Comment

Comment by mpweiher

Wow, Heisen-Swift, where the Heisenbugs are in the language specification!

What an object is, which is roughly equivalent to its observed behavior, should never depend on how it is declared.

   let greeter = LazyGreeter()
   let greeter1: Greeter = greeter
   print(greeter)
   print(greeter1)
   greeter.greet()
   greeter1.greet()
UPDATE: just in case it's not clear, this prints the following:

   greeter.LazyGreeter
   greeter.LazyGreeter
   sup
   Hello, World!
So the same object responds differently to the same message, depending on how it is declared. Yikes!
parent mpweiher 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton