ãTypeScriptã§ã¯ãããåã·ã¹ãã ãã¨ããè¨äºãnæåã©ã ããã¼ãã«å¯ç¨¿ãã¾ããã
æ°åãçºå£²ãã¾ãã "ãnæåã©ã ããã¼ããVol.4 No.3ï¼2024ï¼çºè¡ã®ãç¥ãã https://t.co/PGppk1aRRA
— lambdanote (@lambdanote) 2024å¹´10æ4æ¥
ã©ããªå 容ï¼
TypeScriptã®æ¥µå°ãµãã»ããã«å¯¾ããåæ¤æ»å¨ãæ¸ãããããéãã¦åã·ã¹ãã ãä½æãã¦ã¿ãããã¨ããå 容ã§ãã
詳ããè¨ãã¨ãbooleanåã¨numberåã¨é¢æ°åãããªãTypeScriptãµãã»ããè¨èªãã¿ã¼ã²ããã§ãã åæ¤æ»å¨ã®å®è£ è¨èªã«ãTypeScriptï¼å¦çç³»ã¯Denoï¼ã使ãã¾ãã TypeScriptã¥ããã®ä¸åã§ãã
ããã人åãã«è¨ãã¨ããåã·ã¹ãã å ¥éãã¨ããæ¬ï¼é称TAPLï¼ã®åç´åä»ãã©ã ãè¨ç®ã«ç¸å½ããå 容ãTypeScriptã§èª¬æãã¦ã¿ãããã ãå®çã証æã¯ãã¹ã¦çãããã¨ããæãã§ãã
ãªãæ¸ããï¼
ãã£ãããããã¤ãããã¾ããã
TypeScriptçéã§TAPLãèªã¾ãã¦ãããããã¨èãã
ãã¨ãã¨ãåã·ã¹ãã ãå®åããã°ã©ãåãã«èª¬æããè¨äºãæ¸ãã¦ã¿ããã¨ããæ°æã¡ã¯ãã£ã¨ããã¾ããã TAPLã¯æ å ±ç§å¦å°æ»ã®å¤§å¦é¢çåãã®æç§æ¸ãªã®ã§ãããåã·ã¹ãã ã¨ãããã£ããã¼ãªå 容ãããå®åããã°ã©ãã«ã注ç®ããã¦ãã¾ãã ãããTAPLã¯ããã¾ãå®åã§è¦ãããªãMLã¨ããè¨èªã§èª¬æããã¦ããä¸ãå®çã¨è¨¼æãç´é¢ã®ååããããå ãã¦ããã®ã§ããéä¸ã§è±è½ããããåã·ã¹ãã å ¥éå ¥éã欲ãããã¨ãã話ãããèãã¦ãã¾ããã
TAPLã翻訳ããã®ã¯12å¹´ãåã®ãã¨ã§ãããä»å¹´ã«ãªã£ã¦æ¥ã«ãæ¥æ¬ã®TypeScriptçéã§TAPLãèªãã§ãã人ãã¡ãçµæ§ãããããã¨å°è³ã«ã¯ãã¿ã¾ããã ãããè¤æ°ã®çµè·¯ã§åæå¤çºçã«ã ãã®ãã¡ã®ã²ã¨ã¤ã§ã¯ãTAPLã®è¨³è ã¨ãã¦å£°ãããã¦ããã ãããã¼ã¯ããã¦ãããã¾ããã
ãåã·ã¹ãã å ¥éãã®ã¤ãã³ãããã«ã¯ãã¬ã¯ãTAPLã«ã¿ãã¨ããã«åå ãã¾ãããã©ã®çºè¡¨ãããããããããããã人ãã¡ã¨è©±ãã¦ã¨ã¦ã楽ããä¼ã§ããã
— Yusuke Endoh (@mametter) 2024å¹´7æ24æ¥
èªåã¯TAPL翻訳æã®ã¨ãã½ã¼ãã話ããã®ã§ãè³æãããã¦ããã¾ã #TAPLts https://t.co/Ohvzwn95uF
ããã§ãããã¾ããè¨äºãæ¸ãã¹ããªã®ã§ã¯ï¼ãã¨ããæ°åãé«ã¾ãã¾ããã
TypeScriptã®è£å´ã調ã¹ã¦ã¿ããã£ã
ããã²ã¨ã¤ã®åæ©ã¨ãã¦ã¯ãTypeScriptã®è¨è¨æ¹éãåæ¤æ»å¨ã®å®è£ ãå°ãçé¢ç®ã«ç解ãã¦ã¿ããã¨æã£ããã¨ã§ãã ç§ã¯TypeProfã¨ããRubyã®å解æå¨ãéçºãã¦ã¾ãã
TypeProfãä½ãããã§ãTypeScriptã¯ããããåèã«ãã¦ã¾ãã ãã ãTypeScriptã®ã¦ã¼ã¶ã¨ãã¦ã®ä½é¨ã¯å¤å°ç¥ã£ã¦ããã¤ããã§ãããè£å´ãçé¢ç®ã«è¦ããã¨ã¯ãªãã£ãã®ã§ããããã§å°ãã ããã¡ãã¨èª¿ã¹ã¦ããããã¨æã£ã¦ããã®ã§ããã ãã®å·çã¯ããã®ãã£ããã«ããªãã¾ããã
TypeScriptã¯åå®å ¨ãããªãï¼
ãããã¦èª¿ã¹ã¦ãããã¡ã«ããã£ãã®ã§ãããTypeScriptã¯ã¨ã¦ãããæå³ã§ãéãã«ä½ããã¦ããã¨ãããã¨ããããã¾ããã ããã¯ã漸é²çåä»ããã©ãããã¨ãã話ã§ã¯ãªãããã£ã¨å ¨ä½çãªè¨è¨ã»å®è£ æ¹éã®è©±ã§ãã
TypeScriptãè¦éãã¨ã©ã¼
å ¸åçãªä¾ã¨ãã¦ã¯ã次ã®ãããªæªåæåå¤æ°ã®åç §ãããããã°ã©ã ãåã¨ã©ã¼ã«ãªãã¾ããã
TypeScriptã®åãã§ãã¯ã¯ãã¹ãããã ãã©ãå®è¡ããã¨ã¨ã©ã¼ã«ãªãã³ã¼ããè¦ã¤ãããæã£ã¦ããããªãã·ã§ã³ã¨ãããã®ããª
— Yusuke Endoh (@mametter) 2024å¹´6æ15æ¥
const f = () => x;
f(); //=> Cannot access 'x' before initialization
const x = 1;https://t.co/axWeEStF0c
åæ¤æ»å¨ããã®ãããªè¦éããããå ´åãåå®å ¨æ§ãããã¨ã¯è¨ããªãã®ããµã¤ãã ã¨æãã¾ãã ããã¯TDZï¼Temporal Dead Zoneï¼ã¨å¼ã°ããJavaScriptã®ä»æ§ãªã®ã§ãã¡ãã£ã¨èãã¦ã¿ãã¨ãJavaScriptã®æ§æãä¿ã£ãã¾ã¾è§£æ±ºããã®ã¯ããããããã§ãã å®éãTypeScriptã«issueãããã£ã¦ãã¾ãããããã£ãã«åºã¦ããªãã±ã¼ã¹ãªã®ã§æ°ã«ãããªãã¨ãããã¨ã§Wontfixã¨ãªã£ã¦ã¾ããã
ä»ã«ãããå ¨ç¶é¢ä¿ãªãå¤æ°å®£è¨ãåé¤ããã¨ãåºãã¹ãã¨ã©ã¼ãæ¶ãã¦ãã¾ããã¨ãããããªãç解ä¸è½ãªæåãããä¾ãä½ãã¦ãã¾ãã¾ããã
TypeScriptã®ãã®ä¸æè°ãªæåã説æã§ãã人ãã¾ãï¼https://t.co/QUOwpgu0uS pic.twitter.com/KweUd2WzEl
— Yusuke Endoh (@mametter) 2024å¹´7æ8æ¥
ã¡ãªã¿ã«ãTypeScriptãæ¬å½ã«åå®å ¨ã§ãªããã¯ãåå®å ¨ã®å®ç¾©ã«ããã¾ããJavaScriptã«ãã©ã³ã¹ãã¤ã«ãããã®ã§ãæªå®ç¾©åä½ã«é¥ããã¨ã¯åççã«ãªãããããTypeScriptã¯ä½ãããªãã¦ãåå®å ¨ã ãã¨ãã主張ããµã¤ãã«ãããã¾ãããã®ã¸ãã¯è¨äºã®ã³ã©ã ã«ããããæ¸ããã®ã§åç §ãã ããã
ããã§ãTypeScriptã¯ãããã®
ãéããåå®å ¨ãããªããã¨ããã¨ãTypeScriptãæªãè¨ã£ã¦ããã¨æãããããç¥ãã¾ããããã¾ã£ããéã§ãã
ç¾å®åé¡ã¨ãã¦ãTypeScriptã便å©ã§ãããã¨ã«ç°è«ãæã人ã¯å°ãªãã¨æãã¾ãã JavaScriptã¯æ§ããã«è¨ã£ã¦ãï¼åçåä»ãäºã 以åã«ï¼ããããã¨å³ããè¨èªã ã¨æãã®ã§ãããTypeScriptã¯JavaScriptã®ãã³ããè² ã£ã¦ãªã便å©ãªã®ã§ãæå¥ãªããããã§ãã
åã·ã¹ãã ã«è©³ãã人ã¯åå®å ¨æ§ãæ°ã«ããã¡ãªã®ã§ãããTypeScriptã¯ãå¥ã«å ¨é¨ã®åã¨ã©ã¼ãæ¤åºã§ããªãã¦ãããï¼åå®å ¨ãããªãã¦ããï¼ãã¨ããæãåã£ãå²ãåãããã¦ãã¾ãã ããã§ãã¦ããç¾å®çã«ãããããã°ã¯å¤§ä½æ¤åºã§ãã¦ä¾¿å©ãã¨ãã絶å¦ãªãã©ã³ã¹ãéæãã¦ãã¾ãã
ã¡ãªã¿ã«ãã¡ããã©kmizuãããã»ã¼åããããªãã¨ãè¨ã£ã¦ã¾ããã
åã·ã¹ãã ã®å°é家ã¯ï¼å½ç¶ãªããï¼soundnessãã£ã¡ãæ°ã«ãããæ°ããã¾ãããå®ç¨çãªè¦ç¹ããèããã¨ãå²ã¨ã©ãã§ãããunsoundãªã¨ããã¨ã©ãã§ããããªãunsoundãªã¨ãããããå°è±¡ãâ¦
— kmizu (@kmizu) 2024å¹´10æ2æ¥
TypeScriptã®è¨è¨è ã®è¨è
Anders Hejlsbergèªèº«ãã次ã®ããã«è¨ã£ã¦ãã¾ãã
If you can't achieve perfection then you don't even try to go there and that means you cut out a whole bunch of possible things that you could do that you might not be able to prove soundness for, but we don't have that restriction and that actually makes our work very interesting because we can go in places where people typically don't go.
éãªæ訳ï¼åã®ç 究è ã¯åå®å ¨æ§ã証æã§ãããã«ãªããã¨ã¨è©¦ããã¨ãããªãã®ã§ãå®ã¯ããããã§ãããã¨ãåãæ¨ã¦ã¦ãã¾ã£ã¦ãããTypeScriptã«ã¯ããããå¶ç´ããªãããã®ãããã§ããããã¯ãä»ã®åç 究è ããµã¤ãã¯è¡ããªãé åã«è¸ã¿è¾¼ããã®ã§ãã¨ã¦ãé¢ç½ãä»äºãã§ãã¦ããã
ãããåã®ç 究è ã«ã¯çµæ§è¾è¾£ã§ããã
å人çã«ã¯ããããããåå®å ¨ãããªãã¦ã便å©ãªå解æå¨ãã¯å®éã«åå¨ã§ãããã ã¨ããã®ã確信ã§ãã¦ããã£ãã§ãã TypeProfãããããã¨ãããç®æãã¦ãã¦ãå®ç¾ã§ããã®ãèªåã§ãåä¿¡åçã§ãã£ã¦ããã®ã§ãããéæããå®ä¾ãããã¨ããã®ã¯å¿å¼·ãæãã¾ããã TypeProfããã®ã¯ãªãªãã£ã¨ãã©ã³ã¹ãç®æããããã®ã§ãã
è¨äºã«ã¤ãã¦éå¤ãªãã¨
ãã¼ãµã¯ã©ããã
TypeScriptãµãã»ããã®åæ¤æ»å¨ãä½ãããã«ã¯ãã¼ãµãå¿ è¦ã ã£ãã®ã§ããããã®æ¸ãæ¹ã解説ãã¦ããã¨æ¥ãæ®ããã®ã§ããããããç¨æãã¦ããã¾ããã
https://github.com/LambdaNote/support-ts-tapl/blob/main/utils.ts
eslintã§ä½¿ããã¦ããtypescript-estreeãã©ããããæãã§ä½ã£ã¦ã¾ãã
TypeScriptããã¸ã§ã¯ãã®ããæ¸ãæ¹ãããããªãã£ãã®ã§ãã¨ããããDenoå°ç¨ã«ãªã£ã¦ã¾ãã TypeScriptã«è©³ãã人ãã¿ããå¤ãªæãã«ãªã£ã¦ãããªã®ã§ãé©å½ã«PRãããã¨ããããã§ãã
Rubyãããªãã®ã¯ãªã
Rubyã®åã®éçºã«åå ãã¦ããç«å ´ã§ãããªãããRuby + RBSãè¨äºã®é¡æã«ããªãã£ãã®ã¯ãä¸ã«æ¸ããåæ©ã®ã¨ãããªã®ã§ãããããã«æè¡çãªçç±ã¨ãã¦ãRubyã§ã¯ç¡åé¢æ°ã第ä¸ç´ã®è¨èªæ©è½ãããªãããã§ãã TAPLãã¼ã¹ã®åã·ã¹ãã ã説æãããã¨ããè¨äºã®æ¹åæ§ã«ã¯ãç¡åé¢æ°ãå¿ è¦ã§ããã ãã¡ããProcã¯ããã¾ãããdefã使ããã«Procã ãã§ããã°ã©ã ãæ¸ãã®ã¯ãµã¤ãã®Rubyãããªããããã®ã§ã
ç¶ããèªã¿ãã
åç´åä»ãã©ã ãè¨ç®ã§çµãã£ã¦ããã®ã§ã人ã«ãã£ã¦ã¯ãããã§çµããï¼ãã£ã¦æãããããã¾ããã basic.tsã¯é¨ååä»ããåã¨ã¤ãªã¢ã¹ãã¸ã§ããªã¯ã¹ãªã©ãä»ã足ãã¦ããããã®åå°ã«ãªã£ã¦ãã¾ãã ä»åã®åé¿ããããã°ããããã§è¨èªæ¡å¼µããã¨ããç¶ããåºãããã¨æã£ã¦ãã¾ãã