IMPLEMENTING EXTENSION METHODS AND GENERIC METHODS IN GO PROGRAMMING LANGUAGE DIALECT
DOI:
https://doi.org/10.34185/1562-9945-2-163-2026-10Keywords:
Go, compilation, transpilation, programming, programming language, method, function, extension, information technology, algorithmAbstract
This paper explores the implementation of extension methods in GoNext, a dialect of the Go programming language that transpiles into standard Go code. Go is a statically compiled language with a lightweight runtime, excellent concurrency support, fast compilation, and a large ecosystem, but it also has a relatively simple type system that does not allow defining methods on types outside the package where they are declared. Extension methods address this limitation by allowing developers to add methods to existing types – including those defined in third-party libraries or the Go standard library – without modifying their source code. The authors review how extension methods are implemented in other mainstream pro-gramming languages (C#, Swift, Kotlin, Rust, Scala) and compare them with the related con-cept of uniform function call syntax, then propose a GoNext-specific approach: extension functions are declared using a new extension keyword before a regular function declaration and are transpiled into ordinary free functions by simply removing that keyword, while call sites are rewritten from method-call syntax (value.Method(params)) into explicit function calls (package.Method(value, params)) using a resolution algorithm based on Go's type unifi-cation rules. The paper also describes an import extension modifier that allows treating all functions in an existing Go package as extension methods without adding unnecessary wrap-pers. The proposed approach is demonstrated on a complete example showing how chained extension method calls are transformed into nested function calls during transpilation. The paper demonstrates that this approach achieves zero runtime overhead, maintains full two-way interoperability with standard Go, and – as an additional benefit – enables support for generic methods, a feature intentionally omitted from Go due to unresolved questions around existing interfaces implementation. The proposed mechanism leverages transpilation as a practical strategy for extending a language's capabilities while reusing its existing compiler and runtime infrastructure.
References
Wimmer C., Würthinger T. Truffle: a self-optimizing runtime system: Proceedings of the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity (SPLASH'12), 2012. P. 13–14. DOI: 10.1145/2384716.2384723.
Lattner C., Adve V. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation: Proceedings of the International Symposium on Code Generation and Opti-mization (CGO'04), 2004. P. 75–86. DOI: 10.1109/CGO.2004.1281665.
Bastidas Fuertes A., Pérez M., Meza Hormaza J. Transpilers: A Systematic Mapping Re-view of Their Usage in Research and Industry. Applied Sciences. 2023. V. 13, No. 6. Article 3667. DOI: 10.3390/app13063667.
Cox R., Griesemer R., Pike R., Taylor I. L., Thompson K. The Go programming language and environment. Communications of the ACM. 2022. V. 65, No. 5. P. 70–78. DOI: 10.1145/3488716.
Forkert P. P., Sydorova M. G. ADVANTAGES OF GOLANG AS A FOUNDATION FOR NEW PROGRAMMING LANGUAGES: Conference materials of the XХІ international sci-entific and practical conference «MATHEMATICS AND SOFTWARE FOR INTELLIGENT SYSTEMS (MPZIS-2023)», Dnipro, November 22-24, 2023. P. 7–8.
Forkert P. P., Sydorova M. G. CHALLENGES OF USING GOLANG AS A FOUNDATION FOR NEW PROGRAMMING LANGUAGES: Conference materials of the VI All-Ukrainian scientific and practical internet-conference of young scholars and higher education applicants «Modern informational systems and technologies » on the topic: «Mod-ern computer systems and networks in management », Khmelnytskyi, November 30, 2023. P. 55–56.
Forkert P. P., Sydorova M. G. Integrating full-featured enums into Go programming lan-guage. Current problems of automation and information technologies. 2023. V.27. P. 3-16. DOI: 10.15421/432301.
Forkert P. P., Sydorova M. G. IMPROVING ENUMS IN GO PROGRAMMING LANGUAGE DIALECT: Conference materials of the VI international scientific and practical conference of young scholars and students «SOFTWARE ENGINEERING AND ADVANCED INFORMATION TECHNOLOGIES (SOFT TECH-2024)», Kyiv, May 21-23, 2024. P. 148-150
Bierman G. M., Meijer E., Torgersen M. Lost in translation: formalizing proposed exten-sions to C#: Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'07), Montreal, 2007. P. 479–498. DOI: 10.1145/1297027.1297063.
Extensions | Documentation. URL: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/extensions#Extension-Syntax (date of access: 10.01.2026).
Extensions | Kotlin Documentation. URL: https://kotlinlang.org/docs/extensions.html (date of access: 10.01.2026).
Defining Shared Behavior with Traits – The Rust Programming Language. URL: https://doc.rust-lang.org/book/ch10-02-traits.html (date of access: 10.01.2026).
Extension Methods. URL: https://docs.scala-lang.org/scala3/reference/contextual/extension-methods.html (date of access: 10.01.2026).
Křikava F., Miller H., Vitek J. Scala implicits are everywhere: a large-scale study of the use of Scala implicits in the wild: Proceedings of the ACM on Programming Languages. 2019. V. 3, OOPSLA. Article 163. DOI: 10.1145/3360589.
Bright W., Alexandrescu A., Parker M. Origins of the D programming language: Pro-ceedings of the ACM on Programming Languages. 2020. V. 4, HOPL. Article 73. DOI: 10.1145/3386323.
Forkert P.P, Ivanchenko M.G. Uniform function call syntax in Go programming language dialect. Conference materials of the ІV international scientific and practical conference «INFORMATION TECHNOLOGIES IN EDUCATION AND SCIENCE», Zaporizhzhia, May 20, 2025. P. 561-565
The Go Programming Language Specification. URL: https://go.dev/ref/spec (date of ac-cess: 10.01.2026).
Griesemer, Robert, et al. Featherweight Go: Proceedings of the ACM on Programming Languages 4. OOPSLA, 2020. C. 1–29. DOI: 10.1145/3428217.
Type Parameters Proposal. URL: https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#No-parameterized-methods (date of access: 10.01.2026).
Downloads
Published
Issue
Section
License
Copyright (c) 2026 System technologies

This work is licensed under a Creative Commons Attribution 4.0 International License.









