指向性メモ::2006-07-28::protected objectのprivateが微妙に不便な件

ページ情報
制作日
2006-07-28T08:39:58+09:00
最終更新日
2006-07-28T08:39:58+09:00
ページ内目次

protected内のprivateな部分に型の定義を宣言することは出来ないのだが、これが微妙にイライラする。

with Ada.Containers.Indefinite_Doubly_Linked_Lists;

package Message_Buffers is
   type Private_Buffer is private; -- 別に公開したくない
   protected type Message_Buffer is
      entry Write(Item : String);
      entry Read(Item : out String);
   private
      -- ここに書けない!
      -- type String_Access is access all String;
      -- package String_Access_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists(String_Access);
      Buffer : Private_Buffer;
   end Message_Buffer;
   
private
   type String_Access is access all String;
   package String_Access_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists(String_Access);
   type Private_Buffer is new String_Access_Lists.List with null record; -- ずいぶん冗長なことに
end Message_Buffers;

Private_Buffer自体は内部でしか使わないので、外に公開したくな。しかし、Message_Bufferを公開する以上、それに先だって宣言しなければエラーとなる。privateだけ分割できないものか。

Comments

Trackbacks

Trackback Ping URI

http://yudai.arielworks.com/memo/2006/07/28/083958.trackback

末尾に「8 + 9」の計算結果を繋げて下さい。例えば計算結果が「17」の場合、「083958.trackback17」です。これは機械的なトラックバックスパムを防止するための措置です。

Post a comment

Name (optional)
Email address or URI (optional)
Do the math below (required to filter comment spams)
8 + 9 + 9 =
Message (required)
Submit
連絡先、リンク、転載や複製などについては『サイト案内』をご覧ください。Powered by HIMMEL

I ♥ Validator