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
510
メタプログラミング向けのテンプレートエンジン 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
Swiftの型推論を学ぼう | Let's Learn About Type Inference in Swift
omochi
2
570
[スクリプト] Swiftの型推論を学ぼう
omochi
0
120
Swift6のprotocol
omochi
4
900
SwiftSyntaxをうまく使おう
omochi
2
230
今から使えるSwiftとC++の新しいinterop手法
omochi
0
310
CSFixとラベルマッチ
omochi
0
300
Swiftのmodifyアクセサとコルーチン
omochi
0
570
Swiftのオーバーロード選択のスコア規則12種類
omochi
2
170
SILを読もう
omochi
2
620
Other Decks in Programming
See All in Programming
htmx is fun!
codehex
2
190
導入から5年が経って見えた Datadog APM 運用の課題
bgpat
2
540
ISUCONってなんだか難しそう……!!でも、初めてのISUCONにPHPで挑戦してきました!
kotomin_m
1
300
Dockerで始めるAWS Lambda開発
stutkhd0709
14
2.5k
GitHub Copilot Tips and Tricks
yuichielectric
26
7.5k
Open Source Swiftc Workshop
kitasuke
1
290
どうしてこうなった命名集 ~🔥編~ / OOC 2024 LT
pictiny
4
2.8k
プロンプトエンジニアリング入門
tomokusaba
2
980
上手な探索的テストとその上達方法について
matsu802
4
650
Open Source Swift Workshop - Foundation and first party libraries
ikesyo
0
270
フロントエンドパフォーマンス 入門
shouta2
7
1.5k
Laravel標準バリデーションでできること
hmb_ok
2
360
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.4k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Rebuilding a faster, lazier Slack
samanthasiow
72
8.2k
Designing for Performance
lara
601
67k
Robots, Beer and Maslow
schacon
PRO
154
7.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
10
4.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
225
51k
Embracing the Ebb and Flow
colly
78
4.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
242
20k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
19
1.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
1
1.2k
Why Our Code Smells
bkeepers
PRO
330
56k
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 ʹରԠ