2 ms·
I commented below, but I'll comment here as well: import module.x IMO is much better: - It goes from "larger to smaller". You parse the line with your ey
by dmitriid 9y ago
I commented below, but I'll comment here as well:
import module.x
IMO is much better:
- It goes from "larger to smaller". You parse the line with your eyes and immediately see where things are coming from. With `import {x} from module` you have to do a double-take on what comes from where.
- If you use any sort of code assist, you get to autocomplete immediately when you hit `.` With Javascript's weird thing you have to first type `import {} from module` and then go back to {} to invoke the autocomplete. This is especially infuriating when you don't really remember the name of the thing you're importing.
- dmitriid 9y agoEven PHP's approach makes sense compared to Javascript's: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\EmailType;
- camus2 9y agoPHP doesn't import anything this way though, it just makes the code aware of namespaces. The actual import is done with spl_autoload_register .