blitz-research / monkey

Blitz Research Monkey Source
224 stars 59 forks source link

MonkeyX Fails to compile if the file name contains spaces #90

Open phodgkinson opened 8 years ago

phodgkinson commented 8 years ago

Hi all,

I'm an IT Technician at a school/academy and I have been assisting our computer science teachers with an issue they have been having with their MonkeyX programs today.

We are using:


About Ted


Ted V1.25 (Monkey V84f; Trans V1.85; QT_VERSION 0x040804)

Copyright Blitz Research Ltd.

A simple editor/IDE for the Monkey programming language.

Please visit www.monkeycoder.co.nz for more information on Monkey.


OK


It appears, from looking into the issues that our computer science faculty have been having today that if there are spaces in the file name of the *.monkey file, then when this gets translated into C++ for compilation the spaces get inserted at various code points. This then makes an invalid C++ file which fails to compile.

I'm afraid that although I did have an example cpp file that demonstrated the issue I deleted it while resolving the issue. Hopefully as the issue is easily reproduced that won't be a problem.

Many thanks for your time

Peter

ImmutableOctet commented 8 years ago

This is by design, however, it is a long time oversight for the compiler.

Monkey 1 uses file names as module identifiers, and since modules can't have spaces in their identifier names, neither can the files.

With that said, however, the build file will still work if it has spaces in it, but it can't be properly referenced.

The best practice when creating modules is to use a name that is lowercase, and contains no spaces. With that said, the case of the file name only matters when writing classes with the same title.

For more information, visit the official documentation. (Mirror)