Показати скорочену інформацію

dc.contributor.authorPozur, М.en
dc.contributor.authorVoitko, V.en
dc.contributor.authorBevz, S.en
dc.contributor.authorBurbelo, S.en
dc.contributor.authorKosaruk, О.en
dc.contributor.authorПозур, М.uk
dc.contributor.authorВойтко, В.uk
dc.contributor.authorБевз, С.uk
dc.contributor.authorБурбело, С.uk
dc.contributor.authorКосарук, О.uk
dc.date.accessioned2025-12-26T08:05:50Z
dc.date.available2025-12-26T08:05:50Z
dc.date.issued2025
dc.identifier.citationPozur M., Voitko V., Bevz S., Burbelo S., Kosaruk O. Implementing traits in C# using Roslyn Source Generators // Informatyka, Automatyka, Pomiary W Gospodarce I Ochronie Środowiska. 2025. № 15 (4). Р. 151–157. URI: https://ph.pollub.pl/index.php/iapgos/article/view/8488.en
dc.identifier.issn2083-0157
dc.identifier.urihttps://ir.lib.vntu.edu.ua//handle/123456789/50337
dc.description.abstractArtykuł przedstawia podejście do implementacji funkcjonalności cech w języku programowania C# poprzez wykorzystanie Roslyn Source Generators, narzędzia do metaprogramowania w czasie kompilacji wprowadzonego w .NET5. Traity, które są komponowalnymi jednostkami drobnoziarnistego ponownego użycia, mogą przynieść korzyści językowi C# poprzez wprowadzenie mechanizmu ponownego użycia zachowania w kontekście pojedynczego dziedziczenia. W artykule opisano projekt i implementację generatora źródłowego, który umożliwia dodawanie adnotacji do klas za pomocą atrybutów metadanych, automatycznie wstrzykując odpowiednie definicje elementów członkowskich w czasie kompilacji. Aby osiągnąć lepszą wydajność generowania kodu w czasie projektowania, zastosowano przyrostowe generatory źródeł. Szczegółowo opisano skład członków cech, koncentrując się na rozwiązywaniu konfliktów nazw i bezpieczeństwie typów poprzez wykorzystanie interfejsów i mechanizmu zastępowania. Omówiono i zaimplementowano również definiowanie niepublicznych członków w kontekście cechy, co pozwala na lepsze ponowne wykorzystanie kodu. Artykuł podsumowuje, że funkcje na poziomie języka, takie jak cechy, można zaimplementować w języku C# za pomocą Roslyn Source Generators, demonstrując w ten sposób potencjał takiego narzędzia i ogólnie metaprogramowania.pl
dc.description.abstractThe paper presents an approach to implementing traits functionality in the C# programming language through the use of Roslyn Source Generators, a compile-time metaprogramming tool introduced in .NET5. Traits, which are composable units of fine-grained reuse, can benefit the C# language by bringing a mechanism for behavior reuse in the context of single inheritance. The article describes the design and implementation of a source generator that allows to annotate classes with metadata attributes, automatically injecting the corresponding member definitions at compile time. To achieve better code generation performance at design time, Incremental Source Generators were used. The composition of trait members is described in detail, focusing on name conflict resolution and type safety by utilizing interfaces and the override mechanism. Defining non-public members in a context of a trait is also discussed and implemented, thus allowing for better code reusability. The article concludes that language-level features such as traits can be implemented in the C# language by using Roslyn Source Generators, thus demonstrating the potential of such an instrument and metaprogramming in general.en
dc.language.isoen_USen_US
dc.publisherPolitechnika Lubelskapl
dc.relation.ispartofInformatyka, Automatyka, Pomiary W Gospodarce I Ochronie Środowiska. № 15 (4) : 151–157.pl
dc.subjectC#en
dc.subjecttraitsen
dc.subjectobject-oriented programmingen
dc.subjectmetaprogrammingen
dc.subjectcode generationen
dc.subjectprogramowanie obiektowepl
dc.subjectmetaprogramowaniepl
dc.subjectgenerowanie kodupl
dc.titleImplementing traits in C# using Roslyn Source Generatorspl
dc.title.alternativeImplementacja cech w języku C# przy użyciu roslyn source generatorspl
dc.typeArticle, Scopus-WoS
dc.typeArticle
dc.identifier.doihttp://doi.org/10.35784/iapgos.8488
dc.identifier.orcidhttps://orcid.org/0009-0003-5225-2453
dc.identifier.orcidhttps://orcid.org/0000-0002-3329-7256
dc.identifier.orcidhttps://orcid.org/0000-0002-4651-2453
dc.identifier.orcidhttps://orcid.org/0000-0002-8554-2292
dc.identifier.orcidhttps://orcid.org/0000-0003-1346-2944


Файли в цьому документі

Thumbnail

Даний документ включений в наступну(і) колекцію(ї)

Показати скорочену інформацію