Your friendly local neighbourhood digital textbook industry


  • ♿ (Parody)

    @Steeldragon said:

    As far as Textbook writing goes, Cracked already did an article on it.

    @DCRoss said:

    In "Surely You're Joking...", Richard Feynman wrote about his experience with the textbook mafia. It seems like things haven't changed in the last fifty years.

    Meh...Feynman covered this decades ago.

    EDIT: LOL, that's what I get for not reading to the end.


  • Java Dev

    Those who can, do.
    Those who can't do, teach.
    Those who can't teach, write the text book.

    Or at least that's what it sounds like.



  • @flabdablet said:

    do

    That fucker right here. What is it doing there? Why does it go after the newline, and yet if you want to put it with the rest of the for statement, it requires a semicolon? What happens if there are more commands? No matter how many times I tried I could never get this syntax right the first time.

    Fish doesn't require that do.

    @flabdablet said:

    done

    That other fucker right there. if blocks end with fi. case blocks end with asec. Yet, for blocks end with done. Nevermind the multiple WFTs fi and asec represent: why not follow suit and also use rof? There doesn't seem to be any Linux program called rof, surprisingly enough.

    Hell, why is it for ... do ... done (connecting with the second item) when it's if ... then ... fi (mirroring the first)?

    Fish uses end in all three cases.



  • ...and still you gave it 3 stars?



  • @bp_ said:

    @flabdablet said:
    done

    That other fucker right there. if blocks end with fi. case blocks end with asec. Yet, for blocks end with done. Nevermind the multiple WFTs fi and asec represent: why not follow suit and also use rof? There doesn't seem to be any Linux program called rof, surprisingly enough.


    I can tell you why BASH does it... because the original Bourne Shell (aka /bin/sh) did it and BASH is the Bourne Again SHell with full compatibility for running Bourne Shell scripts.

    I can theorize why Bourne Shell does it, too: All loops in Bourne Shell start with do/end with done. you can see this in the Bourne Shell / BASH documentation for looping constructs: until, while, and for. As for not using od, that's because it's an actual UNIX command.

    What do/done really is is an anonymous block (and last arg of said loops) and all until, while, and for are doing is executing that block as long as they evaluate to true.



  • Yes. In its great wisdom Amazon bundles together all the versions of the book: hardcover, pocketbook, e-book. I wasn't thus only rating the e-book edition, or its form, but also the (cheaper) pocket book version I ordered a week later as well as the content in general. I rather liked the arguments and theories presented by the author, and the writing style was surprisingly readable. The only problem was that the publisher had appointed Clippit the Office Assistant to do the print layout-to-ebook conversion and copy-editing of the said e-book.



  • And yet if and case use their own command block syntax...


  • Discourse touched me in a no-no place

    @bp_ said:

    And yet if and case use their own command block syntax...

    Something was definitely being smoked by the original Bourne Shell authors (though that weird style was in vogue at the time). Everyone else since then is just staying backward compatible so the mass of existing scripts can continue to work.



  • This is why I'm so happy about fish abandoning all of that baggage.



  • @powerlord said:

    What do/done really is is an anonymous block (and last arg of said loops) and all until, while, and for are doing is executing that block as long as they evaluate to true.
    Considering that you can have neither a loop without an explicit do/done block¹ nor a do/done block without a loop², I don't think this is a very good argument. I think it's much more reasonable to consider them to be part of the synatx of the loop.

    ¹ In traditional Bourne shell. zsh, being made by people who actually have nice ideas, allows loops and conditionals without the explicit do/done or then/fi or whatever.
    ² I am less certain about this, but it seems to be true.


  • Discourse touched me in a no-no place

    @bp_ said:

    This is why I'm so happy about fish abandoning all of that baggage.

    It's amazing what you can do when you don't have any backward compatibility constraints, and it's amazing how little most people care once they realize their existing code won't work with your system.



  • @TGV said:

    It's almost as if you live in Western Europe's most corrupt country.

    Which suggests a solution: go to the bookstores in Palermo and see what totally-legit DRM-free PDF editions they have on offer. It's not like working within a system like that will ever sound like a job for Captain America.



  • @dkf said:

    It's amazing what you can do when you don't have any backward compatibility constraints, and it's amazing how little most people care once they realize their existing code won't work with your system.
    What I don't get is why there's been so little uptake in non-sucky shells for general interactive use. You can still keep Bash around for your existing code; that doesn't mean you have to keep using it for interactive stuff.



  • @Seahen said:

    Which suggests a solution: go to the bookstores in Palermo and see what totally-legit DRM-free PDF editions they have on offer

    I don't know about DRM-free PDFs, but you don't have to go to Palermo for dead tree paper copies. ;)

    (While I'm willing to bet that copying offices do store copies of those dead tree paper copies digitally so they can produce them faster, they would never just give them to you. They make much more money selling you the harder to copy paper editon. They want to avoid second-degree piracy, I suppose.)



  • @bp_ said:

    This is why I'm so happy about fish abandoning all of that baggage

    Meh.

    I have been using Bourne shell since long before fish existed, had no difficulty achieving fluency with it, and still consider it one of the best compromises ever designed between concision for interactive use and expressiveness for scripting. Tiny warts like oddly spelled reserved words don't bother me at all.

    That said, I'm glad you've found a tool that works better for you.

    As for what do is doing there: can't tell you for sure, but can offer a semi-plausible rationale. The do/done block is part of all sh's loops. It's a little vestigial in the for loop because the syntax of what comes after the for keyword is rather constrained, but in while or until loops it delimits the commands executed to generate the loop condition from those in the loop body:

    while
        backing="$(qemu-img info "$image" | grep '^backing file: ')"
        test -n "$backing"
    do
        image="${backing#* (actual path: }"
        if [ "$image" = "$backing" ]
        then
            image="${backing#backing file: }"
        else
            image="${image%)}"
        fi
        echo "$image"
    done
    

    As for remembering where it goes: I have it mentally filed in the same bucket as if and then and while and for: the "words that begin a command list" bucket. All the words in that bucket need a newline or semicolon before, and allow optional newlines after (an option I tend to exercise if, as in the example above, there's more than one command in the list).

    if/elif/else/fi and case/esac are lifted straight from ALGOL, which also has a while loop with a do/od block. Pretty sure the only reason Bourne shell ended up with done instead of od is because od is the octal dump command and masking that with a reserved word would have caused inconvenience for sh's original user base.

    Bourne shell is certainly quirky: the dollar sigil plus curly braces thing is rather noisy, the ) and ;; tokens that delimit case conditions and command lists look more like parser coding shortcuts than actual design, and I sometimes have to doublecheck which of ${name#remove} and ${name%remove} removes a prefix or a suffix, but as I said earlier: meh. It's plenty good enough, and its design flaws are not fundamental.


Log in to reply