3 ms·
Wrong is what with Yoda conditions?
by igorgue 16y ago
Wrong is what with Yoda conditions?
- pixdamix 16y agoNothing wrong there is. To understand and read them quickly difficult it is. Subject verb noun, to process, is easier.
- hasenj 16y agoJapanese is SOV (subject-object-verb). I yoda conditions very much hate!! Crazy they me drive! But I Japanese like.
- silentbicycle 16y agoI really dislike post-statement ifs, like "do_something() if condition?". They seem to be used particularly often in Ruby. I don't know how dependent clauses ("if x then y" vs. "y if x") work in Japanese, but Ruby coming from Japan may be a factor. "if (3 == x)" doesn't bother me so much, I tend to think of it like unification in Prolog.
- mdaniel 16y agoI got into the habit of writing literals first from being bitten one too many times by the (absolutely insane!) semantic difference between "=" and "==". In my day job (working with Java) it's less of a problem, but I switch languages so much in my spare time that it has served me well.
- prakashk 16y agopost-statement ifs, ... used particularly often in Ruby. ... Ruby coming from Japan may be a factor. I think Ruby borrowed them from Perl's Statement modifiers (http://perldoc.perl.org/perlsyn.html#Statement-Modifiers http://perldoc.perl.org/perlsyn.html#Statement-Modifiers). I like them and use them when I want the focus to be on the body rather than the conditional.
- hasenj 16y agoJapanese conditionals come (AFAIK) before statements. They can come after statements, just like in English, "Tell me if you see him". I don't use Ruby but I actually like this idea. Often when reading code, I'm looking for what's being done, not the condition under which it's done. I only look for the condition after I've found the statement.
- deleted 16y ago[deleted]
- silentbicycle 16y agoFor native speakers of English and other Subject-Verb-Object (SVO) languages, anyway; it sounds like a weird variant of passive voice. There are also SOV, VSO, etc. human languages, though.
- protomyth 16y agoDakota has some combos that sound different to English speakers (e.g. phrase: "Mazaska wacin", Mazaska = money, wacin = 'I want'). // my choice of example phrase is based on what I valued as a teenager (and can still remember), not some weird social commentary