- Home /
Javascript(Unityscript) returning Boo compiler error
I was having a discussion with some friends of mine about what language would be good as a first Unity programming language so I decided to do some experimenting. I know that Javascript or Unityscript is a dynamically typed language and allows implicit variable declaration so I wanted to see exactly what kinds of errors I could get with that, these would be simple errors that a beginner might come code by accident and not realize it and have a really hard time debugging it. So I wrote this script.
var myVar;
function Start () {
if (myVar > 0)
{
Debug.Log("Entered If");
}
}
I build it in visual studio and it's fine, but obviously there's a big problem with this code, myVar isn't initialized to anything. So it really shouldn't know what to do with the if statement. When I run my scene the scene still runs perfectly and nothing seems wrong except for an error that prints in the console. If a beginner was taught correctly then they would look at the error and try to figure it out which wouldn't be too difficult with this script, however I found something that really caught my attention. The error was this.
NullReferenceException: Object reference not set to an instance of an object Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs) Implicit Variable Declaration Test.Start () (at Assets/Resources/Scripts/Implicit Variable Declaration Test.js:6)
See anything weird? How about this line: Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
Still don't see it? Well that is a BOO compiler error, which is a completely different language from Unityscript. So my question is why does a Boo error return from a Unityscript? There's probably a really simple explanation like Unityscript doesn't actually compile and the Boo compiler is used for certain things regarding Unityscript files but I still thought it was a bit weird.
Your answer
Follow this Question
Related Questions
Got A error and dont know how to fix it 0 Answers
Compiler error while switching to android 1 Answer
Very odd but harmless error? *Not that urgent* 1 Answer
Boo.Lang.Compiler.CompilerError appears when using eval 0 Answers
MasterServer errors 1 Answer