3 ms·
import "fmt" what advantages this have over import fmt that a new language is choosing this sytax?
by shabda 17y ago
import "fmt"
what advantages this have over
import fmt
that a new language is choosing this sytax?
- mncaudill 17y agoIt keeps the grammar simple, for one.
- shabda 17y agoIMO, Thats no reason to make me type two extra chars each time I import.
- swolchok 17y agoYou're a programmer, right? So you type 70-100 WPM, right? That's 5-8 chars per second, so we're asking you for 0.4 to 0.25 seconds per imported module, or maybe 5-10 seconds per program. I do see the reason to design a language efficiently, but I emphatically disagree with optimizing away small numbers of characters. Typing is a basic skill for the job, and the overhead is dwarfed by the text of the program (not to mention that we're making everyone type braces and semicolons).
- shabda 17y agoIf its a conscious tradeoff decision, doesn't it need to have a positive however small, to counter that negative, however small? now That positive might be "close to c++ syntax", but I am wondering if there is any other.
- demallien 17y agoit allows module names with spaces/other special characters, for two.
- akamaka 17y agoCould it have something to do with allowing unicode in the source?
- praptak 17y agoIt's a shorthand for: import fmt "fmt" Where the quoted fmt is an import path. Not making it a string literal would create a potential clash between characters used in filesystem paths and the Go parser.