I would assume so. The reason is that when you don't use print, it tries to print just $char and not the whole expression. However, $char isn't exactly something that can be printed in the first place, so you end up with an empty space instead.
It was previously deliberate, but I made that decision during development when it still used the JS dot-property notation. After release I decided that since it was unpleasantly unexpected to have, say, "$variable's on the run" in passage prose be treated as a property access, it shouldn't be usable in that context.
(Having $variable be treated specially in passage prose is kind of a dice-game with legibility in itself, based entirely on the understanding that the $ sigil opens a variable name and a non-letter-non-numeric character terminates it.)
Right yes. It makes sense to me. I feel like (while it is somewhat of a dice-game) people are reasonably used to mentioning $variables in text. I agree that $variable's a bit tricky.
It would possibly be nice to have a shorter, documented* equivalent of (print:) so that, as in Twine 1, one could mention <<$variable>>s in words quickly, and (print:$variable's property) without being so verbose ( and imperative ) ... that's not high priority though. Mostly I just wanted to know how I should be planning to write things from now on.
(* I say 'documented' because at one point, [single brackets] without a <hook tag| seemed to force evaluation, but it wasn't entirely reliable and I'm pretty sure I was a terrible person for trying to take advantage of it)
as in Twine 1, one could mention <<$variable>>s in words quickly
Technically <<$variable>> was/is the short form of the <<display "passage_name">> macro and not the <<print>> macro, it just happened that if <<$variable>> failed to find the passage it was asked to display then it evaluated/printed out the value of whatever was passed to the macro.
Technically <<$variable>> was/is the short form of the <<display "passage_name">> macro and not the <<print>> macro, it just happened that if <<$variable>> failed to find the passage it was asked to display then it evaluated/printed out the value of whatever was passed to the macro.
That has never been true (even from the first commit). The <<$variable>> shorthand form never checks the $variable's value against passage names (the macro processor never looks up the value, period). The order of operations is: [list type=decimal] If the first word of the macro invocation is a valid macro name, then the macro is invoked. Else if the first character is a dollar sign '$', then it's assumed you're trying to print a $variable and <<print>> is invoked. Else if the first word is a valid passage name, then it's assumed you're trying to display a passage and <<display>> is invoked. Else, then an error is rendered for the user.
Comments
I suppose the print-required syntax for the above would be which does seem more readable to me.
(Having $variable be treated specially in passage prose is kind of a dice-game with legibility in itself, based entirely on the understanding that the $ sigil opens a variable name and a non-letter-non-numeric character terminates it.)
$variables
in text. I agree that$variable's
a bit tricky.It would possibly be nice to have a shorter, documented* equivalent of
(print:)
so that, as in Twine 1, one could mention<<$variable>>
s in words quickly, and(print:$variable's property)
without being so verbose ( and imperative ) ... that's not high priority though. Mostly I just wanted to know how I should be planning to write things from now on.(* I say 'documented' because at one point,
[single brackets]
without a<hook tag|
seemed to force evaluation, but it wasn't entirely reliable and I'm pretty sure I was a terrible person for trying to take advantage of it)Technically <<$variable>> was/is the short form of the <<display "passage_name">> macro and not the <<print>> macro, it just happened that if <<$variable>> failed to find the passage it was asked to display then it evaluated/printed out the value of whatever was passed to the macro.
It has been pointed out that I was incorrect.
(I actually didn't know that. I thought I had to type out 'display' in twine1. *facepalm*)
That has never been true (even from the first commit). The
<<$variable>>
shorthand form never checks the $variable's value against passage names (the macro processor never looks up the value, period). The order of operations is:[list type=decimal]
If the first word of the macro invocation is a valid macro name, then the macro is invoked.
Else if the first character is a dollar sign '
$
', then it's assumed you're trying to print a $variable and <<print>> is invoked.Else if the first word is a valid passage name, then it's assumed you're trying to display a passage and <<display>> is invoked.
Else, then an error is rendered for the user.