From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 7F7BB21D3C for ; Tue, 30 Jan 2024 14:45:06 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1706622305; b=mwKEMA1oC3mKW9hhQREuT3sVs+bxDCg0tuX5koywo2nu32O5yujXSS1zUsrEQX2inYVobNcs7c EZ6fdyz9KhSIPZ0z08eCtbLHgGjC074jP5//2zrjX8LZqbThmSQcULwOm0BL4TDsIsCvSrVc5P x0ZQEWeVfG76PISoJooadwAxu3XtUaqRsbXWxsPeYPDS/K/0y2keyb1ZFZlAk/H2XI1JsrD4fT FCRYyZijofGqBmhXk3oAC5DpVj8u37Yo00aD/XjnavojEMtXuY7X0lzKt0JF/M7HvWZxueuB2F BR/xwTqnBziq8kZqPEDSvxGaAjzPLCU8kxTQ6AHeCpUySg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta01.eastlink.ca) smtp.remote-ip=24.224.136.30; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1706622305; bh=wWauJHeu0Y5XXdXIpvWlZrMZHH/KZm+al1FMGbNt0cw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=ixHE39VHzjmyJyvWJVVcdFJ8llw0NyI+X9TH2rGxhXDlYDf76b/mb+oN8QEHEejRD4/Ue1pvWh IlfZf0TCO5kBVP0d7lBsjIRIHF4vs4g4SVWPnEcVx/gHR4cH+Q9GdYqB+gTkdUL/9VZpulZSr1 N8bQmPYpJrQ0fLa3xoATjJqFa2HfzLCUmLYmYh9HJQzyQyAywpNiPwUf38YSr45NQ1Gyvug8G4 NzJOPZGNuBs3Lltbk9OfWZWkO0IB0SHe4X3nH3NUJRkwxC8aqFeWbXI0EsExEC+lJkG3+u8cto GT9GigS3jNUOgdc/F6ehkeiBereIqhWc61/nDp44XVMX1w==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-transfer-encoding: Content-type:In-reply-to:From:References:To:Subject:MIME-version:Date: Message-id:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=z3oNzqZDAZwe5wccSpskXMHDHidBhUz8/wep03j855I=; b=bSJtHgq0QdEJLvGyDhRsTkRrng cqaBHOdLa9WnSM8q39oiqH3eQqqeZSCF2nj1I2uv/SDIBXO1EY/GqZ/9I5iLGuFApkibsCtOn6HkL h91VsHby4ebeAZJt7PZEsGKxQklMSlzuAFN3vmcFIqWAby7KvnQarCO7NxTPK0OfRNkazvNNTMbt5 kToV9/3mav3rojB5mA5WcFmwe1CMWmZKfnTtZkHSdPSu15Il3RErbsBSuApgv356WysXhM3CeS3lC McAlSk8jCnL41lRHc6vNElv7wxRDFj/FvTTNqMNqNIpkmcUY0kvPhVhgJeQybBVBWYGep9I00ElC1 exC2H3yQ==; Received: by zero.zsh.org with local id 1rUoQC-000FFB-Nh; Tue, 30 Jan 2024 13:45:04 +0000 Authentication-Results: zsh.org; iprev=pass (mta01.eastlink.ca) smtp.remote-ip=24.224.136.30; dmarc=none header.from=eastlink.ca; arc=none Received: from mta01.eastlink.ca ([24.224.136.30]:36261) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rUoPa-000EYZ-FV; Tue, 30 Jan 2024 13:44:27 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta01.eastlink.ca ([24.224.136.30]) with ESMTPS id <0S821A312U1ZELJ0@mta01.eastlink.ca> for zsh-users@zsh.org; Tue, 30 Jan 2024 09:44:25 -0400 (AST) Received: from [192.168.0.11] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp02.eastlink.ca ([71.7.199.167]) with ESMTPSA id UoPYr4FOd1sDHUoPZre5pj (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Tue, 30 Jan 2024 09:44:25 -0400 X-Authority-Analysis: v=2.4 cv=SpQz6+O0 c=1 sm=1 tr=0 ts=65b8fd39 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=IkcTkHD0fZMA:10 a=q2GGsy2AAAAA:8 a=FPz1hI7Fwe5-9NN8RoYA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=z9dJwno5l634igLiVhy-:22 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedtiedgheehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepteffhffgvdeffeelveelhfegudevkeduhfehheevhfekhfevieehjeejheefvefgnecukfhppedvgedrvddtjedrudelrddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudelrddufedphhgvlhhopegludelvddrudeikedrtddruddungdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: <0875ffd7-e3a4-4ddc-9c4b-47e2c593ea4c@eastlink.ca> Date: Tue, 30 Jan 2024 05:44:24 -0800 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: for loop 'bad math expression' To: zsh-users@zsh.org References: <4c14e191-0605-4492-9f67-9a5b35ef132b@eastlink.ca> <4da0eeb4-4589-4c5d-9b89-a1a22209e18e@eastlink.ca> <7ccf5b82-a37d-47b5-a700-fb1096ab495c@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: <7ccf5b82-a37d-47b5-a700-fb1096ab495c@eastlink.ca> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 29605 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 2024-01-29 20:17, Ray Andrews wrote: > > On 2024-01-29 20:06, Bart Schaefer wrote: >> On Mon, Jan 29, 2024 at 8:04 PM Bart Schaefer >> wrote: >>> So, something has declared "bb" to be an integer. >> Or a float, or some other numeric type, they all produce that error. > > Right you are.  Yeah, some careless use of the variable, I didn't > bother to declare it local so it's some stray coming from somewhere > else.  I hate that.  Orphaned variables hanging around waiting to get > into trouble.  I'll track down the leak.  Thank you Sensei. BTW Bart, just a post mortem on that: I know there are situations where a plain vanilla scalar is promoted to integer when the situation requires it.  In the above, I wonder about an automatic demotion.  The situation plainly had nothing to do with arithmetic OTOH perhaps there could be situations where a for loop like that one really would be doing arithmetic there in which case type assumptions would be unwise.  OTOOH perhaps automatic 'non demotion' would be possible -- zsh might have robust defenses against making a mistake.  Dunno, but as dangerous as 'obvious' can be, it seems to me that a glob expansion of a bunch of filenames is obviously nothing to do with arithmetic. 3 /aWorking/Zsh/Source/Wk 0 % var=abc; var=$(( 1+1 )); echo $var 2 for bb in *.eml~save*; do ... just as var can be automatically turned into an integer so to perhaps bb could be clearly understood to be scalar in that situation.  Again, unless I really might have intended something mathematical there which is hard to imagine. > > >