TriggerReactor

TriggerReactor

24.6k Downloads

Proposals: Allow inserting variable values into strings

Sayakie opened this issue ยท 2 comments

commented

While I am using various languages every day, it should be awesome if we could be insert any values into strings. Other languages support this proposal with the following syntax like:

Javascript

const someFeature = "An Awesome Feature"
console.log(`Proposal Approved: ${someFeature}`)  // Outputs: Proposal Approved: An Awesome Feature

Rust

let some_feature = "Another Awesome Feature";
println!("Proposal Approved: {some_feature}");  // Outputs: Proposal Approved: Another Awesome Feature

TriggerReactor in this proposal:

someFeature = "Insert values into strings"

#MESSAGE "Proposal Approved: {someFeature}"
commented

I think it would be great if we use ${} logic. We already parsing ${something} inside a string as $something(Placeholder), which is not that welcome-d (at least for me) because it cannot handle parameter and so the function is already fulfilled with "$something " ($+name+space)

So for me, changing ${} 's job from placeholder injector to code injector would be good option for next major (v4.0.0) update.

commented

Yeah, I think the interpreter(including lexer, and parser also) needs to be refactored, and we should do.