[swift-evolution] MemoryLayout for a value
Anton Zhilin
antonyzhilin at gmail.com
Thu Aug 4 13:38:33 CDT 2016
2016-08-04 21:31 GMT+03:00 Dave Abrahams <dabrahams at apple.com>:
>
> on Thu Aug 04 2016, Anton Zhilin <antonyzhilin-AT-gmail.com> wrote:
> > Two weeks ago Adrian and I suggested adding dynamic 'size', 'stride',
> > 'alignment' to Mirror, which definition would look like:
> >
> > public struct ReflectionWrapper { // fixed!
> > internal metatype_: Any.Type
> >
> > public init<T>(_: T.Type)
> >
> > public var size: Int { get }
> > public var stride: Int { get }
> > public var align: Int { get }
> >
> > // ...
> > }
> >
> > There are some problems with it right now, but I do believe that
> reflection
> > API is where dynamic `size`, `stride`, `alignment` belong.
>
> I see your point, but that would unfortunately be an unacceptably
> expensive way to get that information. Constructing a mirror is a
> nontrivial bit of work.
I don't mean current heavyweight Mirror. Call that type ReflectionWrapper,
if you want. It would only contain 'Any.Type' stored property.
Largest of 'problems' that I meant is that reflection is postponed, and my
type would look odd without full reflection capabilities (only with 'size'
and friends).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160804/ad12219e/attachment.html>
More information about the swift-evolution
mailing list