From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Incompatible types for array conversion Date: Wed, 22 Jul 2015 13:32:37 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="0b8a1d07de517ba95be21a60d7133ef5"; logging-data="32679"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XtoJz5GtkCLM7lfATfylgJ6i3gTvOHtI=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:2RJhP/IYjsOIWb+BFqKebcZmetE= sha1:g6dtC2hFLdizrL0wlgrfrGCWzUQ= Xref: news.eternal-september.org comp.lang.ada:26978 Date: 2015-07-22T13:32:37+01:00 List-Id: Niklas Holsti writes: > On 15-07-22 10:13 , Simon Wright wrote: >> Niklas Holsti writes: >> >>> The conversion is rejected because of the conversion condition in RM >>> 4.6 (24.5/2): "The component subtypes shall statically match". The >>> component (sub)types are Real and Length, which are different types, >>> although Length is derived from Real. If you change the declaration >>> of Length to be >>> >>> subtype Length is Real; >>> >>> the conversion becomes legal. >> >> I tried >> >> generic >> dim: positive; >> type Real is digits <>; >> package Vectors is >> type Vector is array (1..dim) of Real'Base; >> >> but it still failed. (GPL 2015, FSF 5.1.0) > > Did you expect it to work? Real'Base gets rid of any constraints on > Real, but AIUI does not get rid of the type derivation; if "type > Length is new Real", Length'Base is not the same as Real'Base -- the > "new" makes them different. Well, who knows what 'statically match' means! (outside the ARG, anyway). I thought it was worth a try.