question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disambiguate curly brace {interpolation}

See original GitHub issue

I believe that interpolation in Stylus could be improved if it made use of an extra character: perhaps as @{variable} or #{variable}, in order to distinguish an interpolation from a declaration / nested declaration / mixin definition / conditional statements etc. such as they would be written in CSS-style syntax, and would allow it to be used in other contexts more easily e.g. selectors or values. I’m specifically interested in the latter, as this was the way I had been using it in LESS (where @{variable} outputs in string form in the value).

So although I know we can use the sprintf operation for values, it would just be elegant if the @{interpolation} approach was simply adjusted so it worked everywhere, regardless of context. In my view it just needs to be kept separate from the other uses of curly braces, in order for this to be viable.

Anyway I’ve been super impressed with Stylus after first getting in to LESS–and finding that Stylus accomplishes nearly all of the shortcomings I ran in to with LESS; but was a little disappointed to find that interpolation had some limitations which seemed unnecessary and out of character with the rest of the language.

Issue Analytics

  • State:open
  • Created 11 years ago
  • Reactions:2
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

5reactions
kaisermanncommented, Oct 13, 2016

#{} 👍

2reactions
alvarozetinacommented, Aug 21, 2018

#{} 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Curly braces surrounding variable - perl - Stack Overflow
I have this piece of code that I'm trying to get my head around, I don't even know if its syntactically correct (part...
Read more >
What is the difference between quoted variable in curly brace ...
Both forms are used for string interpolation. You can omit the curly braces if the expression you're interpolating is just a simple variable...
Read more >
String template curly braces convention : r/Kotlin - Reddit
I understand that the curly braces help with disambiguation. What I don't understand is what value the absence of them provides aside from...
Read more >
Code interpolation in Raku strings
The interpolated code is placed between curly braces: ... One of the applications of this method is to help to disambiguate situations when...
Read more >
Expressions | Handlebars
In the below template, firstname is a variable that is enclosed by double curly braces, ... Disambiguating helpers calls and property lookup.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found