F#入門(3)キーワードについて
F#のキーワード(keyword)です。このキーワードは予約されている(reserved)ので識別子や型の名前として使うことはできません。
abstract and as assert base
begin class default delegate do
done downcast downto elif else
end exception extern false finally
for fun function if in
inherit inline interface internal lazy
let match member module mutable
namespace new null of open
or override private public rec
return static struct then to
true try type upcast use
val void when while with
yield
これは、OCalmのキーワードらしいですが、F#でも予約されているようです(但し、--ml-compatibility
オプションを使う場合を除く)。
asr land lor lsl lsr
lxor mod sig
更に、以下はF#の将来のバージョンのために予約されています。
atomic break checked component const
constraint constructor continue eager event
external fixed functor global include
method mixin object parallel process
protected pure sealed tailcall trait
virtual volatile
全部で96個。C#が92個(コンテキストキーワードを含む)なので、かなり多い感じがします(実際はVBの方が遥かに多いですが)。
上の一覧表から、F#はclass
などのオブジェクト指向パラダイムのキーワード、return
などの命令型(手続き型)パラダイムのキーワード、rec
などの関数型パラダイムのキーワードを含んでいることが観察できます。なので、F#はプログラミングにおける主要な3つのパラダイム全ての要素を含んでいることが分かります。
場合に応じて、オブジェクト指向・命令型・関数型のどのパラダイムでもプログラムを書けるというのがF#の強みらしいです。

スポンサーリンク