> On Dec 7, 2017, at 9:20 AM, BJ Homer via swift-evolution > <swift-evolution@swift.org> wrote: > >> So while it’s theoretically possible to do this, I don’t think it’s a >> concern in practice. The incentives are already in place to encourage doing >> the “right” thing in this case, even with the possibility of dynamic member >> lookup. >> >> -BJ >> >> Hey, thanks for answering that part of the concern. i also came to this >> point, but wondered if the dictionary couldn't be made of type [String: >> DynamicValue] where DynamicValue would have some way to be automatically >> casted to string, int, etc, by reusing the same mechanism that the proposal >> would use to convert PyVal to regular swift types. I stopped at this point. >> > > > As far as I am aware, the proposal provides no mechanism for automatically > converting back from PyVal to regular Swift types. You would have to do > something explicit like myPythonValue.intValue, or String(myPythonValue).
That is correct, these proposals have nothing to do with conversions like that. If you look at the Python prototype I sent out, the primitive types like Int/String/etc have failable conversion from PyVal (they return an optional). -Chris
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution