Hello,
Closures were implemented in Squeak/Pharo according to the blue book, so they were not real closures, up to 2008. Then the VM and the compiler were changed to support real closures.
The code you showed should work both on latest Squeak and on latest Pharo fine. Old version of Squeak and/or Pharo may not work. Last time I tried, it worked on Squeak 4.5 and it works at least since Pharo 1.4.
About compiler warnings you can disable them in the setting browser. Then you won't have the modal dialog that you find annoying.
Regards.