<div dir="ltr">I agree with Dmitri. I would rather see a proper design for reflection (similar to Completing Generics) before we start making any changes to the existing machinery.<div><br></div><div>Best,</div><div>Austin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 21, 2016 at 4:39 PM, Dmitri Gribenko via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Jul 21, 2016 at 4:06 PM, Anton Zhilin <<a href="mailto:antonyzhilin@gmail.com">antonyzhilin@gmail.com</a>> wrote:<br>
> 2016-07-22 1:34 GMT+03:00 Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>:<br>
>><br>
>> > Mirror.DisplayStyle contains optional and set as special cases, but does<br>
>> > not<br>
>> > contain function<br>
>> > Mirror collects all information possible at initialization, while for<br>
>> > true<br>
>> > reflection we want laziness<br>
>> > Mirror allows customization. For example, Array<T> is represented with a<br>
>> > field for each of its elements. Do we want this for “true” reflection we<br>
>> > want to add in the future?<br>
>><br>
>> Why can't we add these features to Mirror in future?<br>
><br>
><br>
> Reflection in some other languages works as follows: we have a type (let's<br>
> name it 'Reflection'). Each instance of it contains ID of one type and can,<br>
> for example, retrieve an array of its static or normal methods.<br>
<br>
</span>I understand. But we don't know how reflection will work in Swift, we<br>
haven't designed it yet. You are assuming it will work like it does<br>
in other languages, which will not necessarily be the case.<br>
<span class=""><br>
> Moreover, types can completely customize contents of their<br>
> 'Mirror's. This is incompatible with laziness and with how reflection should<br>
> work, based on experience from other languages.<br>
<br>
</span>That is actually viewed as a weakness of reflection in other<br>
languages. Allowing reflection to access other types' internal data<br>
and APIs creates barriers for optimization, and facilitates creating<br>
binary compatibility problems when apps include code that uses<br>
reflection to poke at internal data of library types.<br>
<div class="HOEnZb"><div class="h5"><br>
Dmitri<br>
<br>
--<br>
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>