| Deutsch English Français Italiano |
|
<20250105201301.1fe87ba4@lud1.home> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Luc <luc@sep.invalid> Newsgroups: comp.lang.tcl Subject: Re: The "leading zero means octal" thing... Date: Sun, 5 Jan 2025 20:13:01 -0300 Organization: A noiseless patient Spider Lines: 50 Message-ID: <20250105201301.1fe87ba4@lud1.home> References: <vlcbrr$2ito3$1@news.xmission.com> <20250105164657.7eeaf441@lud1.home> <vles5e$16v92$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Mon, 06 Jan 2025 00:13:02 +0100 (CET) Injection-Info: dont-email.me; posting-host="26e21046964ae59aa6f9b4ae9aa6300b"; logging-data="1315428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NbV2Ap94Zas+BMNnPO4MaEkqpisB+qkA=" Cancel-Lock: sha1:sTtOyQ1nmiapmBCHV6D43NsWLwU= Bytes: 2909 On Sun, 5 Jan 2025 21:04:46 -0000 (UTC), Rich wrote: >Luc <luc@sep.invalid> wrote: >> I updated my 'seq' code because of this thread: >> >> https://wiki.tcl-lang.org/page/seq > >And, line one of the proc contains the common Tcl bug of "applying a >string operator" to a tcl list. ************************** While I admit that I never took the list to string conversion into consideration (I am repeat offender at that), you explore certain possibilities in your exposition that I did take into consideration, and I decided that those don't matter. Anyone who has ever used seq (or just merely understands it in spite of never having used it) knows what the input is supposed to be: two or three integers. I improved on it by adding the ability to produce alphabetic sequences. About your examples, being atypically blunt, no programmer is stupid enough to input 08 and 08. Even I wouldn't that. Likewise, no programmer will be stupid enough to input #08. And if anyone actually does that, they will get the empty string. The code intentionally refuses to produce output when the input is incorrect. Of course, we have to consider the possibility of input being generated by some other code, which makes it more unpredictable. But then the blame will fall upon the code that produces incorrect input, and whoever writes (and hopefully tests) such code will have to make sure that the input is always correct. I can't blame the authors of the list and string commands to be responsible for my repeated incorrect use of lists and strings. But of course I am glad you chimed in once again because I was getting wrong outputs for '08 08' and '08 09'. I also noted another bug that you didn't point out: 'p.seq 0 5' was outputting '1 2 3 4 5' without the zero, which was also incorrect. So thanks to you, I have updated the code once again. Thank you. -- Luc >>