Import not importing?

Monkey Forums/Monkey Bug Reports/Import not importing?

Pharmhaus(Posted 2014) [#1]
Hi mark,

When I try to import one file from another folder I get a compilation error.
Strangely the files are imported, but they cannot be used anyway.
Example:
*Click*


ImmutableOctet(SKNG)(Posted 2014) [#2]
This is rather odd. But technically, you could just change those imports in 'modulea' and 'moduleb' to just import eachother normally. The whole "../MODULENAME/MODULENAME.monkey" thing shouldn't actually be needed in this situation.

What seems to be weird about this is that technically, it's importing the modules you specify in your strings (But possibly not as a proper module). The problem seems to be that it's not doing any work parsing it. This effect is similar to that of a native file. Well, whatever is causing this, it's definitely not a newer issue, this happens on my older version/backup of Monkey (V80(C)).

But wait a minute, is this even a bug? I mean, technically, string imports are usually used for native-language files. I could have sworn I saw import used like this for Monkey source, but it's possible this isn't actually normal. If I remember right the 'parser' module in 'trans' actually checks for string literals, then uses the 'ImportFile' method. And 'ImportFile' is for adding native files to a file import-list. From there, I honestly don't remember where the file list is used. All I remember is that it has the option to move supported files (Mojo does this for the default font). It doesn't seem to allow this for ".monkey" files, though (Which is expected).

Well, I could be missing something, but I think this is why you're having issues. If this actually wasn't a thing, it'd be pretty easy to patch in (Basically, just check if that's a valid file, and it has the "monkey" extension).


marksibly(Posted 2014) [#3]
Use unquoted imports, eg:

Import modulea
Import moduleb

Quoted imports are for importing target specific native data. It's up to the current target to do anything interesting with what you give it via quoted imports, but generally if the target doesn't now what to do with the import, it ignores it.