並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 51件

新着順 人気順

genericsの検索結果1 - 40 件 / 51件

genericsに関するエントリは51件あります。 golanggoprogramming などが関連タグです。 人気エントリには 『今時のPythonはこう書く2020 - Qiita』などがあります。
  • 今時のPythonはこう書く2020 - Qiita

    はじめに システム作ってるとかライブラリ作ってるみたいなある程度Pythonを綺麗に1書くことが求められる方々に向けた記事です。 (機械学習系のライブラリを使うためにPython書いてる方とか、初学者の方にはちょっとあわないかも知れません) 綺麗に書くための作法の難しさって共有が面倒なところだと思うんですよね。その書き方は間違いじゃない、間違いじゃないけどもっといい書き方があるぞみたいなやつってなかなか指摘し辛いですし、じゃあ1人に対してレビューしたら他のメンバーにはどう伝える?そもそも伝える必要?俺の工数は?みたいになりがちです。 一番いいのはこういう時はこう書く!みたいなドキュメントを作って「ドキュメント違反です」ってレビューをしてあげることなんですが、まーそれもそれで超面倒じゃないですか。なのでこの記事がそのドキュメントの代わり、とまではいかなくとも礎くらいになればいいなと思って書き

      今時のPythonはこう書く2020 - Qiita
    • Effective TypeScript › The Golden Rule of Generics

      The New TypeScript Handbook has some real gems in it. Here's what it has to say about generics: Writing generic functions is fun, and it can be easy to get carried away with type parameters. Having too many type parameters or using constraints where they aren't needed can make inference less successful, frustrating callers of your function. It goes on to offer a few specific pieces of advice about

        Effective TypeScript › The Golden Rule of Generics
      • Go言語のジェネリクス入門

        Go1.18は2022年3月にリリースされました。このリリースはGo言語へのジェネリクスの実装を含んでいます。 この記事ではできるだけ最新の仕様と用語法にもとづいてジェネリクスの言語仕様について解説していきます。 更新履歴 2024/01/03: Go1.21(2023-08-08)でcmpパッケージが標準ライブラリに追加されたことに対応しました。 2023/02/23: Go1.20(2023-02-01)のcomparableの仕様変更に対応しました。 次の関連資料があります: The Go Blog - All your comparable types Griesemer氏によるGo公式ブログです。 Go言語のBasic Interfaceはcomparableを満たすようになる(でも実装するようにはならない) 上記の内容に対する筆者の解説記事です。Go1.20リリース前に書いたの

          Go言語のジェネリクス入門
        • Go言語がGenericsを導入、過去最大の変更となる「Go 1.18」正式版リリース

          Googleが中心となってオープンソースで開発されているGo言語の最新版となる「Go 1.18」正式版がリリースされました。 Go go1.18 is released! Release notes: https://t.co/UFumhMjcOL Download: https://t.co/fnDCVVhJXK#golang pic.twitter.com/uWNSy5V7nv — Go (@golang) March 15, 2022 ブログ「Go 1.18 is released!」によると、Go 1.18は、「massive release that includes new features, performance improvements, and our biggest change ever to the language.」(新機能、性能改善、そして過去最大の変更の変

            Go言語がGenericsを導入、過去最大の変更となる「Go 1.18」正式版リリース
          • Golang GenericsでREST APIを作る - Nature Engineering Blog

            Go 1.18が出てしばらく経ちました。みなさんGenerics使っていますか? @maaashです。 これは Nature Engineering Blog祭 の2日目の記事です。 祭り 最初は歓喜し、mapやfilter的なfor文を少しずつgithub.com/samber/loに切り替えたり、 internalなsliceパッケージを作ってみたり。 ですが心のどこかで欲求不満が蓄積されていくのを感じていました。 使い尽くしていないのでその真価が理解できていなくて物足りないような、 こんなに面白いおもちゃが与えられたのに遊び尽くしていないような感覚です。 Genericsを使ったコードを書きたい!と思いながら日々の業務でREST APIを書いていると、、 あれ、これはかの When To Use Genericsの結論にある: If you find yourself writing

              Golang GenericsでREST APIを作る - Nature Engineering Blog
            • Go: A Documentary

              Go: A Documentary by Changkun Ou <changkun.de> (and many inputs from contributors) This document collects many interesting (publicly observable) issues, discussions, proposals, CLs, and talks from the Go development process, which intends to offer a comprehensive reference of the Go history. Disclaimer Most of the texts are written as subjective understanding based on public sources Factual and ty

              • Go 言語にやってくる Generics は我々に何をもたらすのか

                2021 年リリース予定の Go 1.17 に、多くの皆さんが待ち望んでいた Generics が導入される予定です。Go が Generics を採用したプロセス、C++ や Java の Generics とどの様に違うのか、また Go の Generics はどの様に使えるのかをご紹介します。

                  Go 言語にやってくる Generics は我々に何をもたらすのか
                • TypeScript: <T>の書く位置チートシート - Qiita

                  この投稿はTypeScriptのジェネリクスの型変数(type parameter)をどこに書くのかのチートシートです。 <T>の書く位置まとめ 関数宣言 関数式 アロー関数 メソッド宣言 関数型 コンストラクタ型 関数シグネチャ コンストラクタシグネチャ: 引数リスト()の直前 クラス宣言 インターフェース宣言 型エイリアス: 識別子の直後 <T>の書く位置チートシート 関数宣言

                    TypeScript: <T>の書く位置チートシート - Qiita
                  • 2021年版Pythonの型ヒントの書き方 (for Python 3.9) | フューチャー技術ブログ

                    Pythonに型ヒントが入ってからしばらく経ちます。型ヒントの立ち位置も、なんでもできるアノテーションとして導入されましたが、型ヒント以外の用途はあまり育たず、型ヒントが中心になり、PEPや仕様もそれに合わせて変化したり、より書きやすいように機能が追加されてきました。 本エントリーでは、Python 3.9時点での最新情報を元に、現在サポート中のPythonバージョン(3.6以上)との互換性の情報も織り交ぜながら、最新の型ヒントの書き方を紹介します。 本エントリーの執筆には、Pythonの型の有識者の@moriyoshi、@aodag、@tk0miya にアドバイスをもらいました。ありがとうございます。 環境構築Visual Studio CodeVisual Studio Codeの場合は、事前にどのインタプリタを利用するかを設定しておきます。その環境にインストールします。venvを使う

                      2021年版Pythonの型ヒントの書き方 (for Python 3.9) | フューチャー技術ブログ
                    • Golang の Generics で使いたいものは大体 samber/lo にあった話 - Qiita

                      はじめに 本記事は Go Advent Calendar 2022 の18日目の記事です。 Generics を使った関数でやりたかったことが、samber/lo に大体揃ってたという話をします。 すでに自前で書いてた関数もいくつかあったのですが、このライブラリを知り置き換えていったという体験談です。 ※結果的に「samber/lo のなかでこの辺り使えるかも」というものを私の独断と偏見でピックアップする記事になってます。 samber/lo とは samber/lo は 16日目のアベンドカレンダーの記事 でも取り上げられていまして、そこから説明を引用させていただきました。 samber/loは,多種多様な便利関数を提供するパッケージです。 JavaScriptのライブラリのLodashライクであるとREADMEにも記載があります。 個人的には大好きなパッケージでして,Map,Filte

                        Golang の Generics で使いたいものは大体 samber/lo にあった話 - Qiita
                      • 部分型における変性と極性 - なぜScalaの変性は+や-で指定するのか - 貳佰伍拾陸夜日記

                        この記事はScala Advent Calendar 2022の19日目です. Scalaではジェネリック型の変性(variance)は+や-で指定しますが, 他の言語(たとえば, C#, Kotlin)ではoutやinだったりします. この記事では変性の意味を整理して, なぜScalaでは+/-の記号を使うのか説明します. 追記ただし, ここで説明している内容は基本的にC#やKotlinでも成立する(はずな)ので「なぜこれらの言語では+/-の記号を使わないのか」を説明するものではありません. 個人的には+/-の方がわかりやすいと思うし, out/inの記法は扱っている概念が簡単であるかのような誤解を生む(悪く言えば騙す)のでどちらかと言うと嫌いです. 発端 こういう話題がありました. Scala は共変が + で、反変が - なので理論重視? なのに対して、Kotlin と TypeSc

                          部分型における変性と極性 - なぜScalaの変性は+や-で指定するのか - 貳佰伍拾陸夜日記
                        • An Introduction To Generics - The Go Programming Language

                          The Go 1.18 release adds support for generics. Generics are the biggest change we’ve made to Go since the first open source release. In this article we’ll introduce the new language features. We won’t try to cover all the details, but we will hit all the important points. For a more detailed and much longer description, including many examples, see the proposal document. For a more precise descrip

                            An Introduction To Generics - The Go Programming Language
                          • GoのGenerics関連プロポーザル最新状況まとめと簡単な解説

                            本記事では、GoのGenerics関連のProposal一覧のまとめと、簡単な解説を行います。 内容については随時更新を行います。 (本記事の内容をGo 1.17 リリースパーティーにて発表しました。) Generics関連のProposal一覧 (2022/2/3 更新) GoのGitHub Issueと、Gerritから見付けたGenerics関連のProposalを表にまとめました。 Proposal Status Author GitHub Issue Design Doc / Gerrit

                              GoのGenerics関連プロポーザル最新状況まとめと簡単な解説
                            • ジェネリクス引数の構文的曖昧性まとめ

                              ジェネリクスを持つ多くの言語では括弧の種類が足りなかったり、既存の文法との互換性を保つために <> をジェネリクス引数に使っている。この文字は比較演算子やシフト演算子にも使われるため、多くの場合は構文的曖昧性の問題がある。 // ジェネリクス引数 (convert<int, string>(number)) // 比較演算子 (score < MAX_SCORE, score > (MIN_SCORE)) 各言語でこの問題をどのように解決しているか調べる。 関連する問題として < > を含むトークン (<<, >> など) をどう分割するかという問題があるが、こちらは本スクラップでは扱わない。

                                ジェネリクス引数の構文的曖昧性まとめ
                              • The Next Step for Generics - The Go Programming Language

                                Ian Lance Taylor and Robert Griesemer 16 June 2020 Introduction It’s been almost a year since we last wrote about the possibility of adding generics to Go. It’s time for an update. Updated design We’ve been continuing to refine the generics design draft. We’ve written a type checker for it: a program that can parse Go code that uses generics as described in the design draft and report any type err

                                  The Next Step for Generics - The Go Programming Language
                                • GitHub - samber/lo: 💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)

                                  ✨ samber/lo is a Lodash-style Go library based on Go 1.18+ Generics. This project started as an experiment with the new generics implementation. It may look like Lodash in some aspects. I used to code with the fantastic "go-funk" package, but "go-funk" uses reflection and therefore is not typesafe. As expected, benchmarks demonstrate that generics are much faster than implementations based on the

                                    GitHub - samber/lo: 💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)
                                  • react-redux の Hooks API に Generics は要らない - Qiita

                                    export type StoreState = { hoge: { hoge: 'hoge' } fuga: { fuga: 'fuga' } } StoreState の型定義方法は数通りありますが、この様な型定義があることが前提です。 普通に書くとこうなる この条件でuseSelectorを利用してみます。useSelectorの Generics に従い、都度StoreStateを import し、それを注入しています。なんだかあまりイケてません。 import { useSelector } from 'react-redux' import { StoreState } from '../store' const Container: React.FC = () => { // const _hoge: "hoge" const _hoge = useSelector< St

                                      react-redux の Hooks API に Generics は要らない - Qiita
                                    • Go1.17beta1でGenericsに触れてみた - oinume journal

                                      Go1.17beta1がダウンロードできるようになったので、Generics(Type Parameters)でStackを書いて軽く遊んだメモ。 Generics (Type Parameters)について 最新の仕様のProposalは以下を見ると良い。 実際にどんな感じのコードになるのかは、GitHubのdev.typeparams branchのコードを見ると良さそう。 Go1.17beta1のダウンロード 普段使っているgoコマンドから以下のようにGo1.17beta1をダウンロードできる。 $ go get golang.org/dl/go1.17beta1 $ go1.17beta1 download これで ~/sdk/go1.17beta1 にインストールされる。 FYI: Goは標準の機能で複数のバージョンをインストールできる。より詳しくは以下のドキュメントを読むと良い

                                        Go1.17beta1でGenericsに触れてみた - oinume journal
                                      • Go 1.18 の Generics を使ったキャッシュライブラリを作った時に見つけた tips と微妙な点

                                        GitHub にコードを上げてます。 2021-11-17 時点で Go の Generics の機能を使ったキャッシュライブラリはおそらくないでしょう。Generics を使った例の一つとして参考にしてください。 Star をくれると大喜びします。 本記事ではこのキャッシュライブラリを作ってみて Generics に対して気が付いた点と発見した tips や微妙だった点を紹介していきます。 もし Go の Generics って何ができるんだっけ?となっている方は是非こちらの記事にも目を通してみてください。 any でゼロ値を返す これは @syumai さんから教えてもらった tips です。 次のような any と error を返すコードをよく書くことになるでしょう。関数内で error が発生した時に今までゼロ値と error を返すコードを記述していたはずですが、ちょっと頭を捻

                                          Go 1.18 の Generics を使ったキャッシュライブラリを作った時に見つけた tips と微妙な点
                                        • Goのジェネリクスを活用する

                                          Go勉強会 #1 #BuySell_Go (2023/5/24) https://buysell-technologies.connpass.com/event/283768/

                                            Goのジェネリクスを活用する
                                          • Go 1.18 is released! - The Go Programming Language

                                            The Go Team 15 March 2022 Today the Go team is thrilled to release Go 1.18, which you can get by visiting the download page. Go 1.18 is a massive release that includes new features, performance improvements, and our biggest change ever to the language. It isn’t a stretch to say that the design for parts of Go 1.18 started over a decade ago when we first released Go. Generics In Go 1.18, we’re intr

                                              Go 1.18 is released! - The Go Programming Language
                                            • Go Generics 超入門 / Kyoto.go Remote #28 LT会 (2022/02/23)

                                              2022/02/23のKyoto.go Remote #28 LT会 登壇資料です。 https://kyotogo.connpass.com/event/238059/

                                                Go Generics 超入門 / Kyoto.go Remote #28 LT会 (2022/02/23)
                                              • Generics can make your Go code slower

                                                Go 1.18 is here, and with it, the first release of the long-awaited implementation of Generics is finally ready for production usage. Generics are a frequently requested feature that has been highly contentious throughout the Go community. On the one side, vocal detractors worry about the added complexity. They fear the inescapable evolution of Go towards either a verbose and Enterprisey Java-lite

                                                  Generics can make your Go code slower
                                                • 実用 Generics: Python の itertools を Go 2 に移植してみた - Zopfcode

                                                  この記事は Go 4 Advent Calendar 2020 1日目の記事です。 激しい議論を呼んだことで有名な Go 2 の type generics は、Go 2 → Go 1 translator である "go2go" を介して既にお試しできる状態になっている。 この記事は、Go 2 における type generics のありようについて述べたり議論したりするものではない。お試しできるようになった今、それがどのような雰囲気で、どのように実用できそうかといった個人的感想を紹介する。どうぞ気軽に読んでほしい。 tl;dr Type generics の使い心地は思ったより良い 各種制限も妥当に設定されているように思える Go 1 に translate されたソースコードの見た目は素朴で直感的 今まで冗長に書かざるを得なかった部分を安全に短くするのに使えそう Python の i

                                                    実用 Generics: Python の itertools を Go 2 に移植してみた - Zopfcode
                                                  • Crimes with Go Generics

                                                    Exclamation If you're looking for someone like me on your team, I'm available. Check my resume and get in touch if you're hiring. Crimes with Go Generics Published on 04/24/2022, 2295 words, 9 minutes to read Go 1.18 added generics to the language. This allows you to have your types take types as parameters so that you can create composite types (types out of types). This lets you get a lot of exp

                                                    • PEP 585 (Type Hinting Generics In Standard Collections) を読んだよメモ - Qiita

                                                      PEP 585 (Type Hinting Generics In Standard Collections) を読んだよメモPythonPython3mypypep __origin__ という属性がどこからやってきたのを調べていたところ、 PEP 585 -- Type Hinting Generics In Standard Collections という PEP を見つけたので、本来の目的を忘れて流し読みしてました。まだ Draft ステータスですので、今後採用されるかどうかはわかりませんが、自分の理解をメモに残しておきます。 概要 これまでの型アノテーションでは、コレクションを表現するのに専用の型を使っていた (typing.List や typing.Dict など) コレクションの実装クラスと型クラスを統合し、標準のコレクションクラス(list や dict など)で型アノテ

                                                        PEP 585 (Type Hinting Generics In Standard Collections) を読んだよメモ - Qiita
                                                      • Tutorial: Getting started with generics - The Go Programming Language

                                                        This tutorial introduces the basics of generics in Go. With generics, you can declare and use functions or types that are written to work with any of a set of types provided by calling code. In this tutorial, you’ll declare two simple non-generic functions, then capture the same logic in a single generic function. You’ll progress through the following sections: Create a folder for your code. Add n

                                                          Tutorial: Getting started with generics - The Go Programming Language
                                                        • Faster sorting with Go generics - Eli Bendersky's website

                                                          Recently, a new set of sorting functions has landed in Go's golang.org/x/exp/slices package [1]. These functions leverage Go generics to provide a more ergonomic API for sorting (without requiring users to implement sort.Interface), and also deliver a nice performance improvement, as the CL demonstrates. In this post, I'll dive deep into why these generic functions are faster than the existing one

                                                          • Generic associated types to be stable in Rust 1.65 | Rust Blog

                                                            As of Rust 1.65, which is set to release on November 3rd, generic associated types (GATs) will be stable — over six and a half years after the original RFC was opened. This is truly a monumental achievement; however, as with a few of the other monumental features of Rust, like async or const generics, there are limitations in the initial stabilization that we plan to remove in the future. The goal

                                                              Generic associated types to be stable in Rust 1.65 | Rust Blog
                                                            • Go 1.18集中連載 ジェネリクス | フューチャー技術ブログ

                                                              ジェネリクスGo 1.18で入る機能で注目度が高い新機能がジェネリクスです。Goに対する批判的な言葉としてよく使われるものが「ジェネリクスがない」というものでした。Goを長く使っている人は「ジェネリクスなんていらん」と言い続けてきたし、個人的にもいまだになくてもいいと思っているのですが、大きな変更であるし、これから影響もいろいろある領域ですので学ぶ必要はあるでしょう。自分で書かなくても、書かれたコードを読むこともあるでしょうし。 ジェネリクスのチュートリアルが追加されています。 https://go.dev/doc/tutorial/generics mattnさんの動画もあります。 文法的には基底型を表すチルダ演算子が増えたりいろいろ変更が入っています。 とはいえ、constraintsパッケージが1.18に入る予定だったのが、一旦準標準パッケージに格下げされたり、まだまだいろいろ変更が

                                                                Go 1.18集中連載 ジェネリクス | フューチャー技術ブログ
                                                              • Go の "Type Sets" proposal を読む

                                                                Intro 読者の想定知識 この記事で出てくるGo言語仕様用語 サマリー Context Type Parameters Proposalの要点 Type listの必要性 暗黙的な"underlying type matching"の問題 type listからsum typeへ underlying type matchingと代入可能性 underlying type matchingと型switchステイトメント underlying type matchingの表現力の限界 Type Sets Proposal Type sets(型集合) 型Tがinterface ITを実装するための条件 要素を埋め込んだインタフェースのtype set interface elements(インタフェース要素) 任意の型(インタフェース型に限らない) approximation elemen

                                                                  Go の "Type Sets" proposal を読む
                                                                • When To Use Generics - The Go Programming Language

                                                                  The Go 1.18 release adds a major new language feature: support for generic programming. In this article I’m not going to describe what generics are nor how to use them. This article is about when to use generics in Go code, and when not to use them. To be clear, I’ll provide general guidelines, not hard and fast rules. Use your own judgement. But if you aren’t sure, I recommend using the guideline

                                                                    When To Use Generics - The Go Programming Language
                                                                  • Type parameters in Go - tenntenn.dev

                                                                    この記事は、Go Advent Calendar 2020の25日目の記事です。 なぜジェネリクスが必要なのか Goでは長年ジェネリクスを加えてほしいという要望が多く寄せられており、さまざまなデザインが検討されてきました。ジェネリクスの必要性は以下のようなコードを型に依存せずに記述することができます。 func PrintInts(s []int) { for _, v := range s { fmt.Print(v) } } func PrintStrings(s []string) { for _, v := range s { fmt.Print(v) } } Type Parameters - Draft Designで提案されているデザインでは、以下のように記述できるようになります。 func Print[T any](s []T) { for _, v := range s

                                                                    • Go Genericsを使ってgo-optionalを書いた / Go Generics感想 - その手の平は尻もつかめるさ

                                                                      Go Genericsがどんなもんか試してみたかったので、これを使ってOptionの実装を書いてみました。 github.com 基本的な使い方としてはSynopsisを読んでもらえばわかると思いますが、ユーティリティとしては IsSome() IsNone() Take() TakeOr() TakeOrElse() Filter() Map() MapOr() Zip() ZipWith() Unzip() UnzipWith() あたりを取り揃えております。examplesも併せてご覧いただくとおおよその使い方の雰囲気が掴めると思います。 利用のためにはまだunstableな最新版 (go1.18) を使う必要があるので、gotipとかを使って新しい処理系を引っぱってくる必要があります。 で、GoのGenericsを使ってみた感想としてdefault valueとかconstrain

                                                                        Go Genericsを使ってgo-optionalを書いた / Go Generics感想 - その手の平は尻もつかめるさ
                                                                      • Announcing the Keyword Generics Initiative | Inside Rust Blog

                                                                        We (Oli, Niko, and Yosh) are excited to announce the start of the Keyword Generics Initiative, a new initiative 1 under the purview of the language team. We're officially just a few weeks old now, and in this post we want to briefly share why we've started this initiative, and share some insight on what we're about. A missing kind of generic One of Rust's defining features is the ability to write

                                                                          Announcing the Keyword Generics Initiative | Inside Rust Blog
                                                                        • Go 1.18 でやってくる Generics とは

                                                                          Go 1.18 でやってくる Generics とは Generics で Go はどの様に変わるのか DevFest Tokyo 2021

                                                                          • ジェネリクス — 仕事ですぐに使えるTypeScript ドキュメント

                                                                            TypeScriptの世界を知る 前書き Node.jsエコシステムを体験しよう TypeScriptの書き方 変数 プリミティブ型 複合型 基本的な構文 基本的な型付け 関数 その他の組み込み型・関数 クラス 非同期処理 例外処理 モジュール console.logによるログ出力 中級のテクニック ジェネリクス ジェネリクスの書き方 ジェネリクスの引数名 ジェネリクスの型パラメータに制約をつける 型パラメータの自動解決 ジェネリクスの文法でできること、できないこと 型変換のためのユーティリティ型 オブジェクトに対するユーティリティ型 オブジェクトと属性名に対するユーティリティ型 型の集合演算のユーティリティ型 関数のユーティリティ型 クラスに対するユーティリティ型 any や unknown 、合併型との違い まとめ 関数型指向のプログラミング クラス上級編 リアクティブ 高度なテクニッ

                                                                            • Go言語のジェネリクス入門(2) インスタンス化と型推論

                                                                              はじめに 注意: 2023/06/08更新 Go1.21(順調なら2023年8月にリリース予定)において、型推論アルゴリズムの枠組みが新しくなります。 この記事の多くの内容は古いものとなります。 更新予定は今のところないので、注意書きを記載しておきます。 ↑の変更のポイントだけ筆者なりにまとめておくと、関数引数型推論と制約型推論との間の順序の関係がなくなることと、順序の関係がなくなることによって型推論に使える情報の種類を増やしやすくなることがポイントです。 注意 この記事はGo1.18リリース前に書いたのですが、そのせいでGo1.18以降で動作しなくなっているサンプルコードがあります。 具体的には、Go1.18リリース時点では「パラメータ化された型」にたいする型推論が行われなくなりました。そのため、このような型推論についてのサンプルコードが動作しなくなっています。 型推論アルゴリズム自体は

                                                                                Go言語のジェネリクス入門(2) インスタンス化と型推論
                                                                              • Passing Generics to JSX Elements in TypeScript

                                                                                March 25, 2019TypeScript 2.9 added the ability to specify type arguments for generic JSX elements. This means we can now write the following component in a TSX file: function Form() { // ... return ( <Select<string> options={targets} value={target} onChange={setTarget} /> ); }To understand why it's useful to have generic JSX elements (and why we typically don't have to write out the type argument

                                                                                  Passing Generics to JSX Elements in TypeScript
                                                                                • Go1.18のGenericsで出来ないこと

                                                                                  はじめに 先日Go1.18がリリースされました. リリースノートを見るとGo1.18の時点でのlimitationsが書いてあるのでコード書いて確認します. 全部で6つあります. 1つ目 The Go compiler cannot handle type declarations inside generic functions or methods. We hope to provide support for this feature in Go 1.19. genericな関数やメソッドの中で型宣言できない. package main import "fmt" func main() { fmt.Println("Hello, 世界") } func GenericsF[T any]() { // [NG] type declarations inside generic func

                                                                                    Go1.18のGenericsで出来ないこと

                                                                                  新着記事