Why do you have to put a name at the top of every program in SCAR/Pascal? This is probably a stupid question but I've never seen any other programming language do this; shouldn't the name just be the filename?
Why do you have to put a name at the top of every program in SCAR/Pascal? This is probably a stupid question but I've never seen any other programming language do this; shouldn't the name just be the filename?
That's just the program name. I don't know about in other programming languages, but it's roughly equivalent to Java's syntax of:
class Name
{
}
Well, I have a theory...
The computer does not run off of scar code directly. In fact, any programing language translates the language into binary before it uses it. This is known as compiling. This changes the file into a .exe file.
Scar is made from a different programming language. So SCAR is translated into that programming language and then into binary. Because the whole SCAR program (that you type your script into and compiles you script) is scripted itself, it does not start a brand new program when you run the Scar script. Rather, it executes a function that is your script. I assume that this function is named the name of the of the program.
Fake edit: actually, Freddy1990 could have just pre-named the user entered program... its probably for practical reasons of which i have no idea
http://www.macrosoftinc.com/ ---WTF COPIERS!!!
Not really, the scripting engine translates it to some kind of bytecode internally, in RAM, which it then processes.
Nope, the name of the main procedure is !Main actuallyScar is made from a different programming language. So SCAR is translated into that programming language and then into binary. Because the whole SCAR program (that you type your script into and compiles you script) is scripted itself, it does not start a brand new program when you run the Scar script. Rather, it executes a function that is your script. I assume that this function is named the name of the of the program.Try it:
SCAR Code:program test;
var v : tvariantarray;
begin
writeln('lolzors');
threadsafecall('!Main', v);
end.
Why it is there? Probably due to '60s stuff.
I made a new script, check it out!.
Oh, I thought SCAR was a continuous program that ran a function that you wrote in box when you clicked run. I guess it runs a separate program with its own main function.
Or I am making no sense at all...I havent scripted in about half a year...
http://www.macrosoftinc.com/ ---WTF COPIERS!!!
There are currently 1 users browsing this thread. (0 members and 1 guests)