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
value_struct
Search
J-_-L
November 03, 2012
Technology
2
80
value_struct
5-min introduction to read-only structs in Ruby
J-_-L
November 03, 2012
Tweet
Share
More Decks by J-_-L
See All by J-_-L
Why Ruby is "beautiful code"!
janlelis
2
2.1k
Other Decks in Technology
See All in Technology
オブジェクトのおしゃべり大失敗 メッセージングアンチパターン集 / messaging anti-pattern collection
ytake
0
340
統計的学習理論読み Chapter 1
kmatsui
4
960
バッチ処理のSLOをどう設計するか
rynsuke
7
590
8週連続ウェビナー_イチから学ぶFivetran
cmsuzu
0
170
匠MethodとRDRAとICONIXとDDDで実現する一気通貫オブジェクト指向開発
haru860
4
2.1k
SREsのためのSRE定着ガイド
netmarkjp
10
1.6k
マイクロサービス環境におけるDB戦略 in DMMプラットフォーム
pospome
11
3k
Azureコストは水道代/The_47th_Tokyo_Jazug
aeonpeople
3
390
Autify Company Deck
autifyhq
1
30k
関数型DDDの理論と実践:「決定を遅らせる」を先につくり、 ビジネスの機動力と価値をあげる
knih
2
500
単回帰分析について数式を追いながら実装してみた
kentaitakura
0
510
オブジェクト指向CSSが叶えたかったことと、CSSのいま / The aims of Object-oriented CSS and the current state of CSS usage
shinkufencer
11
3.7k
Featured
See All Featured
The Invisible Side of Design
smashingmag
293
49k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.3k
Designing Experiences People Love
moore
135
23k
jQuery: Nuts, Bolts and Bling
dougneiner
57
7.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
113
18k
Art, The Web, and Tiny UX
lynnandtonic
288
19k
A better future with KSS
kneath
230
16k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
11
1.4k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
No one is an island. Learnings from fostering a developers community.
thoeni
14
2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
240
1.2M
The Cost Of JavaScript in 2023
addyosmani
13
3.7k
Transcript
1/6 rbjl.net ValueStruct - Nov 3 2012 - Jan Lelis
d:evolute @happycode
2/6 rbjl.net ValueStruct Value structs behave like a normal Ruby
structs However, they are immutable*
3/6 rbjl.net ValueStruct: First Draft
4/6 rbjl.net ValueStruct: Benchmarks • Without mixins not much slower
than Struct
5/6 rbjl.net ValueStruct: Optional mixins • #dup takes a optional
hash for setting new values • Value structs can be initialized with the exact amount of arguments • Automatically freeze new instances • #to_h for converting into a hash • If Ruby version below 2.0
6/6 rbjl.net ValueStruct: Resources • gem install value_struct • https://github.com/janlelis/value_struct
• Other solutions • https://github.com/tcrayford/Values • https://github.com/iconara/immutable_struct • Twitter • @happycode • Contact • happycode.org / devolute.org