Odd error arising from Tell command

I have this code:

set app_name to "Safari"
tell application app_name
	set video_URL to URL of current tab of first window
end tell

It pops a syntax error “Expected end of line but found property”. It stops with tab highlighted.

Yet, this code is fine:

tell application "Safari"
	set video_URL to URL of current tab of first window
end tell

Google shows very little on this. I did find:
http://leancrew.com/all-this/2011/09/applescript-browser-tab-weirdness/ and
https://discussions.apple.com/thread/5693069?tstart=0

Solutions abound, but no explanation.

Application terminology is resolved at compile time. The name of the application must be a constant.

The alternative to tell application “Safari” is

using terms from application "Safari"
	set video_URL to URL of current tab of first window
end using terms from

however “Safari” is required to be a literal string as well.

To enlarge slightly on Stefan’s reply, the compiler can’t see here that ‘current tab’ is supposed to be a Safari term, because ‘app_name’ won’t be set until the script’s actually run. In the version which does compile, the fact that ‘current tab’ is a Safari term is explicit in the code.

To give Neophyte an answer on how his script would look like:

set app_name to "Safari"
using terms from application "Safari"
	tell application app_name
		set video_URL to URL of current tab of first window
	end tell
end using terms from

Many thanks everyone. This is making sense to me now.

Cheers.