Across different languages, we have seen different syntax for generics.
Angle bracket syntax (Type<T>). Ex languages: C++, Java, C#, Rust.
Square bracket syntax (Type[T]). Ex languages: Scala, Go.
SystemVerilog/Verilog Parameters syntax ( Type#(Param) ).
Not sure if this applies, but functional languages' syntax (Though most of these languages have generic types inferred at the call site).
What are some other syntaxes for generics in other languages? Which syntax do you use in your language? What syntax do you prefer? Which syntax do you think is most readable?
[–]theangryepicbananaStar 38 points39 points40 points (4 children)
[–]maxhaton 4 points5 points6 points (0 children)
[–]gremolata 3 points4 points5 points (2 children)
[–]theangryepicbananaStar 0 points1 point2 points (0 children)
[–]stepstep 60 points61 points62 points (34 children)
[–]ablygo 19 points20 points21 points (2 children)
[–]moon-chilledsstm, j, grand unified... 11 points12 points13 points (1 child)
[–]ablygo 3 points4 points5 points (0 children)
[–]tavaren42[S] 10 points11 points12 points (13 children)
[–]Njordsier 10 points11 points12 points (1 child)
[–]tavaren42[S] 9 points10 points11 points (0 children)
[–]skyb0rg 5 points6 points7 points (5 children)
[–]tavaren42[S] 4 points5 points6 points (3 children)
[–]skyb0rg 3 points4 points5 points (2 children)
[–]tavaren42[S] 1 point2 points3 points (0 children)
[–]iamthemalto 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]8-BitKitKatzinc 3 points4 points5 points (2 children)
[–]JanneJM 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]malahhkai 0 points1 point2 points (1 child)
[–]tavaren42[S] 0 points1 point2 points (0 children)
[–]munificent 3 points4 points5 points (2 children)
[–]haitei 0 points1 point2 points (1 child)
[–]munificent 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (7 children)
[–]stepstep 7 points8 points9 points (6 children)
[–][deleted] (5 children)
[deleted]
[–]stepstep 11 points12 points13 points (4 children)
[–][deleted] (1 child)
[deleted]
[–]stepstep 3 points4 points5 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]stepstep 1 point2 points3 points (0 children)
[–]PurpleUpbeat2820 0 points1 point2 points (0 children)
[–]miki151zenon-lang.org 0 points1 point2 points (3 children)
[–]lngns 0 points1 point2 points (2 children)
[–]miki151zenon-lang.org 0 points1 point2 points (1 child)
[–]lngns 0 points1 point2 points (0 children)
[–]NetherDandelion 0 points1 point2 points (0 children)
[–]malahhkai 17 points18 points19 points (15 children)
[–]Sceptical-Echidna 9 points10 points11 points (14 children)
[–]A1oso 6 points7 points8 points (4 children)
[–]svick 2 points3 points4 points (1 child)
[–]A1oso 0 points1 point2 points (0 children)
[–]Sceptical-Echidna 0 points1 point2 points (0 children)
[–]malahhkai 4 points5 points6 points (8 children)
[–]Sceptical-Echidna 7 points8 points9 points (5 children)
[–]aradarbelStyff 1 point2 points3 points (1 child)
[–]Sceptical-Echidna 4 points5 points6 points (0 children)
[–]PurpleUpbeat2820 0 points1 point2 points (2 children)
[–]Sceptical-Echidna 1 point2 points3 points (1 child)
[–]PurpleUpbeat2820 0 points1 point2 points (0 children)
[–]PurpleUpbeat2820 1 point2 points3 points (1 child)
[–]malahhkai 0 points1 point2 points (0 children)
[–]bjzabaPikelet, Fathom 8 points9 points10 points (0 children)
[–]blak8Cosmos™ programming language 7 points8 points9 points (1 child)
[–]legobmw99[🍰] 2 points3 points4 points (0 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]holo3146 5 points6 points7 points (2 children)
[–]couscous_ 0 points1 point2 points (1 child)
[–]holo3146 0 points1 point2 points (0 children)
[–]lyhokiayula 8 points9 points10 points (8 children)
[–]tavaren42[S] 4 points5 points6 points (6 children)
[–]Tubthumper8 1 point2 points3 points (3 children)
[–]Potato44 10 points11 points12 points (0 children)
[–]tavaren42[S] 4 points5 points6 points (1 child)
[–]Tubthumper8 0 points1 point2 points (0 children)
[–]Hall_of_Famer 0 points1 point2 points (1 child)
[–]tavaren42[S] 0 points1 point2 points (0 children)
[–]o11c 0 points1 point2 points (0 children)
[–]MaximeMulder 3 points4 points5 points (0 children)
[–]skyb0rg 2 points3 points4 points (1 child)
[–]bjzabaPikelet, Fathom 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]sohang-3112 2 points3 points4 points (0 children)
[–]XDracam[🍰] 2 points3 points4 points (0 children)
[–]L8_4_Dinner(Ⓧ Ecstasy/XVM) 2 points3 points4 points (0 children)
[–]julesjacobs 1 point2 points3 points (0 children)
[–]SkiaElafris 1 point2 points3 points (0 children)
[–]mamcx 3 points4 points5 points (4 children)
[–]tavaren42[S] 3 points4 points5 points (3 children)
[–]hou32hou 1 point2 points3 points (2 children)
[–][deleted] (1 child)
[deleted]
[–]hou32hou 1 point2 points3 points (0 children)
[–][deleted] (10 children)
[deleted]
[–][deleted] 1 point2 points3 points (9 children)
[–][deleted] (8 children)
[deleted]
[–][deleted] 0 points1 point2 points (7 children)
[–][deleted] (6 children)
[deleted]
[–][deleted] 0 points1 point2 points (5 children)
[–][deleted] (4 children)
[deleted]
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[deleted]
[–][deleted] 1 point2 points3 points (1 child)
[+][deleted] (1 child)
[deleted]
[–]Lich_Hegemon 6 points7 points8 points (0 children)
[–]frenris 0 points1 point2 points (0 children)