On Tue, Nov 18, 2008 at 9:05 AM, mabshoff <[EMAIL PROTECTED]> wrote: > > > > On Nov 18, 9:01 am, Simon King <[EMAIL PROTECTED]> wrote: >> Dear William, >> >> On Nov 18, 5:26 pm, "William Stein" <[EMAIL PROTECTED]> wrote: >> >> > Which is one more reason to consider it a mis-feature. I had no >> > clue when I wrote that code whether # optional or putting those three >> > words in would turn out to be the way to go. In retrospect, # optional is, >> > since generally speaking, "explicit is better than implicit". >> >> Here I disagree, for the following reason.
Well of course it is a feature. I really thought it was clever when I thought it up and implemented it. But it is a bad design, because it isn't explicit, and it is way too easy for somebody -- both the original author or a user -- to simply not know about. With # optional on each line, that *never* happens. I like your idea of something like sage: # begin optional ... sage: # end optional That's explicit and clear, and doesn't require # optional for every line. > There has been talk about making "#optional" more clever, i.e. one > would feed it a list of optional components and then -optional would > only test for those components that are installed. One could still > have a global switch to do what you want, but let it be less random > than some words in the text. I think that (1) will definitely happen since I need it for testing the Sage/Magma interface, and (2) is orthogonal to this discussion. > >> I have many examples for a class that depends on SmallGroups library >> being installed. >> With the "requires optional package" feature, I can turn off all >> examples at once. >> >> Am I right that it'd be needed to put "# optional" after each input >> line? Then, I think the "requires optional package" really is a >> feature, not a misfeature. >> >> Similar things hold with the "# long time" feature: It switches off >> one input line (unless -long is used), but it does not switch off the >> lines that depend on it. >> How painful if you have many lines of code that only take short time >> but have to be commented # long time since they depend on one long >> command from the very beginning of the example! >> >> I think it would be nice to have a way to define a whole block of code >> as "being long". E.g. >> sage: One_long_command # starting long example >> sage: many >> sage: short >> sage: commands # ending long example >> sage: continuing >> sage: independent >> sage: computations >> >> so that the first four lines (but not the last three) require sage -t - >> long >> >> Yours >> Simon > > Cheers, > > Michael > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---