facebook / starlark-rust

A Rust implementation of the Starlark language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for f-strings

Cictrone opened this issue · comments

Hey All!

I see in the changelog for 0.10.0 there is mention of adding support for f-strings so that

print(f"hello {}", value)

works as expected. However, when I tried to run this code I got the following error:

Caused by:
    error: Your Starlark dialect must enable f-strings to use them
      --> main:18:7
       |
    18 | print(f"hello {}", value)

I looked into the LibraryExtension options but could not find one for f-strings. I am compiling with 0.12.0. Is there any documentation on how to enable this feature/am I misunderstanding if its supported.

Thanks!

It is controlled by Dialect.enable_f_strings, not LibraryExtensions.

Just to cross reference it, I was confused with LibraryExtension vs Dialect as well #94 (comment) although I see no easy way to resolve the difficulty yet.

@stepancheg Thanks! Sorry for the bother.