[swift-dev] Typos while hacking on the constraint system
David Zarzycki
zarzycki at icloud.com
Thu Aug 17 12:28:52 CDT 2017
> On Aug 17, 2017, at 13:03, Robert Widmann <rwidmann at apple.com> wrote:
>
> It’s an unfortunate naming scheme, but I would hesitate to use notions like “from” and “to”, especially in CSSimplify where different matchers are handed types in whatever order variance requires.
Thanks Robert,
That is what I feared might exist. Can you give an example or two where “from” and “to” would be imprecise or wrong?
> More critical here are the scoping issues. There are a bunch of places, especially in matchTypes itself, where type1 and type2 are re-assigned in branches during the matching process. It makes it more of a pain to debug than it should be.
I just took a look at matchTypes(), where my last typo was, and it looks like the reassignment is largely done out of convenience, not necessity. Is this worth fixing? Most, if not all of them look easy to fix via some judicious use of ‘const’ and a few new local variables (instead of reassignment). It would make reasoning about the code easier for both newbies and experts alike.
Dave
>
> ~Robert Widmann
>
>> On Aug 17, 2017, at 9:55 AM, David Zarzycki via swift-dev <swift-dev at swift.org> wrote:
>>
>> Hello,
>>
>> More than once, I’ve made typos while hacking on the constraint system because the key variables are often named “type1” and “type2”. Beyond sharing 4 out of 5 characters, the ‘1’ and the ‘2’ are right next to each other on the keyboard, and typing the other by accident results in code that still compiles.
>>
>> Are “type1” and “type2” really the most apt names? Is something preventing better names from being used? Wouldn’t “fromTy” and “toTy” be better and less typo prone?
>>
>> Thanks,
>> Dave
>> _______________________________________________
>> swift-dev mailing list
>> swift-dev at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-dev
>
More information about the swift-dev
mailing list