COMMUNITY

Bare package declaration?

I posted a question to stackoverflow, and thought it would be useful to mention it here: https://stackoverflow.com/questions/61995475/what-is-the-purpose-of-a-bare-package-declaration-and-what-does-it-do

Incidentally, I wonder if there’s a way to automatically get a forum post here any time a Haxe question is asked over at SO.

Posting questions at SO gives Haxe some more visibility, but I don’t visit there very often.

(edited s/SA/SO/, thanks)

What’s SA? Stack Averflow? Stack Axchange? :slight_smile:

1 Like

I answered on stackoverflow: https://stackoverflow.com/a/62018312/508029

package; communicates that you are so-called “top-level”, that means, you are not actually in a package.
You can leave it out, so this will work too:

class Main {
   //...
}

If you are in a package, it is required to define the type path at the top of the file, eg. package >foo.bar; (where foo.bar is a folder foo/bar in a source path, defined by -src )

More info https://haxe.org/manual/type-system-modules-and-paths.html

1 Like

Ah, thanks!