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
620
3
Share
メタプログラミング向けのテンプレートエンジン gysb を作った
2017/11/21 関西モバイルアプリ研究会 in 関東
https://kanmoba.connpass.com/event/70685/
omochimetaru
November 21, 2017
More Decks by omochimetaru
See All by omochimetaru
Swift Concurrency 年表クイズ
omochi
3
270
型推論のちょっと深い話
omochi
1
530
Swiftの型推論を学ぼう | Let's Learn About Type Inference in Swift
omochi
4
10k
[スクリプト] Swiftの型推論を学ぼう
omochi
2
520
Swift6のprotocol
omochi
6
1.4k
SwiftSyntaxをうまく使おう
omochi
2
410
今から使えるSwiftとC++の新しいinterop手法
omochi
0
500
CSFixとラベルマッチ
omochi
0
460
Swiftのmodifyアクセサとコルーチン
omochi
0
920
Other Decks in Programming
See All in Programming
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
1
640
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
1.1k
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
150
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
220
AIを導入する前にやるべきこと
negima
2
330
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
140
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
120
2026-04-15 Spring IO - I Can See Clearly Now
jonatan_ivanov
1
170
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
670
🦞OpenClaw works with AWS
licux
1
330
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
970
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.8k
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
190
Writing Fast Ruby
sferik
630
63k
How to Think Like a Performance Engineer
csswizardry
28
2.6k
Context Engineering - Making Every Token Count
addyosmani
9
860
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
140
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
160
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
140
The Mindset for Success: Future Career Progression
greggifford
PRO
0
320
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
170
A Tale of Four Properties
chriscoyier
163
24k
Color Theory Basics | Prateek | Gurzu
gurzu
0
300
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 ʹରԠ