Ada 202x (57日目) - 6月3日の電子会議の結果 ========================================== .. post:: Jun 10, 2021 :tags: ada, ada_2022 `6月3日に行われた電子会議の議事録 `_\ が公開されました。 前回は「次は3月」って書いてたじゃないですかあ。 :doc:`56日目 `\ がフライングになってしまいました。 重複分は省きます。 次回こそは未定で「次のステップ」に進むようです。 変換しての代入とpredicate ------------------------- 型変換しての代入に、元の値のチェックが行われなくなります。 .. code-block:: ada declare subtype Negative is Integer with Dynamic_Predicate => Negative < 0; X : Integer := 1; begin Negative (X) := -1; 従来は A. 元の値(``1``)が ``Negative`` の条件を満たしているかチェック B. ``-1`` を代入 C. 新しい値(``-1``)が ``Negative`` の条件を満たしているかチェック が行われていました。 \A. のチェックが行われなくなります。 outパラメータに入った変更と同じような話ですね。 :doc:`38日目 `\ を参照。 ただし ``@`` が使われている場合はチェックされます。 .. code-block:: ada declare subtype Negative is Integer with Dynamic_Predicate => Negative < 0; X : Integer := 1; begin Negative (X) := -@; -- Constraint_Error Cursorの "=" ------------ これまで各コンテナの ``Cursor`` の ``"="`` 演算子は既定義のものをそのまま使わなければならないとされていました。 ユーザー定義しても構わなくなります。 元々守られていたルールにも思えませんしほぼ気にする必要はないはずです。 しかしユーザー定義されていても ``in`` 等で既定義の演算子が使われる場合もありますので変なことをしていますとレアな非互換に悩まされそうな気がしないでもないです。 (レアなバグに遭遇する自信がある人) parallel do文の例外ハンドラ --------------------------- これまでの仕様では ``parallel do`` 文でも例外ハンドラが書けるようになっていました。 元々 ``do`` ``end do`` ではなく ``begin`` ``end`` が検討されていた名残りです。 インデントが見辛くなりますし将来良いスタイルが見つかった時に負の遺産を残さないためAda 202xの時点では例外ハンドラは書けなくなります。 将来解禁される可能性はあります。 .. code-block:: ada declare X : Integer; Y : Ada.Strings.Unbounded.Unbounded_String; begin parallel do X := Integer'Value ("THIS-IS-NON-INTEGER"); exception -- error when Constraint_Error => X := 0; and Y := Ada.Strings.Unbounded.To_Unbounded_String (Ada.Directories.Containing_Directory ("/")); exception -- error when Use_Error => Y := Ada.Strings.Unbounded.Null_String; end do; 次のように書く必要があります。 .. code-block:: ada declare X : Integer; Y : Ada.Strings.Unbounded.Unbounded_String; begin parallel do begin X := Integer'Value ("THIS-IS-NON-INTEGER"); exception when Constraint_Error => X := 0; end; and begin Y := Ada.Strings.Unbounded.To_Unbounded_String (Ada.Directories.Containing_Directory ("/")); exception when Use_Error => Y := Ada.Strings.Unbounded.Null_String; end; end do; それから ``parallel do`` 文でもチャンクが宣言できるようになるとかならないとか? その他文面やサンプルコード等の修正 ---------------------------------- 例によって文面やサンプルコード等の修正が複数のAIで行われています。 関連AI ------ - `AI12-0428-1`_ **"Same declaration list" requirement too strong for private types** - `AI12-0429-1`_ **Examples should have consistent lead-ins** - `AI12-0431-1`_ **Confirming predicate shouldn't change semantics** - `AI12-0432-1`_ **View conversions of assignments and predicate checks** - `AI12-0433-1`_ **The Simple_Name of a root directory revisited** - `AI12-0434-1`_ **Equality operators for container cursors** - `AI12-0435-1`_ **Fixups from WG 9 Issue #143 - Image and streams** - `AI12-0436-1`_ **Should parallel blocks include exception handlers?** .. _`AI12-0428-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0428-1.txt .. _`AI12-0429-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0429-1.txt .. _`AI12-0431-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0431-1.txt .. _`AI12-0432-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0432-1.txt .. _`AI12-0433-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0433-1.txt .. _`AI12-0434-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0434-1.txt .. _`AI12-0435-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0435-1.txt .. _`AI12-0436-1`: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0436-1.txt