<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<blockquote
cite="mid:CAEzDdiOh9mr51Ns1zt12FCxCe-Xfro9CgcDyomoOHbe7mgjLrw@mail.gmail.com"
type="cite">
<div dir="ltr">> <span style="font-size:12.8px">I don't really
like this specific design, though—it doesn't really match the
look and feel of existing directives.</span>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">I propose that all compiler
directives (that have arguments) be formatted in
pseudo-function form:</span></div>
<div><span style="font-size:12.8px">#setline(1, file:
"main.swift")</span></div>
<div><span style="font-size:12.8px">I'll create a proposal for
this, which will go hand-to-hand with my syntax for
operators.<br>
</span></div>
<div><br>
</div>
<div>Additionally, I've come up with an idea for complete
operators overhaul. The main suggestions are as follows:</div>
</div>
</blockquote>
If you intend to draft a proposal for this that encompasses
operators, I'll happily hold off. My gut feeling though is that a
proposal that standardizes directives and also changes how operators
are declared may be better served if they were split into two
distinct proposals.<br>
<blockquote
cite="mid:CAEzDdiOh9mr51Ns1zt12FCxCe-Xfro9CgcDyomoOHbe7mgjLrw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>1. </div>
<div>All operators are available without any pre-definition:</div>
<div><br>
</div>
postfix func ! <T>(left: T?) -> T
<div><br>
<div>func <>(left: Int, right: Int) -> Bool //
assuming infix<>, no associativity, no precedence<br>
</div>
<div><br>
</div>
<div>1 ||| 2 // error: function |||(Int, Int) is not defined</div>
<div><br>
</div>
</div>
</div>
</blockquote>
This is interesting, but I wonder if an infix operator function with
more esoteric operator characters would be easily identifiable as an
operator vs a normal function. Operator declarations don't need to
be near their function definitions though, and this is technically
possible to do today anyways, so maybe my concern with this change
is unfounded. One way to make this be 100% clear to the reader
though would be to require infix in front of func, just like prefix
and postfix which I kind of like.<br>
<blockquote
cite="mid:CAEzDdiOh9mr51Ns1zt12FCxCe-Xfro9CgcDyomoOHbe7mgjLrw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>2.</div>
<div>If we want to globally set associativity or precedence
for infix operators, we write:</div>
<div><br>
</div>
<div>#operator(|||, associativity: left, precedence: 100)</div>
<div><br>
</div>
<div>These operator configuration directives must not be in
conflict. We can omit one or both of parameters:</div>
<div><br>
</div>
<div>#operator(|||, precedence: 100)</div>
<div>#operator(|||) // just disallow other #operator
directives<br>
</div>
</div>
</div>
</blockquote>
I agree that the compiler directive look is interesting (though it's
not my most preferred method of declaring operators aesthetically).
However, omitting fixity here, as this example does, could constrain
the design of future changes that might add behavior control to
prefix and postix operators, and in my opinion it's a better idea to
leave that avenue open.<br>
</body>
</html>