7 ms·
Do you think approaching the way typescript does it for Bolt is a reasonable compromise here? Bolt already supports full-module renames like import math as
by beariish 1y ago
Do you think approaching the way typescript does it for Bolt is a reasonable compromise here? Bolt already supports full-module renames like
import math as not_math
So supporting something along the lines of
import abs as absolute, sqrt as square_root from math
Would be farily simple to accomplish.
- pepa65 1y agoOr: `import math with abs as absolute, sqrt as square_root`
- derdi 1y agoOooh, bikeshedding! To me your `import math with x as y` reads like "import all of math, making all of its symbols visible, just renaming some of them". That's different from the intended "from math, import only x (maybe with a renaming)".
- cess11 1y agoWhy? Put the category first so it makes it easy to skim and sort dependencies. You're never going to organise your dependencies based on what the individual functions, types or sub-packages are called, and sorting based on something that ends up in a more or less random place at the end of a line just seems obtuse.
- WorldMaker 1y agoThe OP seems to be asking for the Python order of the import statement because it allows for simpler auto-completion when typing it: from math import square_root as sqrt, abs as absolute from math import * as not_math In a format like this, your language service can open up `math` immediately after the `from math` and start auto-completing the various types inside math on the other side of the `import`. Whereas the `import abs from math` often means you type `import` have no auto-complete for what comes next, maybe type ` from math` then cursor back to after the import to get auto-completion hints. It's very similar to the arguments about how the SQL syntax is backwards for good auto-complete and a lot of people prefer things like PRQL or C# LINQ that take an approach like `from someTable where color = 'Red' select name` (rather than `select name from someTable where color = 'Red'`).