6 ms·
Hidden Features Of Perl, PHP, Javascript, C, C++, C#, Java, Ruby, Python, Others
- wglb 17y agoSome of these are pretty scary. In particular, the c++ analog literals http://www.xs4all.nl/~weegen/eelis/analogliterals.xhtml http://www.xs4all.nl/~weegen/eelis/analogliterals.xhtml, multidimentional to boot.
- tptacek 17y agoI just eyeballed Ruby and C, and I think you're better off not knowing a lot of this, and just keeping a whiffle bat next to your desk to use on any teammate that uses them. For instance, the highest-ranked Ruby "hidden features" are one-liners that aren't faster than their multiline equivalents, but are incomprehensible if you don't understand obscure syntax. The highest-ranked C features include Duff's Device, which, if one of your teammates tries to bust it out, go find a real bat. Others are GCC-specific. One overloads the preprocessor to define domain-specific languages for FSMs.
- benhoyt 17y agoThat's not quite true -- Adam Dunkels' protothreads make very good use of Duff's Device. They enable you to write event-driven code in a more or less thread-style way. That said, Mr Duff is kind of hidden inside the protothread macros -- one never actually has to make eye contact with him. Original link: http://www.sics.se/~adam/pt/ http://www.sics.se/~adam/pt/ Protothreads in C++: http://blog.brush.co.nz/2008/07/protothreads/ http://blog.brush.co.nz/2008/07/protothreads/ Also, a lot of the "hidden" Python are fine, and to be used. Though I didn't know about ... (Ellipsis)
- jamesbritt 17y ago"I just eyeballed Ruby and C, and I think you're better off not knowing a lot of this, and just keeping a whiffle bat next to your desk to use on any teammate that uses them." Some of the Ruby things are quite useful and not all that obscure for many of us. Others are fugly, or clever for the sake of it. In any event, it's good to know why these things work, even if you don't use them.
- gaius 17y agoFor instance, the highest-ranked Ruby "hidden features" are one-liners that aren't faster than their multiline equivalents, but are incomprehensible if you don't understand obscure syntax. This is why they say Ruby is the new Perl.
- Bjoern 17y agoNo, they say Ruby is the new Perl because of the "TIMTOWTDI" paradigm. http://en.wikipedia.org/wiki/Theres_more_than_one_way_to_do_it http://en.wikipedia.org/wiki/Theres_more_than_one_way_to_do_...
- profquail 17y agoI thought that the C# list was pretty good. There's lots of little tips in there that you might not pick up without experience (so it's a good read for those learning the language).