Skip to content

Support Interpolated String Literals #256

@nikomatsakis

Description

@nikomatsakis

Support Interpolated String Literals

Status: In Progress

Current Understanding

Implement interpolated string literals in Dada, including both single and triple quoted variants with automatic dedenting for multiline strings.

Next Steps

  • Implement triple-quoted strings with three-quote delimiters
  • Ensure triple quotes are not parsed as empty string + quote
  • Handle embedded quotes without escaping
  • Implement string interpolation with brace syntax
  • Add lexer changes to recognize braces within strings
  • Track brace nesting for complex expressions
  • Update AST representation for interpolated strings
  • Add type checking for interpolation expressions

Open Questions

  • None currently - design decisions finalized in RFC-0001

Context

RFC-0001 drafted with design tenets: Do what I mean, Rust-like syntax, Simple escape hatch.
Key design decisions:

  • Interpolation is default behavior (no special syntax needed)
  • Brace syntax for interpolation (Rust-like approach)
  • Multiline strings auto-dedent when starting with newline
  • Backslash prefix disables all "magic" (dedenting, eventually interpolation)

Parser documentation completed. Escape sequence processing bug fixed - TokenText interned struct now stores processed literal content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-managedAI can update OP and add commentsfeatureNew featuretracking-issueOngoing work item with living documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions