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
Developing Emacs extensions in Go
Search
kiwanami
July 03, 2017
1.9k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Developing Emacs extensions in Go
Geeks Who Drink @nulab on 2017/06/28
https://nulab.connpass.com/event/57238/
kiwanami
July 03, 2017
More Decks by kiwanami
See All by kiwanami
Backlog Anti-Patterns
kiwanami
0
8.6k
Featured
See All Featured
My Coaching Mixtape
mlcsv
0
140
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
580
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
55k
What's in a price? How to price your products and services
michaelherold
247
13k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Designing for Timeless Needs
cassininazir
1
250
How to Talk to Developers About Accessibility
jct
2
220
How STYLIGHT went responsive
nonsquared
100
6.2k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
600
エンジニアに許された特別な時間の終わり
watany
107
250k
Utilizing Notion as your number one productivity tool
mfonobong
4
320
A designer walks into a library…
pauljervisheath
211
24k
Transcript
Developing Emacs extensions in Go kiwanami 2017/06/28
Topics • Emacs and extension? • Why do I choose
go? • Design and implementation of go-elrpc
Me • Masashi Sakurai • @kiwanami • Software Developer –
Software engineer for medical/hospital systems • OSS – Emacs Lisp, JavaScript • Go – 2016/12 -
Emacs and Extensions
Emacs? • TEXT EDITOR! – Since mid-1970s and continues actively
as of 2017. • Extensible, Customizable!
Emacs start up screen
Editing code
Split windows and color customize
IDE like window layout
Database integration
Web browser and Data analysing with jupyter
Reading and Writing Mails
Schedule management with calendar services
Cacoo Integration
3D FPS(First person sampo) game
Online Multi-player 3D FPS
Emacs is Great !!
Emacs Extension • Pure Emacs Lisp • “Dynamic module” –
Since Emacs 25.1 – include “emacs-module.h” – not popular yet... • IPC – STDOUT/IN, TCP Socket, D-bus – Hard to implement...
EPC, RPC stack for Emacs Lisp • TCP Socket /
S-exp encoding • Language binding – emacs lisp, perl, python, ruby, nodejs, nim, scala
Ok, EPC solves problem? • Yes. – Emacs gets powers
through other languages. • But, Installing other language environment and package system is very difficult... – perl/CPAN, ruby/gem, node/npm, etc
Go may solve the problem • Easy deploying – One
binary • Fast and static typing – Comparing with LL • Easy to learn – Simple language and GC – Concurrency → go bindign : go-elrpc
None
Desing and Implementation go-elrpc
EPC overview
go-elrpc overview • S-exp encoding/decoding – parsing s-exps and serializing
data values – type conversion • RPC stack – TCP stream – async and sessions – bi-directional
S-exp encoding/decoding • goyacc and handwritten lexer (call add (1
2 3)) Lexer State channel [token] Parser (yacc) S-exp AST rune (unicode char) lexer thread parser thread
RPC stack implementation • stream threads and controle thread Receiver
thread Sender thread Controle thread decoding encoding socket stream dispatching messages managing sessions User Code RPC Service
Type convesion • S-exp (not static typed) input • Types
which are needed by static typed functions func add(a int64, b float64) float64 1 (int), 2 (int) input:
Performance • echo(a int) int method – perl: 3154 msg/sec
– ruby: 10526.3 msg/sec – nodejs: 9174.31 msg/sec – golang: 26347 msg/sec
Thank you