Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String concatenation in const-evaluation expressions #57

Open
theCapypara opened this issue Jul 6, 2024 · 0 comments
Open

String concatenation in const-evaluation expressions #57

theCapypara opened this issue Jul 6, 2024 · 0 comments

Comments

@theCapypara
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant