logoalt Hacker News

recursivecaveattoday at 1:42 AM2 repliesview on HN

Mass unqualified imports is a feature that I really dislike in languages. At least please make it less syntactically convenient so people are not drawn to it. Trawling around to find out where symbols come from has wasted a lot more of my time than unqualified imports have ever saved. Using a very short alias gets you 90% of the way there anyways.


Replies

p1neconetoday at 3:13 AM

My plan for this in my current toy language project is to allow things like 'import * from Foo', but save a package.lock esque file somewhere on first build - after that you need to run some kind of '--update' command to bring in totally new names.

The problem I'm trying to solve is more around ensuring that purely additive changes in libraries aren't technically breaking due to the risk of name clashes than general discoverability though.

jiggawattstoday at 2:09 AM

> Trawling around to find out where symbols come from has wasted a lot more of my time than unqualified imports have ever saved.

Why aren't you using an IDE with "navigate to definition" conveniently bound to something like middle-click or ctrl-click?

I haven't used a language/IDE combination without this feature in decades.

show 3 replies