Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Jens Schweikhardt Newsgroups: comp.unix.shell,comp.unix.programmer,comp.programming.contests Subject: Re: The First Pure Shell Contest (PUSH): relativepath Date: 19 Aug 2011 21:08:25 GMT Lines: 89 Sender: Jens Schweikhardt Message-ID: <9b81m8FiseU5@mid.individual.net> References: <9b7kg7F3njU1@mid.individual.net> <9b7qtqFiseU1@mid.individual.net> <9b7rsrFiseU3@mid.individual.net> <9b7tv0FiseU4@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net TwrSkMMxb+NcXfvy/uO8Yg9JK6bYiskbYc9ZfVkXi9M8f6g3pA X-Orig-Path: not-for-mail Cancel-Lock: sha1:1RUakPOjfFGSgGm7PLGgvecvD4w= User-Agent: tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/9.0-CURRENT (i386)) Xref: x330-a1.tempe.blueboxinc.net comp.unix.shell:1727 comp.unix.programmer:1166 comp.programming.contests:17 In comp.unix.shell pk wrote: # On 19 Aug 2011 20:04:48 GMT, Jens Schweikhardt # wrote: # #> Still, I don't see where your rules forbid using Perl or Awk if one's #> POSIX shell has them built-in (which was the OP's question). #> #> It forbidden by the well known standardese rule of "if it's not defined, #> then it's undefined." aka "undefined by omission". # # Is it well known? # #> 3 You can assume that 'test' and '[' are built-ins. If this is not #> true for your shell you may set PATH with env -i PATH=... to the #> directory with the 'test' and '[' executables for the sole #> purpose of using these external commands. It must run without PATH on a #> shell where these are built-ins (i.e. on the contest evaluation machine). #> #> perl isn't mentioned. So you can not assume it is a built-in. # # Uh...this is basic logic. If I say "you can use the bicycle", does it follow # that you are not allowed to use the car? If that sentence appeared in an ISO document, I'd say yes. If I told you "You can use my bicycle" and you took my car, I'd be surprised. Standardese logic is somewhat different. When you tell your sweatheart "I love you" that usually *does* exlude loving the other heartbreakers in town, without you appending "and only you". Even everyday logic has this property and it's not too unusual to apply this kind of reasoning. # If you said "you can assume that only 'test' and '[' are built-in", then # things would have been different. Even better would have been "As the only additional builtins to those explicitly enumerated in the POSIX shell you can assume test, [ and printf." I'll keep that in mind for the next PUSH. #> I believe that the name of the contest gives an oh so slight hint that a #> solution involving perl is not quite what is meant. The motivation #> paragraph too (even mentions awk). If that isn't enough, the contestant #> would surely wonder if perl was also a built-in on the unknown contest #> evaluation machine. # # Admittedly the Perl and awk example was a stretch, but surely there are a # number of commands that are on the border, and a contestant may assume in # good faith that he's legitimate to use some of them, only to have his # submission fail on your machine. So I think you should explicitly list what # built-ins are available in the evaluation machine's shell, so people know # what they can rely on. I thought this was clear from providing the link in the sample entry. But the "Not exhaustive!" note could be read as opening a wide hole. MISREAD in my mind. #> Reading a text, understanding it and inferring a writer's intention are #> the initial barriers to participating in the contest. I think this goes #> for most contests. # # The same goes for the OP's first comment (and if you've been reading # these groups for a while, I'm sure you know that he knows what he's talking # about). The intention, to me, was to signal that some parts of the rules # were not clear, and instead you interpreted it as a nitpick. See? It works # both ways. Yes, I know Stéphane is a shell wizard but I am still puzzled why he replied the way he did. I assume it is because he wants to point out where the test leaves too much room for misinterpretation, just like he would point out conditions under which a shell script would not do what it is supposed to do--which is a good thing, which I appreciate. I'm no stubborn bonehead and neither are you or Stéphane :-) #> I admit there is room for improvement regarding its formal "rules" (heck, #> the very word does not even appear once!), but I did not want to overload #> the text with kilobytes of blah blah just to fend off the nit-pickers, #> who would find a hole in any formal set of rules. One thing I really #> should add for the next PUSH is "Rule interpretation is MINE ALONE. #> PERIOD!" :-) # # Even then, you should make that interpretation explicit (that is, write it), # and not assume that people can somehow magically infer it. Fair enough. Now that all is clear as mud, back to hacking relativepath :-) Regards, Jens -- Jens Schweikhardt http://www.schweikhardt.net/ SIGSIG -- signature too long (core dumped)