From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9711 invoked by alias); 21 Oct 2015 03:53:00 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20801 Received: (qmail 11460 invoked from network); 21 Oct 2015 03:52:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=FNXuVaEF54CkhnX7MLml7/NgJB8c8Xhwr9bt3vAcch8=; b=akdOQaeWVC9vLtTa+xuk7E/dSPEso5Hq2P/eW+UvkXecJW6iPESodQfa1rj//eoap1 5hOqp6SsIdOGeO7ARTokNoW5lG4dAg4NwwKl7LiTACREIU11oh4QxiPTJI98QZqZw7Dc 4ekkeKhVzIP7o7egLsqzI4w8WFZReokkDQmvoVPrzib/rQbsKJWEhH+eJ2Vq6JbcJ+M9 bmZeNUSNyr2IWIYp7dTXtVyCe0olGMN7t1HPWXqlpQvqsdmKqEpEvlN0QthuiPn5tKj/ ItgiLkWj/FE4KQf/2bORMkRX41LyWpNhZc97V2ca48WMVqHloWhhqltCnpG4ZmmgKIj8 w1EA== X-Gm-Message-State: ALoCoQkAdzbLBtt5ncxxp2hI+PXCT7B/3DAKwgXkRRnWXqYcpRl6STVcwchvHEqoGK4VKS9TMAxS X-Received: by 10.60.138.10 with SMTP id qm10mr4419206oeb.42.1445399577492; Tue, 20 Oct 2015 20:52:57 -0700 (PDT) From: Bart Schaefer Message-Id: <151020205254.ZM1906@torch.brasslantern.com> Date: Tue, 20 Oct 2015 20:52:54 -0700 In-Reply-To: <5626FE9D.9020003@eastlink.ca> Comments: In reply to Ray Andrews "Re: suprise with -=" (Oct 20, 7:55pm) References: <562483C9.1060602@eastlink.ca> <151019113517.ZM32739@torch.brasslantern.com> <562545DD.5020008@eastlink.ca> <151019172744.ZM558@torch.brasslantern.com> <5626FE9D.9020003@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Ray Andrews , zsh-users@zsh.org Subject: Re: suprise with -= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 20, 7:55pm, Ray Andrews wrote: } Subject: Re: suprise with -= } } On 10/19/2015 05:27 PM, Bart Schaefer wrote: } > The parser doesn't know that "first" is an integer, or even that it's } > a variable that was previously declared. This is perfectly legal: } > } > if (( RANDOM % 7 )) } > then integer first } > else declare first } > fi } > first+=second } } Then what does 'integer' or 'typset -i' do? They declare that the internal representation of the variable should be an integer, so that integer formatting may be applied when the variable is converted back to a value with $first. } I can't help but wonder what was going on in the minds of the guys who } coded the first shells The first shells didn't have integers or arrays at all. They had only strings, and a few (external) programs like "expr" that could interpret strings of digits as numbers. Arrays came next and numbers/math last of all, so numbers must conform to the rules established when the shell was strings-only. Shells were never intended to look or behave anything like C (well, except for csh, but it was only supposed to look like C, not act like it, and it got a lot of other things wrong).