2022-01-01ãã1å¹´éã®è¨äºä¸è¦§
ãã®è¨äºã¯Scala Advent Calendar 2022ã®19æ¥ç®ã§ã.Scalaã§ã¯ã¸ã§ããªãã¯åã®å¤æ§(variance)ã¯+ã-ã§æå®ãã¾ãã, ä»ã®è¨èª(ãã¨ãã°, C#, Kotlin)ã§ã¯outãinã ã£ãããã¾ã. ãã®è¨äºã§ã¯å¤æ§ã®æå³ãæ´çãã¦, ãªãScalaã§ã¯+/-ã®è¨å·ã使ãã®ã説æãâ¦
ãã®è¨äºã¯Engineering Management Advent Calendar 2022ã®7æ¥ç®ã§ã.ä»ã¯ã¨ã³ã¸ãã¢ãªã³ã°ããã¼ã¸ã£(EM)ã¨ãã¦ã¨ã³ã¸ãã¢ãªã³ã°ããã¸ã¡ã³ãã®4é å(ãããã¯ãã»ããã¸ã§ã¯ãã»ãã¯ããã¸ã»ãã¼ãã«)ãã¹ã¦ãè¦ã¦ãã¾ãã, ãã以åã¯é·ãéããã¯ãªã¼ãâ¦
è¥æã¡ã³ãã¼ã®ã¹ãã«ã¢ããã®ããã®ç¸è«ã«ä¹ã£ã¦ããã¨, ãã¾ãè¨è¨ãã§ããããã«ãªã, ä»æ§ã®æ´çãã¡ãªããã»ãã¡ãªããã®å¤æããã¾ããªã, ãããã¯æè¡ã®å¼ãåºããå¢ããã«ã¯ã©ããããããã, ã¨ãã話ãããæãã. ãã®æã®è©±é¡ã«ãã¤ãåãããâ¦
çµè«ããè¨ãã¨, ååãä»ãããã¨ãªãå帰çãªé¢æ°ãå®ç¾©ãããã¨ã¯å¯è½. ç¹å®ã®ããã°ã©ãã³ã°è¨èªã§ã©ããã¨ããããã¯æ½è±¡æ¦å¿µã¨ãã¦ã®é¢æ°ã®å帰ãååãªãã«å®ç¾å¯è½ãã©ããã¨ãã話(ååãªãã«å®ç¾ã§ããããã°ã©ãã³ã°è¨èªã¯åå¨ãããã¨ãã話). â¦
ãã®ããã°ã§ã¯ãã¾ããããã話ã¯æ¸ãã¦ããªãã£ããã©, 以åå°ãã ã触ããããã«, åã¯ããæè¿ã¨ã³ã¸ãã¢ãªã³ã°ããã¼ã¸ã£ããã£ã¦ãã¦, ãããã話é¡ãèããæ©ä¼ã¯ãã£ããå¤ã. å ·ä½çã«ã¯, ã¨ã³ã¸ãã¢ãªã³ã°ããã¼ã¸ã£ã¨ãã¦è¤æ°ãã¼ã ã®ãã¯ããã¸/â¦
ãããã話ã§ã:ç¾ä»£ã«ããã¦printãããã°ãªãã¦æ¥ãããããã®ããããã¬ã¼ã使ãããªããªãã¨ãããªããã£ã¦èªèãã¦ããã©ã以å¤ã¨printãããã¯ã®æ¹ããµã¯ãã¨æ°è»½ã«ã§ãã¦è¯ãã¨ãã£ã¦ã人ãå¤ãã¦å®å¿ãããï¼vim-jpããâ ã¦ãã¾ã (@teramako) 2022â¦
Scala 3ã§ã³ã³ãã¤ã«æè¨ç®ããããã便å©ã«ãªã£ã¦ããããªã®ã§, ç·´ç¿ã¨ãã¦æ¡å¼µå¯è½ã¬ã³ã¼ã(extensible record)ãå®è£ ãã¦ã¿ã. ååã¯match typesã§åã¬ãã«ã®æä½ã®ã¿ã§ããããã§ãããã, ä»åãããããã¤ããã§ãããã¨æã£ããã®ã®, ãã£ããããã¯â¦
ã¾ãã. ã¾ããªã®ã. ä½åç®ã . ã¨ãããã¨ã§, ã©ã ãè¨ç®ã®ã¤ã³ã¿ããªã¿ã®å®è£ ã¨ãã¦ã¯4åç®ããã*1, ã³ã³ãã¤ã«æè¨ç®ã§ãããã®ã¨ãã¦ã3åç®ãããã«ãªã£ã¦ãã¾ããã©, ã©ã ãè¨ç®ã®å¦çç³»ãã¾ãæ¸ãã¦ãã¾ã£ã.ä»åã®ç®çã¯, Scala 3ã«ã¯match typesã¨â¦