GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feature Request: `+` operator should join non-string types if `.toString()` method exists · Issue #2991 · AssemblyScript/assemblyscript

Feature Request: + operator should join non-string types if .toString() method exists #2991

New issue
Copy link
New issue
Copy link
Open
Open
Feature Request: + operator should join non-string types if .toString() method exists#2991
Copy link
Labels
enhancement

Description

@JairusSW
JairusSW
opened on Mar 15, 2026
Issue body actions

Feature suggestion

I find it frustrating that both the left and right sides of a String.concat/+ operator cannot join, for example, string and i32.
In JavaScript, it

  1. Checks to see if the right side of the binary expression is a string
  2. If not, it then checks if the right side has a .toString(): string method
  3. If so, it calls it and concatenates left + right.toString()

Would be quite simple to implement. For example, this would probably work:

export class String {
  ...
  @operator("+")
  _concat<T>(left: string, right: T): string {
    if (!isDefined(right.toString())) ERROR(...);
    return this.concat(left, right.toString());
  }
}

Activity

  1. JairusSW
    added
    enhancement
    on Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.