Extremely Serious Bug in Monkey C!!!

Let's take such class:

class A
{
  hidden var myLocal = "Var from A";

  function do_localModyfication()
  {
    myLocal += " + some modyfication";
  }
}


Then write next class:

class B extends A
{
  // completely by accident 
  hidden var myLocal = "Var from B";

  function test()
  {
    do_localModyfication();
    System.println(myLocal);
  }
}


How do you think what you'll see in the log after B.test() call?

You will see: "Var from B + some modyfication" :confused::p !

And at the end imagine that you are using class for which you have no sources, like View or WatchFace. Please Garmin, tell me if I should pray that my var names are different than yours? Otherwise, your class and mine will explode!

This of course is a BIG BUG and we should only see: "Var from B"

I wonder why Garmin didn't decided to chose eg. C# which is free. Writing in C# if you build your program without warnings you can assume that it will work as intended. In my opinion Monkey C (Java like) it's probably not the best choice and may leads to unstable software.

Peter

  • Hello.

    I'm new here and I started a project with ConnectIQ and MonkeyC. What is the status of this thread?

    the most emergent concern we have is name collision with undocumented class or module variables

    I like quality and reliable code (and hate relying on debugging) so I'm trying to prepare my development by reading about what I should and what I should not do. I'm trying to avoid any "bad surprises"...

    That's why even if this "bug" is old, I would like to have a status update.

    I guess it has been "fixed" or at least, there is a standard way of avoiding name collisions

    Thank you !