F#ã®ãã¼ãµã¼ã«å¯¾ããæ¹è¯ãå ¥ãããï¼
F# Advent Calendar 2020ã®14æ¥ç®ã®ã¨ã³ããªã¼ã§ãã
ãããããã¿åãã§ãããä»å¾å ¥ããããããªãæ¹è¯ã®ç´¹ä»ã§ãã
RFC FS-1083
ãããå°å³ãªRFCã§ãããä»å¹´ã®F# Advent Calendarã§ããã£ãSRTP(Statically Resolved Type Parameters: éçã«è§£æ±ºãããåãã©ã¡ã¼ã¿ã¼)ã«é¢ããæ¹è¯ã§ãã
ç¾ç¶ã次ã®ã³ã¼ãã¯ã³ã³ãã¤ã«ã§ãã¾ããã
let inline f<^a>: ^a = failwith "error"
ç¾ç¶ã®F#ã§ã³ã³ãã¤ã«ãéãããã«ã¯ãã¾ã <
㨠^
ã®éã«ç©ºç½ãå
¥ãã < ^a>
ã¨ããå¿
è¦ãããã¾ãã
ããã¾ããæªãã®ã§ã >
ã®åã«ã空ç½ãå
¥ãã < ^a >
ãªã©ã¨ãã¾ãã
次ã«ã >
㨠:
ã®éã«ã空ç½ãå
¥ããå¿
è¦ãããã¾ãã
ã¤ã¾ãããããªãã³ã³ãã¤ã«ãéãã¾ãã
let inline f< ^a > : ^a = failwith "error" // æ®éã®åãã©ã¡ã¼ã¿ã¼ã®å ´åã¯æåã®ç©ºç½ã¯ä¸è¦ let g<'a> : 'a = failwith "error"
æåã®ç©ºç½ã®åé¡ã¯ã <^
ã¨ããæ¼ç®åãå®ç¾©ã§ããããã«ãããã <^
ãä¸ã¤ã®ãã¼ã¯ã³ã¨ãã¦æ±ã£ã¦ãã¾ãã®ãåå ã§ãã
ããããåãã©ã¡ã¼ã¿ã¼ã®ä½ç½®ã§ã¯åå²ãã¦æ±ããããã«ãã¼ãµã¼ãç´ãããã¨ããã®ãRFC FS-1083ã§ãã
äºã¤ç®ã®åé¡ã >:
ã¨ããä¸ã¤ã®ãã¼ã¯ã³ã¨ãã¦æ±ã£ã¦ãã¾ãç¹ã§ã¯åãåå *1ã§ãããRFC FS-1083ã®ç¯å²ã«ã¯å
¥ã£ã¦ããªãããã«ãè¦ãã¾ãã
ããããå°å³ã«é¢åãªåé¡ã解æ¶ããã¦ããã¨å¬ããã§ããã