Self Modifying AppleScript Still Runs Under Lion

I’m a little surprised.

-- Self Modifying code
-- BP 2006

-- Just a Demo
-- Run this code twice and look at the first line

-- On the way to something useful:
--tell application "Finder"
--	set folderspot to choose folder
--end tell
--set mystring to ("set mypath to " & "\"" & folderspot as string) & "\""

set mystring to "beep 2"

--display dialog mystring

tell application "AppleScript Editor"
	activate
	set text of front document to mystring & "\r" & text of front document -- prepend the line as a new line
end tell

tell application "AppleScript Editor"
	activate
end tell

Save this as a script. It doesn’t work as an App; compilers are like that.

http://en.wikipedia.org/wiki/Self-modifying_code