<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="" applecontenteditable="true"><div class="">Interesting. I actually see <i class="">two</i>&nbsp;errors:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">/Users/jrose/Desktop/SwifterJSON/App/AppDelegate.swift:19:18: error: ambiguous operator declarations found for operator</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; json["root"] &amp;= 4</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&lt;unknown&gt;:0: note: found this matching operator declaration</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&lt;unknown&gt;:0: note: found this matching operator declaration</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">/Users/jrose/Desktop/SwifterJSON/App/AppDelegate.swift:19:18: error: operator is not a known binary operator</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; json["root"] &amp;= 4</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</div></div><div class=""><br class=""></div><div class="">which actually seems correct in retrospect: '&amp;=' is already a valid operator in the 'Swift' library, and you're redefining it rather than just reusing that definition. It works if I either remove your `infix operator &amp;=` declaration (and leave all the implementations in place), or if I change to an operator that isn't already defined. Can you file a bug at <a href="http://bugs.swift.org" class="">bugs.swift.org</a> for the lousy diagnostics, at least?</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2017, at 11:34, Rien &lt;<a href="mailto:Rien@Balancingrock.nl" class="">Rien@Balancingrock.nl</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">This is the “defining” package/module:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/Balancingrock/SwifterJSON" class="">https://github.com/Balancingrock/SwifterJSON</a></div><div class=""><br class=""></div><div class="">For the consuming package simply generate a new executable and put the following in main.swift:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> SwifterJSON</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">// Note: Error disappears when the line below is un-commented</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">// infix operator &amp;=</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> json = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">VJson</span><span style="font-variant-ligatures: no-common-ligatures" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">json</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures" class="">"root"</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">&amp;=</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">json</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures" class="">code</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div></div><div class=""><br class=""><div class=""><br class="webkit-block-placeholder"></div><div class="">(seems I have hit a snag with github, otherwise I would create a new repo for the executable… sorry for that.)</div><div class=""><br class="webkit-block-placeholder"></div><div class="">Regards,<br class="">Rien<br class=""><br class="">Site: <a href="http://balancingrock.nl/" class="">http://balancingrock.nl</a><br class="">Blog: <a href="http://swiftrien.blogspot.com/" class="">http://swiftrien.blogspot.com</a><br class="">Github: <a href="http://github.com/Balancingrock" class="">http://github.com/Balancingrock</a><br class="">Project: <a href="http://swiftfire.nl/" class="">http://swiftfire.nl</a><br class=""><br class=""><br class=""><br class=""><br class=""></div><br class=""><blockquote type="cite" class="">On 03 Feb 2017, at 18:36, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:<br class=""><br class="">The operator itself. If you’re not seeing that behavior, that’s a bug! Do you have a small test case that reproduces it? (I guess it would take two modules regardless, so either a&nbsp;SwiftPM package or an Xcode project would do it.)<br class=""><br class="">Jordan<br class=""><br class=""><blockquote type="cite" class="">On Feb 3, 2017, at 09:34, Rien &lt;<a href="mailto:Rien@balancingrock.nl" class="">Rien@Balancingrock.nl</a>&gt; wrote:<br class=""><br class="">Are you referring to the definition of the operator (infix…) or the availability of the function that defines the operator?<br class=""><br class="">The functions are available, but I have to repeat the “infix…" everywhere I need them.<br class=""><br class="">I.e. I have a:<br class=""><br class="">infix operator &amp;=<br class=""><br class="">And when I use that from another module I get “Operator is not a known binary operator”<br class=""><br class="">Once I repeat the "infix operator &amp;=“ at the start of the file it works fine.<br class=""><br class="">Regards,<br class="">Rien<br class=""><br class="">Site: <a href="http://balancingrock.nl/" class="">http://balancingrock.nl</a><br class="">Blog: <a href="http://swiftrien.blogspot.com/" class="">http://swiftrien.blogspot.com</a><br class="">Github: <a href="http://github.com/Balancingrock" class="">http://github.com/Balancingrock</a><br class="">Project: <a href="http://swiftfire.nl/" class="">http://swiftfire.nl</a><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On 03 Feb 2017, at 18:14, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:<br class=""><br class="">Operator declarations are actually public all the time, not internal. That’s itself probably a bug, but not the world-limiting one you’re concerned about.<br class=""><br class="">Jordan<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Feb 3, 2017, at 01:18, Rien via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:<br class=""><br class="">It is possible to define custom operators in a framework, but it is not possible to assign access levels to them.<br class=""><br class="">As a consequence they are module internal and cannot be used outside the framework.<br class=""><br class="">Each project needs to redefine the custom operators in order to use them in that project.<br class=""><br class="">What is the rationale behind that?<br class=""><br class="">Or is it a bug?<br class=""><br class="">Are there other ways to accomplish this?<br class=""><br class="">Regards,<br class="">Rien<br class=""><br class="">Site: <a href="http://balancingrock.nl/" class="">http://balancingrock.nl</a><br class="">Blog: <a href="http://swiftrien.blogspot.com/" class="">http://swiftrien.blogspot.com</a><br class="">Github: <a href="http://github.com/Balancingrock" class="">http://github.com/Balancingrock</a><br class="">Project: <a href="http://swiftfire.nl/" class="">http://swiftfire.nl</a><br class=""><br class=""><br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></blockquote><br class=""></blockquote><br class=""></blockquote><br class=""></blockquote><br class=""></div></div></div></blockquote></div><br class=""></body></html>