åã®æ¹èš
Cããã°ã©ãã³ã°èšèªã®ä»æ§ãããªããžã§ã¯ãããšããçšèªãæãããšãå€ãããšããåç¥ã§ããïŒ ããããããã¯OOPã§èšè¿°ãããŠãããšããæå³ã§ã¯ãªããžã§ã¯ãã§ã¯ãããŸãããCã®ãªããžã§ã¯ãã¯ãã©ã³ã¿ã€ã ã®ããŒã¿ãããã¯ã§ããããã®å 容ã¯äœããã®å€ãè¡šãããšå®çŸ©ãããŠããŸãã ãã®ãªããžã§ã¯ãã®ç解ã§ã¯ãããšãã°ãcharåã®ãªããžã§ã¯ããã«ã€ããŠè©±ãã®ãçã«ããªã£ãŠããŸãã
ãã¡ãœããããšããçšèªã¯éåžžã«äžè¬çã§ããããã¯ã©ã¹ã¡ã³ããŒé¢æ°ããšã ãèšãããã°ã©ãã«åºäŒããããããŸããã ãããã£ãŠãJavaããã°ã©ãã³ã°èšèªã«ã¯ãã ãã«å°ãããã«å¿ããŠãæ©èœãããå Žåãšãªãå ŽåããããŸãã ãããã·ãŒãžã£ãããã³ããµãããã°ã©ã ããšããçšèªã¯ãé¢æ°ãã®é¡äŒŒèªãšããŠäœ¿çšãããå ŽåããããŸãããäžéšã®ããã°ã©ãã³ã°èšèªïŒPascalãªã©ïŒã§ã¯ãããã·ãŒãžã£ã¯é¢æ°ãšãŸã£ããåãã§ã¯ãããŸããã
1ã€ã®ããã°ã©ãã³ã°èšèªã®ãã¬ãŒã ã¯ãŒã¯å ã§ããæ··ä¹±ããããšããããŸãã
Pythonããã°ã©ãã¯ãå±æ§ã®ä»£ããã«ãããããã£ããšããçšèªã䜿çšããŠãã£ããã§ããŸãããäž¡æ¹ã®çšèªã¯èšèªã«ååšããå®å šã«åäžã§ã¯ãããŸããã ãåŒæ°ããšããã©ã¡ãŒã¿ãã«ã¯éãããããŸãããæ°ã«ãã人ã¯ããã䟿å©ã ãšæãããç¹å®ã®åèªãçºé³ããŸãã ç§ã¯ãããé¢æ°ã€ã³ã¿ãŒãã§ãŒã¹ãïŒã 眲å ãïŒãšããçšèªã䜿çšããŸãããä»ã®äººããããè¡ãããšã¯ãã£ãã«ãããŸããã
ãfloat data typeããšèšããšãCããã°ã©ããŒã¯ãå粟床浮åå°æ°ç¹åããšèããPythonããã°ã©ããŒã¯å粟床åãæå³ãããŠããããšã確èªããŸãã ãããŠãããã¯ææªã®ã±ãŒã¹ã§ã¯ãããŸããããšããã®ã¯ãåèªã¿ã€ããèšåããããšããããã¯äžè¬ã«ãã®ãµã€ãºã«é¢ããŠå°ãªããšã4ã€ã®ç°ãªã解éãæå³ããå¯èœæ§ãããããã§ãã
åé¡ã®äžéšã¯ããã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ããšèšããšããå®éã«ã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ã«ã€ããŠè©±ããŠããªãããšã§ãã ç§ãã¡ã¯ããã€ãã®ã»ããïŒæ°çŸããïŒ ã§å®çšçãªããã°ã©ãã³ã°ã«åãçµãã§ããŸã ãéçæ³çãªããã°ã©ãã³ã°èšèªã¯ãããããç¬èªã®ç¹æ§ãšçããããŸãã åæã«ãç¹å®ã®ïŒéãããïŒæ°ã®çšèªããããŸãããããã¯ç°ãªãèšèªã®ç°ãªãæ©èœã«é©çšãããå Žåããããå Žåã«ãã£ãŠã¯ããã§ã¯ãããŸããã Javascriptã§ããã°ã©ãã³ã°ãåŠã³å§ãã人ã¯ããã¯ã©ã¹ããäœã§ãããã«ã€ããŠããçšåºŠã®èããæã¡ãããã¯æåã®èšèªãRubyã§ãã人ã®èããšã¯éåžžã«ç°ãªãã§ãããã 人ã ã¯ãããèšèªã®èæ¯ãå¥ã®èšèªã«æã£ãŠæ¥ãŠãäŸãã°ãéåžžã®ééã¯ãªããšããéé£ãå§ããŸãããªããªãã圌ãã®èšèªã§ã¯ãééããšããçšèªã¯å®å šã«ç°ãªãäœããæå³ããããã§ãã
æã ãã©ãããããããããããã¹ãŠã«èããããšãã§ããŸãã ãããŠãæã«ã¯æ¥ãããããçããããšããããŸãã ãã®ãããªç¶æ³ã®ç§ã®ïŒæãå°ãªãïŒïŒãæ°ã«å ¥ãã®äŸã次ã«ç€ºããŸãã
é åããã¯ãã«ãããã³ãªã¹ã
Cã§ã¯ãé åã¯ãåãã¿ã€ãã®å€æ°ã®ïŒæ確ã«å®çŸ©ãããïŒéã®å€ãé 眮ã§ããé 次ããŒã¿ãããã¯ã§ãã int [5]ã¯ãintåã®5ã€ã®å€æ°ã次ã ã«çŽæ¥æ ŒçŽããããã«èšèšãããé åãèšè¿°ããŸãã
C ++ã¯ããã¯ãã«ã®æŠå¿µããçŸåšã®ããŒãºã«åãããŠèªåçã«ãµã€ãºå€æŽã§ããé åã®é¡äŒŒç©ãšããŠå°å ¥ããŸãã ãªã¹ãã®æšæºã¿ã€ãããããŸãããã®å Žåãäºéãªã³ã¯ãªã¹ããåç §ããŸãïŒå®éãæšæºã¯ç¹å®ã®å®è£ ã«èŠä»¶ãæ瀺ããŠããŸããããæ©èœèŠä»¶ã«ãããé åã«åºã¥ããã¯ãã«ãããã³äºéã«ãªã³ã¯ããããªã¹ãã«åºã¥ããªã¹ããè«ççã«å®è£ ããŸãïŒã ããããã¡ãã£ãšåŸ ã£ãŠãã ããïŒ C ++ 11ã§ã¯ããinitializer_listããšããçšèªãå°å ¥ãããŠããããã®ååã«ã¯ãlistãïŒãªã¹ãïŒãšããåèªãå«ãŸããŠããŸãããå®éã¯é åã§ãã
ãã¡ãããLispãªã¹ãã¯ãªã³ã¯ãªã¹ãã§ãããããé ãšå°Ÿãžã®ã¢ã¯ã»ã¹ã®èŠ³ç¹ãããªã¹ããç°¡åã«åŠçã§ããŸãã HaskellãåäœããŸããããã«ãã€ã³ããã¯ã¹ã«ãã£ãŠã¢ã€ãã ã«ãã°ããã¢ã¯ã»ã¹ããããã®Data.ArrayããããŸãã
Perlã§ã¯ãã·ãŒã±ã³ã¹åã¯é åã§ãããããã§äœ¿çšããã®ã«ãåããšããèšèã¯ããŸãé©åã§ã¯ãããŸãããããããå€æ°ã®åœ¢åŒã§ãã Perlã«ã¯ããªã¹ãããšããæŠå¿µããããŸãããããã¯åŒã®è©äŸ¡ã®äžéšãšããŠååšããäžæçãªãªããžã§ã¯ãã«ããããåŸæ¥ã®ã³ã³ãããŒããŒã¿åã§ã¯ãããŸããã ããã¯ããªãå¥åŠãªããšã§ããããã®èª¬æã«ã¯è€æ°ã®æ®µèœãå¿ èŠãªã®ã§ãããããã¯å§ããŸããã
Pythonã§ã¯ããªã¹ãã¯C ++ã®ãã¯ãã«ã«äŒŒãããããã£ãæã€åºæ¬ããŒã¿åã§ãããïŒCPythonã§ã¯ïŒCé åã«åºã¥ããŠå®è£ ãããŸãã æšæºã©ã€ãã©ãªã¯ãã»ãšãã©äœ¿çšãããªãããŒã¿åé åãæäŸããŸããããã¯ãCé åã«æ°å€ãããã¯ããŠã¹ããŒã¹ãç¯çŽããCãä»ããŠPythonã«ã¢ã¯ã»ã¹ããããã°ã©ããŒãæ··ä¹±ãããŸãã ãããçµã¿èŸŒã¿ã®ãã€ãé ååããŸã ãããŸãããããã¯ãã€ããæ ŒçŽããé åãšã¯ç°ãªããŸãã
Javascriptã«ã¯é ååããããŸãããæååïŒïŒïŒããŒãæã€ããã·ã¥ããŒãã«ã®äžã«æ§ç¯ãããŸãã Cé åã«æ°å€ãæ ŒçŽããããã®ArrayBufferããããŸãïŒPythonã®é åã¿ã€ãã«éåžžã«äŒŒãŠããŸãïŒã
PHPã§ã¯ãé åãšåŒã°ããããŒã¿åã¯ãå®éã«ã¯æååïŒïŒïŒããŒãæã€é åºä»ãããã·ã¥ããŒãã«ã§ãã PHPã«ããªã¹ãããããŸãããããã¯ããŒã¿åã§ã¯ãªããåãªãæ§æäžã®ç ç³ã§ãã PHPããä»ã®èšèªã«åãæ¿ãã人ã¯ãå€å žçãªããã·ã¥ããŒãã«ãæŽç¶ãšããŠããªãããã«èŠããããšã«æã é©ããããŸãã
Luaèšèªã¯ãé åããã¯ãã«ããŸãã¯ãªã¹ãã®çšèªããŸã£ãã䜿çšããã«ãããããçš®é¡ã®äŒçµ±ãæåŠããŸãã ããã«ããå¯äžã®ããŒã¿åã¯ããŒãã«ãšåŒã°ããŸãã
2åèµ·ããªãããã«ãé£æ³ã³ã³ããã®ããŒã¿åã®ååãèŠãŠã¿ãŸãããã
C ++ ïŒãããïŒãã ããããã¯å®éã«ã¯ãã€ããªããªãŒã§ããC++ 11ã¯ããã·ã¥ããŒãã«ã§ããunordered_mapãè¿œå ããŸãïŒ
JavaScript ïŒãªããžã§ã¯ãïŒïŒïŒïŒããã¯å®éã«ã¯å€å žçãªé£æ³é åã§ã¯ãããŸããããæååããŒã§ã¢ã¯ã»ã¹å¯èœãªå€ãæ ŒçŽã§ããŸãããŸããMapããŒã¿åããããŸããïŒ
ã«ã¢ ïŒããŒãã«
PHP ïŒé åïŒïŒïŒïŒæååããŒã®ã¿ïŒ
Perl ïŒããã·ã¥ïŒãŸããã¿ã€ãã§ã¯ãªãããã©ãŒã ãã«å ããŠãããã·ã¥ã¯å®å šã«ç°ãªããã®ãšãåŒã°ãããšããäºå®ã«ããææ§ããããã«æååããŒã®ã¿ïŒ
Python ïŒdict
Rust ïŒãããïŒ2ã€ã®å¥åã®ã¿ã€ã-BTreeMapãšHashMapãšããŠååšããŸããïŒ
ãã€ã³ã¿ãŒããªã³ã¯ããšã€ãªã¢ã¹
Cã«ã¯ãäžéšã®ããŒã¿ãã¡ã¢ãªã«ä¿åããããã®ã¢ãã¬ã¹ã§ãããã€ã³ã¿ãŒããããŸãã Cã®å Žåãããã¯èªç¶ãªããšã§ããCã®ãã¹ãŠãã¡ã¢ãªå ã®ããŒã¿ã管çãã1ã€ã®å€§ããªããŒã¿ãããã¯å ã®ã¢ãã¬ã¹ãšããŠãã¹ãŠã®ããŒã¿ãè¡šçŸããããšã«é¢ãããã®ã§ããããã§ãã ãã€ã³ã¿ã¯ããã®å€§ããªããŒã¿ãããã¯ã®åãªãã€ã³ããã¯ã¹ã§ãã
C ++ã¯ãCãããã€ã³ã¿ãŒãç¶æ¿ãããããã®ä¹±çšã«å¯ŸããŠçŽã¡ã«èŠåããŸãã å¥ã®æ¹æ³ãšããŠããã€ã³ã¿ãšãŸã£ããåãããã«èŠããããã*ãæŒç®åã䜿çšããå¿ èŠã®ãªãå€ã«ã¢ã¯ã»ã¹ããããã®ãªã³ã¯ãææ¡ãããŸãã ããã«ãããCã«ã¯ãªãã£ãæ°ããïŒéåžžã«å¥åŠãªïŒæ©äŒãããã«äœæãããŸãã2ã€ã®ããŒã«ã«å€æ°ãã¡ã¢ãªå ã®åãããŒã¿ãããã¯ãæãããšãã§ãããããè¡a = 5; å€æ°bã®å€ãå®å šã«å€æŽã§ããŸãã
Rustã«ã¯ãªã³ã¯ããããC ++æ§æã䜿çšããŸãããå®éã«ã¯ãåçšãã€ã³ã¿ãŒãã§ãïŒã€ãŸãããã€ã³ã¿ãŒã§ãããééçã§ãïŒã Cãã€ã³ã¿ãŒã®æ§æã䜿çšããèšèªã«ã¯ãããŸãäžè¬çã§ã¯ãªããçŽç²ãªãã€ã³ã¿ãŒãããããŸãã
Perlã«ã¯ãªã³ã¯ããããŸãã 2ã€ã®å¥åã®ã¿ã€ãã®ãªã³ã¯ã§ãã ããŒããªã³ã¯ïŒã¢ãã¬ã¹ãå©çšã§ãããã¢ãã¬ã¹ãçŽæ¥äœ¿çšããªãããšãæå³ããå¯äžã®äŸå€ãé€ããCã®ãã€ã³ã¿ãŒã®é¡äŒŒç©ïŒããã³ãœãããªã³ã¯ãå€æ°ã®å 容ãå¥ã®å€æ°ã®ååãšããŠäœ¿çšããŸãã ãŸããPerlã«ã¯ãC ++ã®åç §ãšåæ§ã«æ©èœãããšã€ãªã¢ã¹ããããŸãããããŒã«ã«å€æ°ã§ã¯æ©èœãããå®éã«ã¯ããŒã¿åã§ã¯ãªããåãªãã·ã³ãã«ããŒãã«ã®æäœã§ãã
PHPã«ã¯ãªã³ã¯ããããŸãããPerlã®åœ±é¿ã«ããããããããªã³ã¯æ§æã¯C ++ããåãããŸããã C ++ã¯ããããåç §ããå€æ°ã®ã¿ã€ãã«ãã£ãŠãªã³ã¯ãå®çŸ©ããŸãã ããããPHPã«ã¯å€æ°ã®å®£èšããªããããå€æ°ã¯ãïŒæŒç®åãå«ãç¹å®ã®æäœã»ããã«åå ããç¬éãããªã³ã¯ãšèŠãªããå§ããŸãã ãã®éæ³ã®ã·ââã³ãã«ã¯ãå€æ°ã«ãåç §æ§ãããææããããŸãã
PythonãRubyãJavaScriptãLuaãJavaãããã³ä»ã®å€ãã®èšèªã«ã¯ããã€ã³ã¿ãŒããªã³ã¯ããŸãã¯ãšã€ãªã¢ã¹ããããŸããã ããã¯ãç¹å®ã®é«ã¬ãã«ã®ããšã説æããéçšã§ããããã瀺ã...ãããããã¯...ãåç §ããããªã©ã®ãã¬ãŒãºããã°ãã°èšããªããã°ãªããªããããCããã³C ++ã®äžçããæ¥ã人ã ã«ãšã£ãŠãããã®èšèªãç解ããããšãå°é£ã«ããŸãããã¯äººã ã誀解ãããã¡ã¢ãªå ã®ç¹å®ã®é åãžã®ãã€ã³ã¿ãŸãã¯ãªã³ã¯ãå®éã«ããããã®å 容ã«çŽæ¥ã¢ã¯ã»ã¹ã§ãããšããå°è±¡ãäžããŸãã ãã®çç±ãããç§ã¯C ++ãšã€ãªã¢ã·ã³ã°ã®ãªã³ã¯ã®åäœãåŒã³åºããŸããããã¯ãäœãèµ·ãã£ãŠããããšããæ¬è³ªãããæ確ã«åæ ããããªã³ã¯ããšããåèªãããäžè¬çã«äœ¿çšããããã§ãã
åç §æž¡ãããã³å€æž¡ã
ãšããã§ããªã³ã¯ã«ã€ããŠã Python ã«ã€ããŠã¯ãã§ã«ããã説æããŸããããããã§çãããŒãžã§ã³ãããäžåºŠæžããŸãã ããã§éèŠãªè³ªåã¯èšèªCãæå³ãšèŠãªããã®ã§ããããã®è³ªåã¯Cã«é¢é£ããèšèªãã¡ããªãŒä»¥å€ã§ã¯æå³ããªããªãããããã®äºåæ³ã¯ã»ãšãã©ã®èšèªã§æå³ããªããªãã
ããã§ã®åºæ¬çãªåé¡ã¯ãCãæ§é ãèšè¿°ããããã®æ§æãæã£ãŠããããšã§ãããæ§é ã®èšèªã®ã»ãã³ãã£ã¯ã¹ã¯ã³ãŒãã§ã¯èŠãããŸãã-åãªããã€ãã®ã»ããã§ãã æ§é ã¯ã³ã³ããã®ããã«èŠããŸãããã®ãããªä¿¡é Œæ§ã®é«ãã³ã³ããã§ããå 容ã¯äžæ¬åŒ§ã§å²ãŸããŠãããããæŒç®åãããã䜿çšããå¿ èŠããããŸãã å éšã¡ã³ããŒã«ã¢ã¯ã»ã¹ããŸãã ããããCã®å Žåãæ§é ã¯ãã€ããªããŒã¿ã®åãªããããã¯ã§ãããintãšããã»ã©å€ãããããŸããå°ã倧ãããããããŸããã ãããã¯ããããªãã¯ãŸã ããã€ãã®å¥ã ã®ããŒã¿ãèŠãããšãã§ããŸãã ããæ§é ãå¥ã®æ§é å ã«é 眮ãããšãCèšèªã¯å€éšæ§é å ã®å éšãããã¯ã®ããŒã¿ãããã¯ãæãã«åé¢ããŸãã ããæ§é ãå¥ã®æ§é ã«å²ãåœãŠããšãããšãã°doubleåã®å€æ°ãå²ãåœãŠãå Žåãšåæ§ã«ãéåžžã®ãã€ãã³ããŒãçºçããŸãã ç·ã¯å¹»æ³çã§ãã ãã®çµæãCã§å¯äžã®ãæ¬åœã®ãã³ã³ããã¯ãã€ã³ã¿ã§ãïŒ
é¢æ°ã«æ§é äœãæž¡ããšãCã¯ä»ã®åã®å€æ°ã®ããã«ãæ§é äœãå®å šã«ã³ããŒããŸãã é¢æ°ã§æ§é ãå€æŽããå Žåã¯ãé¢æ°ã§é¢æ°ã«ãã€ã³ã¿ãŒãæž¡ãå¿ èŠããããŸãã éåžžã«å€§ããªæ§é äœãé¢æ°ã«æž¡ãããå Žåã¯ãããã©ãŒãã³ã¹ãåäžãããããã«åã³ãã€ã³ã¿ãŒã䜿çšããå¿ èŠããããŸãã
C ++ããªã³ã¯ã®æŠå¿µãå°å ¥ããŸãããããã¯ãCã®ãã¹ãŠã®ãã€ã³ã¿ãç°¡åãããŠãããã«ããã®ã«çªç¶æ°ã¥ããå Žåã«åããŠã§ãã ããã§ã以åãšåæ§ã«ãæ§é ããå€ã§ãæž¡ãããšãã§ããŸãããåŒã³åºãããé¢æ°ããªã³ã¯ãåãå ¥ããå Žåã¯ãæ§é ããåç §ã§ãæž¡ããé¢æ°ã¯ãããå€æŽã§ããŸãã é¢æ°ã®åŒæ°ã¯ãæž¡ãããå€æ°ã®ãšã€ãªã¢ã¹ã«ãªããããintã®ãããªåçŽãªåã§ãæžãæããããšãã§ããŸãã ãã®ãåç §ã«ãã転éãã¯ãããšã€ãªã¢ã¹ã«ãã転éããšåŒã°ããŸãã
JavaãPythonãRubyãLuaãJavaScriptãããã³ä»ã®å€ãã®èšèªã¯ãåå¥ã®ãšã³ãã£ãã£ãšããŠã³ã³ããäžã§åäœããŸãã å éšã«æ§é ãããå€æ°ãããããã®å€æ°ãå¥ã®å€æ°ã«å²ãåœãŠããšãå®éã«ã¯ã³ããŒã¯è¡ãããŸããã äž¡æ¹ã®å€æ°ãåç §ããããã«ãªããŸãã...ããããåç §ããªãã瀺ã...ïŒãããã瀺ããªãïŒ...
ãããŠã圌女ã¯ããã«ããŸã-çšèªã®åé¡ã§ãïŒ èšèªXããã©ã¡ãŒã¿ãŒãå€ã§æž¡ãã®ãåç §ã§æž¡ãã®ããå°ãããšããããããã®äººã¯Cèšèªã¢ãã«ã®èŠ³ç¹ã§èããä»ã®ãã¹ãŠã®èšèªããã®åºæ¬ã¢ãã«ã«äœããã®åœ¢ã§åœãŠã¯ãŸããã®ãšããŠæ瀺ããŸãã ãäž¡æ¹ã®å€æ°ãåç §ãããŠããããšèšãã°ãC ++ãªã³ã¯ïŒãšã€ãªã¢ã¹ïŒã«ã€ããŠè©±ããŠãããšæããããããŸããã ãäž¡æ¹ã®å€æ°ã瀺ãããšèšãã°ãCã¹ã¿ã€ã«ã®ãã€ã³ã¿ãŒã«ã€ããŠè©±ããŠãããšå€æã§ããŸãå€ãã®å Žåãèšèªã«ã¯æåã2çªç®ããããŸããã ããããè±èªã§ã¯ãç§ãã¡ãèšãããããšãè¡šçŸããä»ã®èšèã¯ãããŸããã
æå³çã«ã¯ãèšèªã¯ãå€æ°ã®å 容ïŒãã®æå³ïŒãæœè±¡çãªäžçã§ç¬èªã«ååšããŠãããã®ããã«åäœããå€æ°ã¯åãªãååã§ãã å²ãåœãŠã¯ãååãšå€ãé¢é£ä»ããŸãã ãããåå¿è ã«ãä»ã¯bãæããŠããããŸãã¯ãä»ã§ã¯åããªããžã§ã¯ããåç §ããŠããããšèª¬æããã®ã¯é åçã§ããããããã®èª¬æã¯å®éã«ã¯èšèªã«ååšããªãéæ¥æ§ãè¿œå ããŸãã aãšbã¯äž¡æ¹ãšãåããªããžã§ã¯ããåç §ããŸãã
ãã®å Žåã®é¢æ°åŒã³åºãã¯ãé¢æ°å ã®åŒæ°ãåŒã³åºãã³ãŒããé¢æ°ã«æž¡ããã®ãšåãå€ãæå®ãããããå²ãåœãŠãã©ãŒã ã§ãã ããããå€æŽããããšãã§ããŸã-ãŸããåŒã³åºãã³ãŒãã¯ãããã®å€æŽã®çµæãèŠãããšãã§ããŸãã åŒã³åºãããé¢æ°å ã§å€æ°ãåå²ãåœãŠããããšã¯ã§ããŸããããã®å Žåã®å€æ°ã¯ãšã€ãªã¢ã¹ã§ã¯ãããŸãããå€ãå²ãåœãŠããšãååïŒé¢æ°å ïŒãæ°ããå€ã«ãã€ã³ããããŸãããåŒã³åºãå ã®ã³ãŒãã®å€æ°ã«ã¯åœ±é¿ããŸããã ããã¯ãã¹ãŠãå€å žçãªãåç §æž¡ããããå€æž¡ãããããè¶ ããŠããŸãã 確ç«ãããçšèªã¯ãŸã£ãããããŸããããªããžã§ã¯ãã®è»¢éãååã«ãã転éã転éã®å ±æãšåŒã°ãããã®ãèããŸããã
ååãšããŠãC ++ã¹ã¿ã€ã«ã®åç §æž¡ãã¯ãä»ã®èšèªã§ãå®è£ ã§ããŸãïŒåè¿°ããããã«ãPHPã¯C ++ãªã³ã¯æ§æã䜿çšããŠãšã€ãªã¢ã¹ã§è»¢éã§ããŸãïŒã ãã ãããšã€ãªã¢ã¹ã«ããéä¿¡ã¯ãå€ã«ããéä¿¡ã®ä»£æ¿ãšããŠã®ã¿ååšããå€ã«ããéä¿¡ã¯ååšããŸããåäžçŽåã®äœã¬ãã«Cã§ã¯ãä»ã®ãã®ãå®è£ ããããšã¯äžå¯èœã ã£ãããã§ãã
å€ã§æž¡ãããšã§ã§ããããšã¯ãã¹ãŠãååã§æž¡ãããšã§æ瀺çãªã³ããŒãè¡ãããšã§ãã§ããŸãã ããã«å€ãã®å Žåããã®ãããªããšã¯ãé¢æ°ããããã€ãã®å€ãè¿ãããšãã§ããããã«ããããã«è¡ãããŸããããã¯ãé«ã¬ãã«èšèªã§ã¯ä»ã®å€ãã®æ¹æ³ã§è¡ãããšãã§ããŸãã
ç¡æã¿ã€ãã³ã°
ãã¡ããããã¯è§£éã®åé¡ã§ãããå人çã«ã¯ãããªãŒã¿ã€ãã³ã°ããªã©ã¯ååšããªããšç¢ºä¿¡ããŠããŸãã å°ãªããšãããã®çšèªã®ç¹å®ã®å®çŸ©ãèããããšã¯ãããŸããã
ç§ã¯æãåºãããŸãïŒ
- 匷åãªåæå®ããããŸããã€ãŸããå€æ°ããã®åãå€æŽããã«ãã³ãŒããå®è¡ãããæäœã«ãé©å¿ãããŸãã Rustã¯å³å¯ã«åæå®ãããèšèªã§ããããã32ããããš64ãããã®æŽæ°å€ãæ¯èŒãããšãšã©ãŒãçºçããŸãã
- 匱ãåä»ãããããŸããã€ãŸããèšç®åŒã«è¿ã¥ãããã«å€æ°ã®åãå€æŽã§ããŸãã JavaScriptã¯åŒ±ãåä»ãã®èšèªã§ããã5 +â 3âã¯æé»çã«æååãæ°å€ã«å€æããåŒã¯çµæ8ãè¿ããŸãïŒåè«ã§ããåœç¶ãçµæã¯â 53âã«ãªããŸãïŒã Cã®åã匱ããªããŸããintåã®å€æ°ãååŸããŠã3ãã«èšå®ããã ãã§ããšãã»ã³ããªãã¯ã§ãããã³ã³ãã€ã«ãããã³ãŒããååŸã§ããŸãã
- éçåä»ãããããŸããã€ãŸããå€æ°ã®åã¯ã³ã³ãã€ã«æ®µéã§æ¢ç¥ã§ãã Javaã¯éçåä»ããè¡ãèšèªã§ãã Javaã³ãŒããèŠãã ãã§ã-䜿çšãããŠããåã®ååã®70ïŒ ã§æ§æãããŠããããã§ãã
- åçåä»ãããããŸããã€ãŸããããã°ã©ã ã®å®è¡æã«å€æ°ã®åã決å®ãããŸãã Rubyã¯åçåä»ãèšèªã§ãããåã¯å®è¡æã«å®çŸ©ãããŸãã
ã匷ããã¿ã€ãã³ã°ãšã匱ããã¿ã€ãã³ã°ã®æŠå¿µã¯ãäžçã®èª¿åã®ãšããå³ãäœæããŸãã ãéçãããã³ãåçããªé¡ååãç解å¯èœã§ãããè£å®çã§ãã èšèªã«ã¯éçããã³åçã ãã§ãªãã匷ãåãšåŒ±ãåã®äž¡æ¹ã®èŠçŽ ãå«ããããšãã§ããŸãããäžéšã®äœçœ®ã¯ãŸã äžè¬çã§ãã ããšãã°ãGoã¯éçã«åä»ããããŠãããšèŠãªãããŸãããGoã®ã€ã³ã¿ãŒãã§ã€ã¹{}ã«ã¯åçãªåä»ãã®å åããããŸãã éã«ãPythonã¯æ£åŒã«éçã«åæå®ãããŠãããåå€æ°ã¯ãªããžã§ã¯ãåã§ããã幞éãç¥ããŸãã
ã匷ãã/ã匱ããã¿ã€ãã³ã°ã®é¢ä¿ã¯å€æ°ã®å€ãæãããéçã/ãåçãã¯ãããã®ååãæãããã4ã€ã®çµã¿åãããã¹ãŠãååšããŸãã Haskellã¯åŒ·åã§éçã§ãã匱ããšéçã§ã¯ãPythonã¯åŒ·åã§åçã§ããShellã¯è匱ã§åçã§ãã
ããã§ã¯ããç¡æå ¥åããšã¯äœã§ããïŒ ããã¯ã匱ããã®é¡äŒŒç©ã§ãããšèª°ããèšããŸãããå€ãã®äººã¯ãèªç±ã«åä»ãããããPythonãšåŒãã§ããŸãããPythonã¯åŒ·ãåä»ãã®èšèªãæããŸãã ïŒå°ãªããšãCãã匷ãïŒïŒã
ãŸãããèªç±ã«åä»ããããããšããçšèªã¯ã»ãšãã©è»œrogçãªæå³ã§åºãããã®ã§ã人ã ã¯ãC ++ã®ããã«åä»ããããŠããªããããšãæå³ãããšæšæž¬ã§ããŸãã ããã§ã¯ãã ãã®çãåããC ++ãæ²é»ããããšã«æ³šæããå¿ èŠããããŸãã C ++åã·ã¹ãã ã«ã¯æ¬ é¥ã¯ãããŸããã ããšãã°ãã¿ã€ãTãžã®ãã€ã³ã¿ãŒã®ã¿ã€ãã¯ã©ããªããŸããïŒ ããããããã¯T *ã§ã¯ãããŸããããã«ãã€ã³ã¿ãŒïŒããã³ããã¯Tåã®å€æ°ãžã®ãã€ã³ã¿ãŒã§ã¯ãªãïŒãŸãã¯ã©ã³ãã ã¬ããŒãžïŒTåã®å€æ°ãžã®ãã€ã³ã¿ãŒã§ã¯ãªãå¯èœæ§ãé«ãïŒãå²ãåœãŠãããšãã§ããããã§ãã ç¹å®ã®åã®å€æ°ã«å®éã«ãã®åã®å€ãå«ãŸããŠããªãå¯èœæ§ãããå Žåãéçåä»ããèªãã«æããã€ã³ãã¯äœã§ããïŒ
ãã£ãã·ã³ã°
ãã£ãã·ã³ã°ã§æããããããããšã¯ãããã¯ã©ã®èšèªã®æ©èœã§ããªããããç¥ãããæŠå¿µã§ãã ãã£ãã·ã³ã°ã«ãããäžéšã®èšç®çµæãä¿åãããåŸã§ããããç¹°ãè¿ãå¿ èŠããªããªããŸãã å€å žçãªæé©åããŸãã¯é床ã®ããã®ã¡ã¢ãªã®äº€æã ãã£ãã·ã¥ã®æãéèŠãªç¹æ§ã¯ããã£ãã·ã¥ãã¯ãªã¢ãããããã£ãã·ã¥ãç Žæ£ããããä»ã®çç±ã§ãã£ãã·ã¥å ã®ããŒã¿ã«ã¢ã¯ã»ã¹ã§ããªãå Žåããã¹ãŠã以åãšåãããã«åäœãç¶ããå°ãé ããªãããšã§ãã
ãããŠãäžè¬çã«åå©çšããããã«ãã£ãã·ã¥ãããŒã¿ã¹ãã¬ãŒãžãšåŒã¶ããã°ã©ããŒãšã³ãŒããã©ãã§ãèŠãŸãã ããã¯éåžžã«çŽããããã§ãã è¯ãäŸã¯ãPythonãããžã§ã¯ãã§ããç®ã«ããã³ãŒãã®äžäŸã§ãã 圌ã«æåã«æ°ä»ããã®ã¯ããã®æ©èœãreifyãšåŒã°ããPyramidãããžã§ã¯ãã§ãã 圌女ã¯ã次ã®ãããªãªããžã§ã¯ãå±æ§ã®é 延åæåãå®è¡ããŸããã
class Monster: def think(self): # do something smart @reify def inventory(self): return []
ããã§ã¯ãmonster.inventoryã¯ãå®éã«èªãã§ã¿ããŸã§ååšããŸããã ãã®æç¹ã§ãreifyãåŒã³åºããïŒäžåºŠã ãïŒãè¿ããããªã¹ããå±æ§ã«ãªããŸãã ãã¹ãŠãå®å šã«ééçã§ããå€ãäœæããããšããã«ãéæ¥ã¢ã¯ã»ã¹ã®ãªãŒããŒããããçºçããªãå ±éã®å±æ§ã«ãªããŸãã ããã«äœããè¿œå ã§ãããã¹ãŠã®ã¢ã¯ã»ã¹ã§åãçµæã衚瀺ãããŸãã ãã®å±æ§ã¯ãèŠãè©Šã¿ã«ãã£ãŠåœãåŒã¶ãŸã§ååšããŸããã§ããã
ãã®ãããªã¢ãããŒãã¯ãç¹å®ã®ãšã³ãã£ãã£ã®ããã€ãã®é¢é£ããããŸã å¥åã®åŽé¢ãèšè¿°ãããªããžã§ã¯ãã«æå³ããããŸãïŒäœããã®çç±ã§ããããã¹ãŠå¥åã®ã¯ã©ã¹ã«åå²ããããšã¯ã§ããŸããïŒã ãã®ãããªãªããžã§ã¯ãã®äžéšã®åæåã«æéãããããæ®ãã®ãªããžã§ã¯ããæ©èœããããã«ãã®ååšãå¿ èŠã§ãªãå Žåãæããã«å¿ èŠãªå Žåã«ã®ã¿é 延åæåã䜿çšããŠå¿ èŠãªã³ã³ããŒãã³ããäœæããããšã¯éåžžã«åççã§ãã
reifyã¯ãé·ãéå¥åã®ã³ã³ããŒãã³ããšããŠPyPIãªããžããªã«æ²èŒãããŠããŸããã§ããã ããããããã¯äœåè¡ããŒãããå®è£ ã§ããããã§ãã ç§ãå€ãã®ãããžã§ã¯ãã§å ·äœåãèŠããã®ã«ã€ããŠè©±ãããšããç§ã¯ãå€ãã®ãããžã§ã¯ããç§ã®èã®äžã«å ·äœåã®å®è£ ãã³ããŒãŸãã¯æžãããããšãæå³ããŸããã ãããŠæåŸã«ããã®ã³ã³ããŒãã³ãã¯... cached-propertyãšããååã§ãªããžããªã«è¿œå ãããŸããã ããã¥ã¡ã³ãã«ã¯ãããã£ãã·ã¥ãç¡å¹ã«ãããæ¹æ³ãã€ãŸããªããžã§ã¯ãã®å éšç¶æ ãžã®æå·ã®æ¹æ³ãã瀺ãããŠããŸããã
ç§ãããã§èŠã倧ããªåé¡ã¯ãæåéããç§ãèŠããã®ãã³ã¬ãŒã¿ãŒã®ãã¹ãŠã®äœ¿çšããå€å žçãªæå³ã§ã®ãã£ãã·ã¥ã§ã¯ãªãã£ãããšã§ãã äžèšã®äŸã¯ããçŽ æŽã§ãããããã§ãããã£ãã·ã¥ããç¡å¹åããããšäžå¯éçãªçµæã«ã€ãªãããŸããMonster.inventoryã®ç¶æ ã¯å®å šã«å€±ãããŸãã @reifyã®å®éã®ã¢ããªã±ãŒã·ã§ã³ã¯ãå€ãã®å Žåããã¡ã€ã«ãŸãã¯ããŒã¿ããŒã¹æ¥ç¶ãéããŸãããããã®å Žåããç¡å¹åãã¯ããŒã¿ç Žå£ã«çžåœããŸãã ããã¯ãã£ãã·ã¥ã§ã¯ãããŸããããã£ãã·ã¥ã®æ倱ã¯ã¹ããŒããŠã³ããã ãã§ãã¡ã¢ãªãŸãã¯ãã£ã¹ã¯äžã®ããŒã¿ãæãªãããšã¯ãããŸããã
ã¯ãã@ reifyã䜿çšãããšããã£ãã·ã¥ãäœæã§ããŸãã ããã§ããdictã䜿çšããŠãä»ã®ããŸããŸãªæ¹æ³ã§ãäœæã§ããŸãã
ãªããžããªå ã®ãã®ã³ã³ããŒãã³ãã®åºçŸã®æ©ã段éã§ãã£ãã·ã¥ããããã£ã®ååãå€æŽããææ¡ãæåºããããšããŸããïŒããã¯ãç¹ã«æšæºèšèªã©ã€ãã©ãªã«è¿œå ãããèè ã®æåãèæ ®ãããšéèŠã§ããïŒ-ãããã誰ãååã®ååä»ãã奜ãã§ã¯ãªããäŒè©±ã¯ããã«è°è«ãšæ¹å€ã«å€ãããŸããä»ã®ä»£æ¿åã ãããã£ãŠããšã³ãã£ãã£ã®åœåã¯ãå®éã«ã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ã§æãéèŠãªåé¡ã§ãã