<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>On Fri, Dec 4, 2015, at 09:36 AM, Joe Groff wrote:<br></div>
<blockquote type="cite"><div>Another way to do this would be to support scoped imports, to make a set of top-level functions locally available without polluting the global namespace:<br></div>
<div> </div>
<div>{<br></div>
<div> import func QuickSpecBuilder.expect<br></div>
<div> </div>
<div> expect(sections).to(....)<br></div>
<div>}<br></div>
<div> </div>
<div>Being able to elide self is already somewhat controversial, and a number of people find it makes code harder to read. I worry that allowing closures to change 'self' has the potential to be even more confusing. In Javascript, it's my understanding the ability to arbitrarily rebind 'this' is seen as a design flaw rather than a feature people regularly take advantage of.<br></div>
</blockquote><div> </div>
<div>I like this idea. I'm very much against rebinding `self` because it seems like an excellent source for confusion. Not only that, but the actual underlying desire here isn't to remove `self` at all, but just to introduce new functions into function resolution within a scope. And this is precisely what adding imports in arbitrary scopes does (the only downside being you need a line of code to add them, but that's not a big deal). I know Rust allows this and it's pretty handy. I'd love to have this feature even when not using a DSL.<br></div>
<div> </div>
<div>-Kevin Ballard</div>
</body>
</html>