divert target variables #48

Closed
opened 2019-03-28 01:17:51 +00:00 by NQNStudios · 4 comments
NQNStudios commented 2019-03-28 01:17:51 +00:00 (Migrated from github.com)

Right now it's not possible to divert to content dynamically. The quick and dirty solution would be to allow specifying a divert target via h-expression, but this would only allow storing a STRING divert target. The 'gotcha' here being that divert targets are scoped, and scope should be preserved, rather than forcing the dev to store fully qualified target strings.

Right now it's not possible to divert to content dynamically. The quick and dirty solution would be to allow specifying a divert target via h-expression, but this would only allow storing a STRING divert target. The 'gotcha' here being that divert targets are scoped, and scope should be preserved, rather than forcing the dev to store fully qualified target strings.
NQNStudios commented 2019-05-07 07:33:16 +00:00 (Migrated from github.com)

Maybe for this I can make another syntax extension to embedded haxe along the lines of what I've done with ,,, and ,. The syntax Ink uses for divert target variables is -> target, so if I enable something like target = ->target_name that gets transmuted into target = story.storyTree.resolveInScope(target_name) and make sure divert statement evaluation can tell the difference between a string target and a node target.

The more syntax extensions I make to hscript, the more appealing it becomes to fork it and start modifying the source instead of doing crude find-and-replacement as it currently is.

Maybe for this I can make another syntax extension to embedded haxe along the lines of what I've done with `,,,` and `,`. The syntax `Ink` uses for divert target variables is `-> target`, so if I enable something like `target = ->target_name` that gets transmuted into `target = story.storyTree.resolveInScope(target_name)` and make sure divert statement evaluation can tell the difference between a string target and a node target. The more syntax extensions I make to hscript, the more appealing it becomes to fork it and start modifying the source instead of doing crude find-and-replacement as it currently is.
NQNStudios commented 2019-05-13 02:57:52 +00:00 (Migrated from github.com)

potential problem with the -> syntax: -> is already part of Haxe function type syntax.

potential problem with the `->` syntax: `->` is already part of Haxe function type syntax.
NQNStudios commented 2019-05-14 04:40:40 +00:00 (Migrated from github.com)

I was starting to think I had hit bedrock on this (and other syntax extensions like #51) but just maybe operator overloading is the answer.

https://haxe.org/manual/types-abstract-operator-overloading.html
https://haxe.org/manual/types-numeric-operators.html#unary

I was starting to think I had hit bedrock on this (and other syntax extensions like #51) but just maybe operator overloading is the answer. https://haxe.org/manual/types-abstract-operator-overloading.html https://haxe.org/manual/types-numeric-operators.html#unary
NQNStudios commented 2019-05-14 04:45:26 +00:00 (Migrated from github.com)

Or even better: creating new operators, extending Interpreter, etc: 5ce4fbd74d/README.md (advanced-usage)

Or even better: creating new operators, extending Interpreter, etc: https://github.com/HaxeFoundation/hscript/blob/5ce4fbd74d8ac4c67c879dee9ac2a5aa54d10083/README.md#advanced-usage
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NQN/hank#48
No description provided.