3 ms·
No, this is far preferable to human beings who speak English: import {x,y,z} from 'module' Yoda from Star Wars might agree with your preference since he s
by hungerstrike 9y ago
No, this is far preferable to human beings who speak English:
import {x,y,z} from 'module'
Yoda from Star Wars might agree with your preference since he speaks backwards English.
All kidding aside, I'd love to hear your logic about why you think the backwards version is better.
- k__ 9y agowhen I write the module before the parts, the autocomplete works better
- kevin_thibedeau 9y agoOSV grammar is legitimate English.
- dmitriid 9y agoI 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 .