Hooks for inserting specific types differently #55

Closed
opened 2019-05-15 02:41:47 +00:00 by NQNStudios · 2 comments
NQNStudios commented 2019-05-15 02:41:47 +00:00 (Migrated from github.com)

Right now all h-expression values are passed to Std.string() but for Hankerchief and other Hank front-ends, it might make more sense to display different types differently. For example, if an h-expression returns a HaxeFlixel sprite, it might make sense to add the sprite to the world directly. This would enable devs to set up expressive syntax for things like sound effects and graphics, i.e.

You deftly pick the lock!
{sounds["click"]} {sprites["lock"]}
Right now all h-expression values are passed to `Std.string()` but for Hankerchief and other Hank front-ends, it might make more sense to display different types differently. For example, if an h-expression returns a HaxeFlixel sprite, it might make sense to add the sprite to the world directly. This would enable devs to set up expressive syntax for things like sound effects and graphics, i.e. ``` You deftly pick the lock! {sounds["click"]} {sprites["lock"]} ```
NQNStudios commented 2019-05-15 02:43:04 +00:00 (Migrated from github.com)

So I'm proposing an extensible hook system for h-expression outputs. A Map<Type, function> that is checked whenever something other than a string/int/etc. is produced.

So I'm proposing an extensible hook system for h-expression outputs. A Map<Type, function> that is checked whenever something other than a string/int/etc. is produced.
NQNStudios commented 2019-06-04 02:57:36 +00:00 (Migrated from github.com)

Type safety re: #60 might be a gotcha for this feature.

Type safety re: #60 might be a gotcha for this feature.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NQN/hank#55
No description provided.