-
-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script type & expression. #6702
Script type & expression. #6702
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick first impressions
609bac0
to
064f1ce
Compare
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
damnit i can never merge properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking very nice. This is a good candidate for a module. It should be able to go in org.skriptlang.skript.common.script.ScriptModule
. License headers can be removed too.
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor things. Looking good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good (approved)
6099204
into
SkriptLang:feature/script-reflection
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Create Script type. * Support script string/name conversion. * Script expression. * Add script lang entry. * Tests for script expression & names. * Support all scripts expression. * Script effects & tests. * Create dummy Script handle for disabled scripts. * Script reflection feature flag. * Restrict literal parsing to commands & parse. * Test feature flag for resolving name. * Split ExprScripts by feature to support disabled scripts. * Fix ExprName tests for new & old behaviour. * Add tests for disabled script handles. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Improve script loading/unloading safety. * Add feature check for script hotswapping. * Use expression stream. * Conformity for file names and proper loading safety. * Document validity & add condition support. * Add script is loaded condition + tests. * Some changes from code review. * More changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Clean up EffScriptFile and rename ExprScripts variations. * Finish code review changes. * Clean up script loader stuff. * Fix conflicts. * Suggested changes. * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Finished. --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Description
The first step towards supporting proper reflection & introspection: a type and object handles for scripts.
This adds:
script
type.Script
objects for disabled/unlinked scripts.[script] reflection
for most linked features & breaking changes.Validated
interface to be used by scripts and other resources that could become obsolete. This is purely a testing API right now.[the] [current] script
,[the] script[s] [named] %strings%
.name
property of scripts.name of script
did, e.g.scripts/folder/MyScript.sk
->folder/MyScript
.scripts/folder/MyScript.sk
->MyScript
.Script
dummy object for disabled scripts.enable skript "hello.sk"
skript
andscript
to be unhelpful and confusing, people might mistakereload skript ...
to mean reloading Skript, when it was actually for files.skript file ...
, orscript...
to make that clearer.Breaking Changes
The
enable|disable skript %string%
pattern variation was removed. You can still useskript file
orscript
.Resource safety has been significantly improved: there were basically zero checks on what you tried to reload/disable previously. If it wasn't a valid file it would throw huge exceptions, and if it was it would just get processed without any kind of safety checks.
scripts/
directory (unless you're running in Test mode!)With the experiment enabled, unloading is now considered different from disabling in syntax: disabling a script will unload it and prepend
-
to its file name. Unloading it will just unload it from memory (but not disable it, so it would load normally upon next restart).Where Next?
This could be the start of some reflection.
I'd like to see a bit of introspection in the future (maybe looking at what structures are in a script, some features from Config, etc.)
There was some discussion about some other reflective stuff (like dynamic function calls) which would probably tie into this quite nicely. I've opened a branch for anybody who wants it.
This could move in the direction of runtime-parsed scripts, anonymous scripts, etc.
I'm also wondering about abstracting some kind of loadable interface (or maybe just use Config) so that we can permit the [re]loading of other Skript-related things that can be loaded (aliases, config, etc.)
I don't have any plans for the loading of non-script-provided files (e.g. a user-provided config
.sk
file) at this point, but if I abstracted this back a layer then it would be really easy (for an addon) to provide that in the future if somebody wants to.Target Minecraft Versions: any
Requirements: none
Related Issues: none