Spec Sharp
Spec#とは、C#にEiffel風の仕様記述言語的要素を追加したプログラミング言語である。Spec#ではオブジェクト不変条件・事�…
| パラダイム | マルチパラダイム: 構造化, 命令型, オブジェクト指向, イベント駆動, 関数型, 契約 |
|---|---|
| 登場時期 | 2004年 |
| 設計者 | Microsoft Research |
| 開発者 | Microsoft Research |
| 最新リリース | SpecSharp 2011-10-03/ 2011年10月7日 |
| 型付け | 静的型付け, 強い型付け, 安全, 公称的派生型 |
| 影響を受けた言語 | C#, Eiffel |
| 影響を与えた言語 | Sing# |
| ウェブサイト |
research |
Spec#とは、C#にEiffel風の仕様記述言語的要素を追加したプログラミング言語である。Spec#ではオブジェクト不変条件・事前条件・事後条件などの契約を記述するための構文を持つ。ESC/Javaのように、定理証明機を用いた静的検証ツールを持っており、不変条件の多くを静的に検証できる。
.NET Framework 4.0におけるコードコントラクトAPIはSpec#とともに発展してきた。 Spec#はSing#の基礎にもなっている。
特徴
C#と比べ、Spec#には以下の要素を持つ。
- null非許容参照型
- 事前条件・事後条件を書くための構文
- Java風の検査例外
- 簡易構文
例
事前条件・事後条件・null非許容参照型を用いた例を以下に示す。(ブラウザ上でSpec#を試す)
static int Main(string![] args)
requires args.Length > 0;
ensures return == 0;
{
foreach(string arg in args)
{
Console.WriteLine(arg);
}
return 0;
}
!はnull非許容参照型である。argsはnullであってはいけない。requiresは事前条件である。この例ではargsの数が0以下であることは許されない。ensures事後条件である。Main関数は0を返さなければならない。
Sing#
Sing#はMicrosoft ResearchがSingularity(OS)を開発するためにSpec#を拡張した言語である。Sing#では低水準プログラミング言語におけるチャネルと契約を扱える。
脚注
出典
- Barnett, M., K. R. M. Leino, W. Schulte, "The Spec# Programming System: An Overview." Proceedings of Construction and Analysis of Safe, Secure and Interoperable Smart Devices (CASSIS), Marseilles. Springer-Verlag, 2004.
関連項目
外部リンク
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.