iOS オールスターズ2でお話しした資料です! Swift らしさってなんだろう、そんなところを API デザインガイドラインと Swift 標準ライブラリの表現に着目して 7 つほど紹介してみました。あくまでも "指針" なので『そういう風に考えていくのね』みたいに捉えて、そこからは "自分らしい" 言葉を紡いでいってくれたらいいのかなって思います。
iOS オールスターズ2でお話しした資料です! Swift らしさってなんだろう、そんなところを API デザインガイドラインと Swift 標準ライブラリの表現に着目して 7 つほど紹介してみました。あくまでも "指針" なので『そういう風に考えていくのね』みたいに捉えて、そこからは "自分らしい" 言葉を紡いでいってくれたらいいのかなって思います。
asm.js x emscripten: The foundation of the next level Web gamesNoritada Shimizu
Game requires high performance to its run times. asm.js brings Web browsers high performance JavaScript processing and allows us to build heavy games on the top of Web browsers. In this talk, we can see 1 )the background of asm.js 2) asm.js details and 3) overview of emscripten, a compiler which emits asm.js formatted JavaScript code from C/C++.
asm.js の詳細と emscripten の簡単な使い方について解説します。
Event : Visual Studio Users Community Japan #1
Date : 2019/09/14
ソフトウェア/サービス開発において最も後回しにされるものの代表が「パフォーマンスの向上」です。C#/.NET の最大の武器は開発生産性ですが、C# 7.0 以降はパフォーマンス向上のための機能追加が多数行われています。いくつかのポイントを押さえることで実装時からより高速なコードを書くことができるようになります。
このドキュメントでは、そんなポイントとなる箇所をふんだんにお届けします。
14. 型の力
●
JavaScriptの例と似たようなやつ
import Data.IORef
action :: IO ()
action = do
x <- newIORef 1
a <- f x 10 – 11
b <- f x 1 – 3
c <- f x 10 – 13
return ()
f :: IORef Int -> Int -> IO Int
f x y = do
current <- readIORef x
modifyIORef x (+1) – 副作用
return $ current + y
15. import Data.IORef
action :: IO ()
action = do
x <- newIORef 1
a <- f x 10 – 11
b <- f x 1 – 3
c <- f x 10 – 13
return ()
f :: IORef Int -> Int -> IO Int
f x y = do
current <- readIORef x
modifyIORef x (+1) – 副作用
return $ current + y
型の力
●
JavaScriptの例と似たようなやつf x 10
同じ呼び出しで違う戻り値
これはIO型の
副作用によるもの
16. import Data.IORef
action :: ()
action = do
x <- newIORef 1
a <- f x 10
b <- f x 1
c <- f x 10
return ()
f :: Int -> Int -> Int
f x y = do
current <- readIORef x
modifyIORef x (+1)
return $ current + y
型の力
●
JavaScriptの例と似たようなやつ
関数のIO …を消すと ?
19. 型の力
●
副作用がないはずの型の関数に
副作用が含まれているので
コンパイルエラー
Program.hs:4:1:
Couldn't match expected type ‘IO t3’ with actual type ‘()’
In the expression: main
When checking the type of the IO action ‘main’
Program.hs:5:3:
Couldn't match type ‘IO ()’ with ‘()’
Expected type: IO (IORef Integer) -> (IORef Integer -> IO
()) -> ()
Actual type: IO (IORef Integer)
-> (IORef Integer -> IO ()) -> IO ()
In a stmt of a 'do' block: x <- newIORef 1
In the expression:
do { x <- newIORef 1;
a <- f x 10;
b <- f x 1;
c <- f x 10;
20. 型の力
●
副作用がないはずの型の関数に
副作用が含まれているので
コンパイルエラー
Program.hs:4:1:
Couldn't match expected type ‘IO t3’ with actual type ‘()’
In the expression: main
When checking the type of the IO action ‘main’
Program.hs:5:3:
Couldn't match type ‘IO ()’ with ‘()’
Expected type: IO (IORef Integer) -> (IORef Integer -> IO
()) -> ()
Actual type: IO (IORef Integer)
-> (IORef Integer -> IO ()) -> IO ()
In a stmt of a 'do' block: x <- newIORef 1
In the expression:
do { x <- newIORef 1;
a <- f x 10;
b <- f x 1;
c <- f x 10;
Program.hs:6:8:
Couldn't match expected type ‘IO t0’ with actual type ‘In
In a stmt of a 'do' block: a <- f x 10
In the expression:
do { x <- newIORef 1;
a <- f x 10;
b <- f x 1;
c <- f x 10;
.... }
21. 型の力
●
副作用がないはずの型の関数に
副作用が含まれているので
コンパイルエラー
Program.hs:4:1:
Couldn't match expected type ‘IO t3’ with actual type ‘()’
In the expression: main
When checking the type of the IO action ‘main’
Program.hs:5:3:
Couldn't match type ‘IO ()’ with ‘()’
Expected type: IO (IORef Integer) -> (IORef Integer -> IO
()) -> ()
Actual type: IO (IORef Integer)
-> (IORef Integer -> IO ()) -> IO ()
In a stmt of a 'do' block: x <- newIORef 1
In the expression:
do { x <- newIORef 1;
a <- f x 10;
b <- f x 1;
c <- f x 10;
Program.hs:6:8:
Couldn't match expected type ‘IO t0’ with actual type ‘In
In a stmt of a 'do' block: a <- f x 10
In the expression:
do { x <- newIORef 1;
a <- f x 10;
b <- f x 1;
c <- f x 10;
.... }
Program.hs:7:10:
Couldn't match expected type ‘Int’ with actual type ‘IORef
Integer’
In the first argument of ‘f’, namely ‘x’
In a stmt of a 'do' block: b <- f x 1
Program.hs:8:8:
Couldn't match expected type ‘IO t2’ with actual type ‘Int’
In a stmt of a 'do' block: c <- f x 10
In the expression:
do { x <- newIORef 1;
a <- f x 10;
b <- f x 1;
c <- f x 10;
>> Too many compile error <<