Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Compiletime scripts #43

Open
Adrodoc opened this issue Jul 1, 2016 · 2 comments
Open

Compiletime scripts #43

Adrodoc opened this issue Jul 1, 2016 · 2 comments

Comments

@Adrodoc
Copy link
Owner

Adrodoc commented Jul 1, 2016

Expanding on the idea of #25 it would be cool to enable embedded scripts that generate parts of the MPL program. This would require MPL to package a full language Interpreter.
Because MPL is written in Java, embedded groovy scripts are a good option.
An embedded script could look like this:

/say normal MPL code
compiletime {
  for (i in 1..10) {
    println "/generated line ${i}"
  }
}

Instead of the keyword compiletime we could use embedded or groovy.
For security reasons it is important to restrict embedded scripts from accessing the file system or internet.

@Adrodoc Adrodoc added this to the v2.0 milestone Jul 1, 2016
@Adrodoc Adrodoc mentioned this issue Jul 1, 2016
Adrodoc added a commit that referenced this issue Jul 1, 2016
…t and import restriction to java.lang.* and java.util.*
@Adrodoc
Copy link
Owner Author

Adrodoc commented Jul 1, 2016

Alternative syntax used in d490da5:

compiletime {
  for (i in 1..10) {
    mpl << "/generated line ${i}"
  }
}

Adrodoc added a commit that referenced this issue Jul 3, 2016
…t and import restriction to java.lang.* and java.util.*
@BrainStone
Copy link
Contributor

I would suggest using lua instead.

First of all the syntax is quite easy and you still can to pretty much everything you can with groovy and second the library is tiny compared with the groovy library.

@Adrodoc Adrodoc modified the milestone: v2.0 Mar 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants