On Monday, April 14, 2014 12:41:05 AM UTC-4, Jameson wrote: > > We know that the extremes of verbosity (e.g. C) and conciseness (e.g. > perl) are 'bad'. But why? Because using C generally means writing more > code, which takes more time. Whereas Perl is 'bad' because being the > human interpreter to read and understand its very symbol dense syntax > is slow, so reading Perl is harder than necessary. However, we have > that `C` calls this same function `gets` (4 characters), but `perl` > calls it `readline` (8 characters)! Therefore, I conclude that > conciseness (and thus usability) is not a function of the length of > function names (although let's not be extremist), but of language > design. >
I said it before, I'll say it again, I like the discussion! Agreed about the design. However, an impression of "overly verbose" due to the use of "unnecessarily long" identifiers, can not be 100% disqualified; I'm not not saying Julia is, I am saying don't completely dismiss it. > > > > additional thoughts: > > I can type readline slightly faster than readln, since the former is a > word, and the second is not. But the difference doesn't matter > compared to the time it takes me to figure out what to type. > > > default arguments are good, like Stefan said, and should be added to > `readline`. however, to me, this qualifies as an improvement in > language design, in contrast to shortening the the length of a > function name > > LoL, so you're saying you're not liking the readln? I also prefer to not dwell on 2 characters. > please don't a function `Base.readln() = chomp(readline())`, it's > really unnecessary and confusing. However, I would encourage you to > make a function `MyModule.readline() = chomp(Base.readline())`, as > convenient. > > I don't like the MyModule idea because of this interpretation. You're saying "please work around the cumbersomeness of this language by creating a workaround yourself." This does go to your language design idea. I'll state it A language should streamline common tasks by default. if you agree with that, then I would argue that the current default behavior of readline() instead streamlines the edge case (read the delimiter) and complicates the common case (throw away the delimiter). > I feel this incurs the usual problem with creating benchmarks: they > don't reflect the real world. > > in a real julia program, how many times do you type `readline`? in a > well-structured program, it's should probably be true that you have a > single entry point into your program from the user, so that you can > unit test your helper functions without user intervention. in the > julia repl, there are 3 uses of the readline function in 2 files, or > 0.15% of the lines in those files. > Oh there are other things. But I have to start somewhere, I'm not even sure how to rank things yet. But ... you looked through the codebase? That's awesome! Does that mean a change would be easy because it affects so little in regression? > > in a real jQuery program, how many times do you expect to type `$`? > every line? several times per line? perhaps just every tenth line, if > you really like spacing out your code? `$` is the roughly jQuery > equivalent of `using` in julia (or more precisely, `import ... as > ...`). since javascript does not natively have strong code separation, > e.g. "modules", it is necessary to fake it with some shorthand. > I wonder if this is going to come back to bite those that program in Javascript on the server side using node.js and the postgres plv8 features. > > codegolf can be fun anyways. my roommate last year and I spent several > months trying to cram a wireless encoding algorithm into a tweet. I > think we could only get down to ~186 characters, by which time gcc > didn't even want to parse the code (it warned of using a deprecated > feature of K&R C, and aborted). clang still computed the correct > answer (although I think it also emitted a warning that could not be > silenced with any command line flag). the original C was somewhere > around three times as long, iirc. > So you're saying you spent 2 months on reducing the size of a function. I'm guessing you know that alg pretty well now. Did you get frustrated? Thinking back, how would Julia stack up? Sounds pretty low level, is that even the kind of thing Julia could be used for? I like golf for at least this reason, it's an open format with few rules the objective it to stretch a language to it's limits; here's the best it can offer! And then you either win or lose at least as far as the competition goes, but then afterwards you can understand why. Sometimes it will be; "oh boo, we lost because our IO function has 2 extra letters in the identifier" -- ehh no big deal. But maybe sometimes (which is my hope) it will be oh, our language is missing something, and if it had that the program would be greatly simplified.
