This document exists to describe a proposal for enhancing the fastn
language. This is a Request For Comment. Please share your comments by posting them in the pull request for this RFC if this RFC is not merged yet. If the RFC is merged, you can post comment on our official Discord, or open a discussion on Github.
rfc
.Jack
is stored in a variable, $name
, currently we have to either write a function to concatenate Hello,
and $name
to form the string, or place two ftd.text
nodes, wrapped in a ftd.row
. Neither is very nice. So we are proposing variable interpolation, which allows easy generation of such strings with data embedded in it.$var
access in StringsAny string can now refer to any variable using the $<var-name>
syntax, so e.g., we can write Hello, $name
, and it will expand into Hello, Jack
is $name
is Jack
.
$<var-name>
, we initialise string to it.fastn
language, formula re-evalutes it’s value whenever the underlying variable changes. This means if the variable used in any string interpolation changes, the string will automatically change as well.$ curly
syntaxThe total is \$${ count * price }.
-- ftd.text: The total is ${ count * price }
Sometimes we want to show literally Hello, $name
, in this case the author can write Hello, \$name
, escape the special handling by putting a \
in front of $
.
$<var-name>
: $<var-name>
$<var-name>
for a string. The behaviour described here generalises this.Have a question or need help?
Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.
Join our Discord channel and share your thoughts, suggestion, question etc.
Connect with our community!We welcome you to join our Discord community today.
We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.