Kevin I tested in my Win laptop with 0.3.11, 0.4.2, 0.4, 0.5+ also the same versions in julia box, and the output is deterministically sorted, It seems this has been the way it works for some time now, then I looked at the code and it’s indeed sorted (should have done that first! :P ):
- http://git.io/vEXL9 subtypes(m::Module, x::DataType) = sort(collect(_subtypes(m, x)), by=string) subtypes(x::DataType) = subtypes(Main, x) I would expect a very good reason in order to justify a change for this now. Ismael Venegas Castelló *Data Analyst* Cel. 044 55 6434 0229 ivene...@richit.com.mx Cerro San Francisco 357, C.P. 04200 Campestre Churubusco, Coyoacán Ciudad de México <http://t.sidekickopen35.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XX43Mx_82W1p1tN-8q-fZWW3LPXXH56dKBHf5NSPJF02?t=https%3A%2F%2Frichit.com.mx%2F&si=4656540167962624&pi=cbed75c9-c818-4cc7-b26c-aa1d7cf16134> <https://www.facebook.com/richitsolution> <http://t.sidekickopen35.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XX43Mx_82W1p1tN-8q-fZWW3LPXXH56dKBHf5NSPJF02?t=https%3A%2F%2Ftwitter.com%2Frichitsolution&si=4656540167962624&pi=cbed75c9-c818-4cc7-b26c-aa1d7cf16134> <conta...@richit.com.mx> Tel. 6718 1818 richit.com.mx 2015-12-27 18:06 GMT-06:00 Kevin Squire <kevin.squ...@gmail.com>: > Ray, thanks for the clarification--makes sense. In fact, for introspection > code like 'subtypes', performance is probably the wrong argument--it's > unlikely that it occurs in performance-critical code. I think it's really > that arrays are just simpler. > > One aesthetic change I could imagine would be to have the results sorted > before returning, which would keep the same data structure, but solve your > problem, and present the subtypes in a way the user would likely find more > useful. > > Ismael, it might be a little brittle to depend on the current order > (unless it's always sorted now). > > Cheers, > Kevin > > > On Sunday, December 27, 2015, Ismael Venegas Castelló < > ismael.vc1...@gmail.com> wrote: > >> You can just do: >> >> @assert subtypes(Type) == [DataType, TypeConstructor, Union] >> >> I just tested this: >> >> julia> @time for i in 1:1000 >> @assert subtypes(Type) == [DataType, TypeConstructor, Union] >> end >> 3.025415 seconds (767.00 k allocations: 224.075 MB, 0.49% gc time) >> >> >> >> El sábado, 26 de diciembre de 2015, 12:52:51 (UTC-6), Ray Toal escribió: >>> >>> I noticed that >>> >>> *julia> **subtypes(Type)* >>> >>> *3-element Array{Any,1}:* >>> >>> * DataType * >>> >>> * TypeConstructor* >>> >>> * Union * >>> >>> and was wondering if there was any significance in the order of the >>> subtypes. If not, could the method have produced a Set instead? >>> >>>