mi n i ma l i s m v e r s u s t y p e s H i s h - - PowerPoint PPT Presentation

mi n i ma l i s m v e r s u s t y p e s
SMART_READER_LITE
LIVE PREVIEW

mi n i ma l i s m v e r s u s t y p e s H i s h - - PowerPoint PPT Presentation

mi n i ma l i s m v e r s u s t y p e s H i s h a m Mu h a mma d < h i s h a m@k o n g h q . c o m> mi n i ma l i s m L u a : fj t s i n my h e a d g t y p e s p a i


slide-1
SLIDE 1

mi n i ma l i s m v e r s u s t y p e s

H i s h a m Mu h a mma d

< h i s h a m@k

  • n

g h q . c

  • m>
slide-2
SLIDE 2

mi n i ma l i s m L u a : fj t s i n my h e a d

slide-3
SLIDE 3

g

slide-4
SLIDE 4

t y p e s p a i r

  • p

r

  • g

r a mmi n g wi t h t h e c

  • mp

u t e r

slide-5
SLIDE 5

u n t y p e d : n

  • t

y p e s a t a l l

a s s e mb l y , u n ( i ) t y p e d l a mb d a c a l c u l u s

t y p e d : t y p e s e x i s t !

s t r i n g a n d n u mb e r a r e d i fg e r e n t t h i n g s

( e v e n i f y

  • u

c a n d

  • "

1 " + 2 )

slide-6
SLIDE 6

d y n a mi c a l l y t y p e d : v a l u e s h a v e t y p e s , v a r i a b l e s d

  • n

' t

L u a , S c h e me , E r l a n g , P y t h

  • n

, R u b y , P H P , e t c .

s t a t i c a l l y t y p e d : v a l u e s h a v e t y p e s , v a r i a b l e s h a v e t y p e s

C , J a v a , G

  • ,

C # , R u s t , H a s k e l l , e t c .

slide-7
SLIDE 7

s t r

  • n

g l y t y p e d we a k l y t y p e d

slide-8
SLIDE 8

d y n a mi c a l l y t y p e d : v a l u e s h a v e t y p e s , v a r i a b l e s d

  • n

' t

L u a , S c h e me , E r l a n g , P y t h

  • n

, R u b y , P H P , e t c .

s t a t i c a l l y t y p e d : v a l u e s h a v e t y p e s , v a r i a b l e s h a v e t y p e s

C , J a v a , G

  • ,

C # , R u s t , H a s k e l l , e t c .

slide-9
SLIDE 9

wh a t h a p p e n s wh e n we p u t mi n i ma l i s m a n d t y p e s t

  • g

e t h e r ?

slide-10
SLIDE 10

a b r i e f h i s t

  • r

y

  • f

t y p i n g L u a

slide-11
SLIDE 11

2 1 3 : T i d a l L

  • c

k

h t t p s : / / g i t h u b . c

  • m/

f a b 1 3 n / me t a l u a / b l

  • b

/ t i l

  • /

s r c / t i l

  • /

r e a d me . md

slide-12
SLIDE 12

2 1 5 : T y p e d L u a

h t t p s : / / g i t h u b . c

  • m/

a n d r e mm/ t y p e d l u a

slide-13
SLIDE 13

2 1 7 : T i t a n

h t t p s : / / g i t h u b . c

  • m/

t i t a n

  • l

a n g / t i t a n

slide-14
SLIDE 14

2 1 8 : P a l l e n e

h t t p s : / / g i t h u b . c

  • m/

p a l l e n e

  • l

a n g / p a l l e n e

slide-15
SLIDE 15

a n d y e t

slide-16
SLIDE 16

wh y i s i t s

  • h

a r d ?

slide-17
SLIDE 17
  • n

c e y

  • u

a d d t y p e s a n d t h e wh

  • l

e e n c h i l a d a t h a t c

  • me

s wi t h i t , t h e n t h e l a n g u a g e i s n

  • l
  • n

g e r mi n i ma l i s t i c , r i g h t ?

slide-18
SLIDE 18
  • n

c e y

  • u

a d d t y p e s a n d t h e wh

  • l

e e n c h i l a d a t h a t c

  • me

s wi t h i t , t h e n t h e l a n g u a g e i s n

  • l
  • n

g e r mi n i ma l i s t i c , r i g h t ? t y p e s ma k e

  • u

r t i n y l a n g u a g e s c

  • mp

l i c a t e d ?

slide-19
SLIDE 19

t h e p r

  • b

l e m i s k i n d a t h e

  • p

p

  • s

i t e

slide-20
SLIDE 20

d y n a mi c a l l y t y p e d l a n g u a g e s h a v e

H U G E

t y p e s y s t e ms

slide-21
SLIDE 21

t y p e s y s t e m: s e t

  • f

r u l e s t h a t d e s c r i b e wh a t a r e t h e v a l i d i n t e r a c t i

  • n

s

  • f

v a l u e s i n c

  • r

r e c t p r

  • g

r a ms

slide-22
SLIDE 22

t y p e s y s t e m: s e t

  • f

r u l e s t h a t d e s c r i b e wh a t a r e t h e v a l i d i n t e r a c t i

  • n

s

  • f

v a l u e s i n c

  • r

r e c t p r

  • g

r a ms i t ' s i n y

  • u

r h e a d !

slide-23
SLIDE 23

y

  • u

a r e t h e t y p e c h e c k e r

slide-24
SLIDE 24
  • bj.x, obj.y = get_coords()

c a n ' t d

  • t

h a t : y e s t e r d a y I c h a n g e d get_coords f r

  • m

return x, y t

  • return { x = x, y = y }
slide-25
SLIDE 25

wh a t a r e t h e r u l e s i n y

  • u

r h e a d ?

slide-26
SLIDE 26

d y n a mi c a l l y t y p e d : v a l u e s h a v e t y p e s , v a r i a b l e s d

  • n

' t

L u a , S c h e me , E r l a n g , P y t h

  • n

, R u b y , P H P , e t c .

s t a t i c a l l y t y p e d : v a l u e s h a v e t y p e s , v a r i a b l e s h a v e t y p e s

C , J a v a , G

  • ,

C # , R u s t , H a s k e l l , e t c .

d e p e n d e n t l y t y p e d : v a l u e s h a v e t y p e s , v a r i a b l e s h a v e t y p e s . . . a n d t y p e s h a v e v a l u e s ! a n d t y p e s !

I d r i s , A g d a . . . n

  • t

t h a t ma n y y e t !

slide-27
SLIDE 27

function f(a, b)

slide-28
SLIDE 28

function f(a, b) a : i n t e g e r b : i f a < 2 5 6 t h e n s t r i n g e l s e a r r a y

  • f

s t r i n g s

slide-29
SLIDE 29

function f(a, b) a : i n t e g e r b : i f a < 2 5 6 t h e n s t r i n g e l s e a r r a y

  • f

s t r i n g s red: integer green: integer blue: integer

slide-30
SLIDE 30

function f(a, b) a : i n t e g e r b : i f a < 2 5 6 t h e n s t r i n g e l s e a r r a y

  • f

s t r i n g s red: integer green: integer blue: integer f(red, {1, 2, 3})

slide-31
SLIDE 31

C u r r y

  • H
  • wa

r d c

  • r

r e s p

  • n

d e n c e p r

  • p
  • s

i t i

  • n

s ↔ t y p e s l

  • g

i c ↔ t y p e s y s t e m

slide-32
SLIDE 32

b t w , a r i t h me t i c s i s u n d e c i d a b l e

slide-33
SLIDE 33

local t = {} local ok, err = load_values_into_table(t) if not ok then return nil, "failed! " .. err end return { r = t[1], g = t[2], b = t[3] }

slide-34
SLIDE 34

L u a : t a b l e i s t h e

  • n

l y s t r u c t u r e d t y p e

slide-35
SLIDE 35

e v e r y t h i n g i s a t a b l e a t a b l e i s a n y t h i n g

slide-36
SLIDE 36

e v e r y t h i n g i s a t a b l e a t a b l e i s a n y t h i n g a n a r r a y

slide-37
SLIDE 37

e v e r y t h i n g i s a t a b l e a t a b l e i s a n y t h i n g a n a r r a y a d i c t i

  • n

a r y

slide-38
SLIDE 38

e v e r y t h i n g i s a t a b l e a t a b l e i s a n y t h i n g a n a r r a y a d i c t i

  • n

a r y a s t r u c t

slide-39
SLIDE 39

e v e r y t h i n g i s a t a b l e a t a b l e i s a n y t h i n g a n a r r a y a d i c t i

  • n

a r y a s t r u c t a n

  • b

j e c t

slide-40
SLIDE 40

e v e r y t h i n g i s a t a b l e a t a b l e i s a n y t h i n g a n a r r a y a d i c t i

  • n

a r y a s t r u c t a n

  • b

j e c t a d i c t i

  • n

a r y ma p p i n g

  • b

j e c t s t

  • s

t r i n g s

  • r

a r r a y s d e p e n d i n g

  • n

wh e t h e r fj e l d x

  • f

t h e k e y

  • b

j e c t i s t r u e

  • r

f a l s e

slide-41
SLIDE 41

e x p r e s s i v e n e s s

slide-42
SLIDE 42

n

  • t

r e a l l y wh a t a l a n g u a g e c a n e x p r e s s b u t h

  • w

c a n y

  • u

e x p r e s s i t

slide-43
SLIDE 43

d y n a mi c a l l y t y p e d l a n g u a g e s a r e s u p e r e x p r e s s i v e l i k e a b l a n k s h e e t

  • f

p a p e r

slide-44
SLIDE 44

t y p e c h e c k e r wo r k s b

  • t

h f

  • r

g

  • d

( " T h a n k y

  • u

f

  • r

c a t c h i n g my s i l l y t y p

  • !

" )

a n d b a d

( " n

  • ,

I _ k n

  • w_

t h a t t h i s u s e

  • f

t h e v a r i a b l e i s s a f e ! " )

slide-45
SLIDE 45

e x p r e s s i v e n e s s i s t h e f e e l

  • f

a l a n g u a g e

slide-46
SLIDE 46

local t = {} t.name = "items" t[1] = 100 t[2] = 200

slide-47
SLIDE 47

h e r e ' s t h e d i l e mma : h

  • w

mu c h

  • f

t h e l a n g u a g e d

  • y
  • u

c h a n g e ?

slide-48
SLIDE 48

i f y

  • u

wa n t t

  • ma

k e i t f e e l l i k e L u a , t h e n t h e t y p e c h e c k e r i s s u p e r c

  • mp

l e x i f y

  • u

wa n t t

  • fj

n i s h y

  • u

r t y p e c h e c k e r , y

  • u

h a v e t

  • ma

k e c u t s s

  • me

wh e r

slide-49
SLIDE 49

t wo

  • p

t i

  • n

s

  • n

wh e r e t

  • ma

k e c u t s

slide-50
SLIDE 50

c u t

  • n

p r

  • g

r a mme r e x p r e s s i v e n e s s

{ name = "items", items = {100, 200} } return x, y a n d return nil, err

v s .

return x, y a n d return nil, nil, err

slide-51
SLIDE 51

c u t

  • n

t h e c

  • r

r e c t n e s s

  • f

t h e t y p e c h e c k e r

slide-52
SLIDE 52

" e v e r y p r

  • g

r a m t h e t y p e c h e c k e r a c c e p t s h a s c

  • r

r e c t t y p e s " " e v e r y p r

  • g

r a m t h a t t h e t y p e c h e c k e r r e j e c t s h a s wr

  • n

g t y p e s "

slide-53
SLIDE 53

t h e mo r e s

  • p

h i s t i c a t e d y

  • u

r t y p e s y s t e m, t h e d e e p e r y

  • u

a r e i n r e s e a r c h t e r r i t

  • r

y

slide-54
SLIDE 54

s

  • u

n d n e s s v s . u s a b i l i t y ( v s . p e r f

  • r

ma n c e ! ) T y p e d L u a T y p e d C l

  • j

u r e T y p e d R a c k e t

slide-55
SLIDE 55

i s a l l l

  • s

t ?

slide-56
SLIDE 56

T y p e S c r i p t

slide-57
SLIDE 57

u s a b i l i t y a b

  • v

e a l l e l s e

h t t p s : / / g i t h u b . c

  • m/

Mi c r

  • s
  • f

t / T y p e S c r i p t / wi k i / T y p e S c r i p t

  • D

e s i g n

  • G
  • a

l s

slide-58
SLIDE 58

i n t e n t i

  • n

a l l y u n s

  • u

n d

slide-59
SLIDE 59

i n t e n t i

  • n

a l l y u n s

  • u

n d

slide-60
SLIDE 60

wh a t a b

  • u

t L u a ?

slide-61
SLIDE 61

e x p l

  • r

i n g t h i s d e s i g n s p a c e t l : mi n i ma l i s t i c L u a t y p e c h e c k e r

wh a t ' s t h e mi n i mu m s e t

  • f

f e a t u r e s s

  • t

h a t i t c a n c h e c k i t s e l f ?

slide-62
SLIDE 62

t l t l . t l : c u r r e n t l y f a i l s wi t h 3 8 4 t y p e e r r

  • r

s

slide-63
SLIDE 63

t l t l . t l : c u r r e n t l y f a i l s wi t h 3 8 4 t y p e e r r

  • r

s (

  • n

e we e k a g

  • i

t wa s 1 4 9 3 ! )

slide-64
SLIDE 64

T y p e S c r i p t : J a v a S c r i p t

  • l

i k e

( f e a t u r e s , f e a t u r e s , f e a t u r e s ! )

t l : a i mi n g f

  • r

L u a

  • l

i k e

( a b a l a n c e b e t we e n f u n c t i

  • n

a l i t y a n d s ma l l s i z e )

slide-65
SLIDE 65

h t t p : / / g i t h u b . c

  • m/

h i s h a mh m/ t l

slide-66
SLIDE 66

s

  • ,

i n c l

  • s

i n g

slide-67
SLIDE 67

L u a a n d t y p e s : t

  • b

e c

  • n

t i n u e d ! t h a n k y

  • u