You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would remove the need of writing a custom loop manually concatenating each string and allow for better compiler optimisations, where the compiler could simply/stupidly optimise it down to the following:
base+base+base+base+base
In case the amount of repetitions becomes too large, the following method could be used instead to save up on file size (In JavaScript/TypeScript compatible environments):
base.repeat(5);
Exact behaviour / changes you want
Add support for arithmetic expressions between the type str and num.
Add compiler optimisations for the new type of string multiplication.
Add warning for useless string multiplications.
The text was updated successfully, but these errors were encountered:
Is there an existing proposal for this?
This feature does not exist in the latest version
Proposal
Add support for the Python-like syntax of multiplying strings a number of times.
For example:
This would remove the need of writing a custom loop manually concatenating each string and allow for better compiler optimisations, where the compiler could simply/stupidly optimise it down to the following:
In case the amount of repetitions becomes too large, the following method could be used instead to save up on file size (In JavaScript/TypeScript compatible environments):
Exact behaviour / changes you want
str
andnum
.The text was updated successfully, but these errors were encountered: