3 ms·
As an embeddable language, does MoonScript’s significant indentation cause any problems? I imagine it could be difficult to include MoonScript code inline with
by pansa2 7y ago
As an embeddable language, does MoonScript’s significant indentation cause any problems? I imagine it could be difficult to include MoonScript code inline with C code while preserving the indentation.
Is that so? Or is inline MoonScript code within C files not common?
- earenndil 7y agoI don't believe it's common to embed application scripting code within c source files, no.
- leafo 7y agoMy strategy is typically store MoonScript in separate files, then have build process that generates Lua and bundles that inside of whatever else. I wouldn't typically put it in a C file, but I might have the build system generate a hex encoded string as a header file. (This is actually how I build the MoonScript source into a single exe for Windows builds) I recommend doing the MoonScript compile time at program build time to avoid any unnecessary compilation during runtime.
- pansa2 7y agoThanks. I wonder if this would be any different if the VM executed MoonScript code directly, rather than first requiring translation to Lua. I’ve been thinking about the syntax of an embeddable language myself, and have ruled out significant indentation because of the difficulty of writing such code inline inside C files. If that’s not a common use case, maybe I should reconsider...
- leafo 7y agoThere is no MoonScript VM, if you use the "execute moonscript" function provided by the moonscript library it internally compiles the moon code to lua, loads the lua code, then runs the lua code. This means that MoonScript compiled ahead of time will have the same exact result as running it on the fly.