Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Javascript(Unityscript) returning Boo compiler error

$
0
0
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.

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>