Skip to content

String concatenation in const-evaluation expressions #57

@theCapypara

Description

@theCapypara

Summary

Allows strings to be concatenated in const-evaluation expressions

Dependencies

This needs the following features to be implemented first:

Motivation

This allows for meta programming with strings.

Examples

const XYZ = "Hello " + CONST + ", how are you";

Language Changes

Parser and Lexer Changes

Depends on how arithmetic expressions in const-evaluation expressions have been implemented.

Behaviour

Adds a new expression with the same syntax as arithmetic integer expressions. If the first part of the expression is a string (or a constant coercing to a string) then this new expression applies.
The result of the expression is a string where all strings in it are combined into one. The combining operator is "+". Any integers or decimals as part of the expression are converted into their string representations. Constants and variables are evaluated before concatenations. As always any part of the expression can be a sub-expression.

Compiler Implementation

Compiler Interface Changes

None

Decompiler Changes

None

How to teach

Add to manual on meta programming

Alternatives

/

Backwards compatibility

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions