[swift-evolution] Proposal: Python's indexing and slicing

Jordan Rose jordan_rose at apple.com
Tue Dec 22 21:48:08 CST 2015


> On Dec 21, 2015, at 19:47 , Kevin Ballard via swift-evolution <swift-evolution at swift.org> wrote:
>  
> On another note, I'm tempted to say that we should use $start and $end instead of $.start and $.end. The compiler doesn't currently allow this, because it expects a number after the $, but I see no reason why we can't relax that rule and allow $start to be a valid token. The benefit of this approach is it frees up $ to be used by third-party code (such as in the older thread about rebinding `self` for DSLs where I suggested that a block-based API can use $ as the parameter name so code would say something like `$.expect(foo).to(.equal(bar))`).

Without commenting on the rest of this thread, the current rule is that identifiers starting with "$" are reserved for the debugger (not counting implicit closure args). We can change that rule, but the debugger folks won't be happy—the implicit variables you get from the REPL, for example, should stay short. I'm not sure if '$' itself falls under the current rule, though.

Jordan



More information about the swift-evolution mailing list