Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
メタプログラミング向けのテンプレートエンジン gysb を作った
Search
omochimetaru
November 21, 2017
Programming
3
590
メタプログラミング向けのテンプレートエンジン gysb を作った
2017/11/21 関西モバイルアプリ研究会 in 関東
https://kanmoba.connpass.com/event/70685/
omochimetaru
November 21, 2017
Tweet
Share
More Decks by omochimetaru
See All by omochimetaru
型推論のちょっと深い話
omochi
1
500
Swiftの型推論を学ぼう | Let's Learn About Type Inference in Swift
omochi
4
9.5k
[スクリプト] Swiftの型推論を学ぼう
omochi
2
450
Swift6のprotocol
omochi
6
1.3k
SwiftSyntaxをうまく使おう
omochi
2
370
今から使えるSwiftとC++の新しいinterop手法
omochi
0
460
CSFixとラベルマッチ
omochi
0
420
Swiftのmodifyアクセサとコルーチン
omochi
0
830
Swiftのオーバーロード選択のスコア規則12種類
omochi
3
440
Other Decks in Programming
See All in Programming
Vue・React マルチプロダクト開発を支える Vite
andpad
0
110
AIエージェント開発、DevOps and LLMOps
ymd65536
1
370
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
790
複雑なドメインに挑む.pdf
yukisakai1225
4
500
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
0
270
サーバーサイドのビルド時間87倍高速化
plaidtech
PRO
0
680
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
260
testingを眺める
matumoto
1
130
Honoアップデート 2025年夏
yusukebe
1
880
AIでLINEスタンプを作ってみた
eycjur
1
220
🔨 小さなビルドシステムを作る
momeemt
2
620
A Gopher's Guide to Vibe Coding
danicat
0
190
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
830
Visualization
eitanlees
147
16k
YesSQL, Process and Tooling at Scale
rocio
173
14k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
The Invisible Side of Design
smashingmag
301
51k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
790
RailsConf 2023
tenderlove
30
1.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Transcript
ϝλϓϩάϥϛϯά͚ ͷςϯϓϨʔτΤϯδϯ gysb Λ࡞ͬͨ omochimetaru @
Array ͱ ؒͨͪ Array - startIndex, endIndex, subscript, _ArrayBuffer ArraySlice
- startIndex, endIndex, subscript, _SliceBuffer ContiguousArray - startIndex, endIndex, subscript, _ContiguousArrayBuffer
gyb Generate Your Boilerplate
gyb Generate Your Boilerplate ࣮ߦ: %{ <python code> }% ࣮ߦ:
% <python code> (ߦ) ࣜల։: ${ <python code> }
Arrays.swift.gyb apple/swift @ github
%{ arrayTypes = [ ('ContiguousArray', 'a `ContiguousArray` instance'), ('ArraySlice', 'an
`ArraySlice` instance'), ('Array', 'an array'), ] }% % for (Self, a_Self) in arrayTypes: public struct ${Self}<Element> { %if Self == 'Array': internal typealias _Buffer = _ArrayBuffer<Element> %elif Self == 'ArraySlice': internal typealias _Buffer = _SliceBuffer<Element> %else: internal typealias _Buffer = _${Self.strip('_')}Buffer<Element> %end internal var _buffer: _Buffer } %end
public struct ContiguousArray<Element> { internal typealias _Buffer = _ContiguousBuffer<Element> internal
var _buffer: _Buffer } public struct ArraySlice<Element> { internal typealias _Buffer = _SliceBuffer<Element> internal var _buffer: _Buffer } public struct Array<Element> { internal typealias _Buffer = _ArrayBuffer<Element> internal var _buffer: _Buffer }
gyb ͷྑ͘ͳ͍ͱ͜Ζ
gyb ͷྑ͘ͳ͍ͱ͜Ζ python Λॻ͘ͱ͜Ζ
gysb Generate Your Swifty Boilerplate
gysb Generate Your Swifty Boilerplate https://github.com/omochi/gysb ࣮ߦ: %{ <swift code>
}% ࣮ߦ: % <swift code> (ߦ) ࣜల։: ${ <swift code> }
Demo ࣮ࡍͷσϞͷͱ͖ɺ ҎԼͷιʔεΛࡐʹɺ --source-dirs, --parse, --compile Ϟʔυͷಈ࡞Λհ͠ ͨɻ https://github.com/omochi/ReactiveEmitter/blob/master/ Sources/ReactiveEmitter/Operator/Combine.swift.gysb
gysb ͷ։ൃ gysb ͷಈ࡞ݪཧͦΕࣗମϝλϓϩάϥϛϯά͔ͩΒ Swift ͷϝλϓϩάϥϛϯά͢ΔͨΊʹ Swift ͷϝλϓϩάϥϛϯάΛߦ͏ Swift ϓϩάϥϜΛ࡞ͬͨ
! (͋ͱ Kotlin C++ ੜͰ͖ΔΑ)
(એ) Discord Offline Discord αʔό ios-developers-japan ΛϦΞϧͰ 12/4 ϝϧΧϦ ύωϧσΟεΧογϣϯܗࣜ
https://connpass.com/event/71774/
Sourceryͱͷҧ͍ Sourcery ܕใऔಘ + ςϯϓϨʔτ(ෳݴޠ) gysb ςϯϓϨʔτ Sourcery
ͷ swift ςϯϓϨʔτϥΠϒϥϦඇରԠ gysb gysb.json Ͱ SwiftPM ʹରԠ