<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
+1 to this. I commonly reference self alone very close to
self.dynamicType when I use the dynamicType keyword, and I dislike
the repetitiveness it brings. If a standalone dynamicType is already
disallowed by the compiler, I don't see a technical reason this
cannot happen, personally. If this can happen, then self should
probably still be required to qualify dynamicType in closure
contexts (for consistency), for example:<br>
<br>
class Foo {<br>
let value = 123<br>
func bar() {<br>
dispatch_async(queue, { <br>
print(self.dynamicType.value) // self needed here in this
closure<br>
})<br>
}<br>
}<br>
<br>
<div class="moz-cite-prefix">On 4/10/2016 5:15 AM, Mohamed Ebrahim
Afifi via swift-evolution wrote:<br>
</div>
<blockquote
cite="mid:CACuaiDko9tXjx7tnX8aDc=ofnNRBzSWNenB0O-TYC-5pHchNew@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hi,</div>
<div><br>
</div>
<div>When access the `dynamicType` of a class inside one of its
instance methods. We should be using `self.dynamicType`. I
purpose that the dynamicType operator can be accessed without
the need for the `self`.</div>
<div>So code like the following</div>
<div><br>
</div>
<div>
<div>class Foo {</div>
<div> static let SomeStaticConstantValue = 5</div>
<div> static func someStaticMethod() {</div>
<div> }</div>
<div><br>
</div>
<div> func bar() {</div>
<div> self.dynamicType.someStaticMethod()</div>
<div> print(self.dynamicType.SomeStaticConstantValue)</div>
<div> }</div>
<div>}</div>
</div>
<div><br>
</div>
<div>can be translated to </div>
<div><br>
</div>
<div>
<div>class Foo {</div>
<div> static let SomeStaticConstantValue = 5</div>
<div> static func someStaticMethod() {</div>
<div> }</div>
<div><br>
</div>
<div> func bar() {</div>
<div> dynamicType.someStaticMethod()</div>
<div> print(dynamicType.SomeStaticConstantValue)</div>
<div> }</div>
<div>}</div>
</div>
<div><br>
</div>
<br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">Best Regards,
<div>Mohamed Afifi</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
swift-evolution mailing list
<a class="moz-txt-link-abbreviated" href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>
<a class="moz-txt-link-freetext" href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a>
</pre>
</blockquote>
<br>
</body>
</html>