From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17175 invoked by alias); 25 Jun 2015 01:42:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35596 Received: (qmail 19066 invoked from network); 25 Jun 2015 01:42:10 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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:cc:mime-version:content-type; bh=eEXtoi/Fs48+9D16bsBAPu2psuaDx2+uuhrC6Xqr2Ts=; b=H82f2MYHwE4UWqg8RsLS/n0gfu0wjxHiiAVhO9aFciCIiMAK6OuOUtahfLtsJXHjvK aUowMTgsBmAxnG2ym/rjV3zJMlNIzwTbILgaXNpfZGpR8qKjr7dYnOeKZguETZ9NnTIn Oonqwb/CiL5rEkaFM4W2X000bapm7lpDNZ2XR5zNfNZccoCF2QQRqiE267o0ZrM2ZuQO o+e7whE5j3JO11rg1X9rOouk/9ILW/ConwUKqyIp9fWtCaSJQ/uYLv7SwUdOGZ+H3d0H 5ibSAE2dZVzg48OHYIUc+ar8JlBIKejzzEv3/SpXzxykBmCHiq4LHPBzhoRjPdPo4jPw JN3w== X-Gm-Message-State: ALoCoQljakv8S7f7XgcLgKl9GGMbJeTKt6dnGA8X/gGmaHGaOVHEYEGQVnI9FVfqyLVQZ7aDM3H3 X-Received: by 10.182.86.9 with SMTP id l9mr37154390obz.61.1435196526626; Wed, 24 Jun 2015 18:42:06 -0700 (PDT) From: Bart Schaefer Message-Id: <150624184201.ZM19069@torch.brasslantern.com> Date: Wed, 24 Jun 2015 18:42:01 -0700 In-Reply-To: <87fv5gk8m8.fsf@nl106-137-147.student.uu.se> Comments: In reply to Emanuel Berg "Re: multi-alias syntax" (Jun 25, 1:08am) References: <87si9hf2n9.fsf@nl106-137-147.student.uu.se> <150624113448.ZM18893@torch.brasslantern.com> <87fv5gk8m8.fsf@nl106-137-147.student.uu.se> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: multi-alias syntax Cc: Emanuel Berg MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 25, 1:08am, Emanuel Berg wrote: } } debian-version debian-ver version ver () { lsb_release -a } # 1 } # 2 } debian-version () { lsb_release -a } } alias {debian-ver,version,ver}=debian-version Or #3 alias {debian-,}{version,ver}='lsb_release -a' } Anyone cares to line up the pros and cons of the two } approaches? - in terms of programming, and use. } } I can already tell they are not identical as in (1) } debian-ver etc. are functions, not aliases. That's the only difference that really matters. General differences/gotchas with using aliases is covered in FAQ question 2.3 ( http://zsh.sourceforge.net/FAQ/zshfaq02.html#l12 ). Specific to this example: #1 - uses slightly more memory - after the functions are defined, they are separate objects, so changing one of them doesn't change the others #2 - changing the function changes (the outcome of) all the aliases - changing any of the aliases doesn't change the others #3 - changing any of the aliases doesn't change the others Of course if you're never going to change anything on the fly once it has been defined in your startup, most of that is irrelevant. The additional point is that aliases expand at parse time, so if you define an alias, then load a function that refers to the alias, and later redefine the alias, the function will continue executing the original expansion of the alias. Given that you said: } I want long and descriptive name in the } source so I can understand it years later. But for } interactive use I want short names in many versions. I'd probably go with #2.