Replies: 2 comments 5 replies
-
You can easily define a custom syntax that would give you this. If you define a custom syntax that starts with |
Beta Was this translation helpful? Give feedback.
4 replies
-
Would these custom interpolation formats need to be dynamic? Or compiled as Rust? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I've been developing a linux package manager for my thesis, and I want to use a scripting language to declare the packages. The PM is written in rust, so rhai seems like a good fit.
My idea was to declare packages a a rust type, let's say:
So what I want to do, is use the Pkg in string interpolation.
In this scenario,
bar_build_script
would be a string marked with metadata. The representation could be a map or a custom type.I have already implemented this in Lua. What I do, is to return a custom type
MetaText
, which is just a struct{ inner: String, dependencies: Vec<String> }
. You can see an example here: https://github.com/viperML/miq/blob/11ee2f42a9b5a55b8c77cee34cc30c6f1a41b983/pkgs/bootstrap.lua#L28-L52However this Lua implementation is very finnicky, as it relies on debug mode to inspect the surronding scope,.. and regex. So I thought maybe I can define some special syntax with rhai to get this kind of result.
Beta Was this translation helpful? Give feedback.
All reactions