How to pass duration for discriminant ada?
<p>I'm playing around with ADA, trying to get my grips on it. I still have a hard time figuring out the discriminant part though. I have a task with one discriminant, and I'm trying to pass a duration to it. However it tells me:</p>
<pre><code>package Procedures is
   task type WhatchDog(dur : Duration := 1.0) is
      entry Reset(start : in Time);
      entry Sync(timedOut : out Boolean);
   end WhatchDog;
end Procedures;

with Procedures;
procedure Main is
   watch : Procedures.WhatchDog(dur =&gt; 0.5);
begin
   null;
end Main;
</code></pre>
<blockquote>
<p>Discriminants must have a discrete or access type.</p>
</blockquote>
<p>When I change my discriminant type to an access type,</p>
<pre><code>task type WhatchDog(dur : access Duration := 1.0) is
</code></pre>
<p>it gives me the following warning:</p>
<blockquote>
<p>Expected an access type with designated type &quot;Standard Duration&quot;</p>
<p>Found type universal real</p>
</blockquote>
<p>I know there are other ways to realize a constructor, such as creating an entry point. But I would like to know what I'm doing wrong here, and understand the error I'm making.
The google work I've done so far doesn't really shine any light on this, and only makes use of real types which seem to work fine. Here for example:
<a href="http://www.adaic.org/resources/add_content/docs/95style/html/sec_6/6-1-3.html" rel="nofollow noreferrer">http://www.adaic.org/resources/add_content/docs/95style/html/sec_6/6-1-3.html</a></p>