From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25706 invoked by alias); 23 Sep 2015 04:39:42 -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: 20627 Received: (qmail 21441 invoked from network); 23 Sep 2015 04:39:42 -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=qhcqDi6VW6To7/h8rRUh7JMuKRD87Hq/dyixdxz5p5g=; b=QoFUuIwblXvd75jZ3BlxBTk30wkrvTYJMr+Hp+0NguoKAzGNtX0x/jHVcQspAHmTJr w7roClTd3aIf3z8XyxWYmD9HAZrLAnVUjxShVUVwNEe85DjpVONv6iOFaKtV+fEd1Xt8 HOY+DGkBwRBFpWQeG9z5e1KCEKPTzljy8ydfzJzodlp7u6Biy8FW4AP+DuP5m0NHKPih uzDqHbn793jBGmJ3oKD9sZ8/fIR5hpq6nFPD2eeVbm2ySQYavQp3TB6r8IQCz0NtgJoO QbqRp0RxchLjFliCan6y7OjphvzftUmogvlUHoznwrfPyO78WJnl3T6/IPRW8ZQl9ZSP GXQQ== X-Gm-Message-State: ALoCoQm6iJBBcnC9gtaVZRx8/SQ8zsXTNLlUUwpGIVeXl8B3w7OglhUSxHeSY2STde1vU8SoR8mf X-Received: by 10.202.9.132 with SMTP id 126mr15536429oij.4.1442983178650; Tue, 22 Sep 2015 21:39:38 -0700 (PDT) From: Bart Schaefer Message-Id: <150922213936.ZM30271@torch.brasslantern.com> Date: Tue, 22 Sep 2015 21:39:36 -0700 In-Reply-To: <560190F4.8020404@eastlink.ca> Comments: In reply to Ray Andrews "Re: autoload" (Sep 22, 10:33am) References: <55FAE223.2080502@eastlink.ca> <150917103419.ZM10067@torch.brasslantern.com> <150918171441.ZM27212@torch.brasslantern.com> <55FD7982.9030505@eastlink.ca> <150919092922.ZM28214@torch.brasslantern.com> <55FDA5D3.9020304@eastlink.ca> <150919142243.ZM23634@torch.brasslantern.com> <55FE04AD.1070304@eastlink.ca> <150919224120.ZM4736@torch.brasslantern.com> <55FF3F7E.4060906@eastlink.ca> <150920211840.ZM31871@torch.brasslantern.com> <5600386E.7060201@eastlink.ca> <150921111746.ZM388@torch.brasslantern.com> <56006401.5060902@eastlink.ca> <150921201943.ZM707@torch.brasslantern.com> <560190F4.8020404@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: autoload MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Just so no one else is confused ... On Sep 22, 10:33am, Ray Andrews wrote: } } > zcompile lets you do two things: compile a single file to be read by } > source (*) or pack multiple files into an archive to be processed } > by autoload. } > } > (*) But this is constrained in that both the original file and the } > compiled file have to exist size-by-side, so that source can choose } > the newer of the two. This constraint isn't strictly necessary. } } Well therewego. Previously you're saying that these .zwc should not be } in the same dir, now they should be in the same dir. Two different use cases: (1) Packing up multiple files into a composite ZWC? Don't put the composite alongside the files packed in it. This is the case we started out talking about two dozen messages ago. Makes sense only for autoload. (2) Packing one file into one correspondingly-named ZWC? Put the ZWC alongside the origin file. Works for source or autoload, but in the autoload case this must be one-function/one-file/same-name. The autoload search is straightforward: $fpath order comes first. If, while searching fpath in order, a pair of files "x" and "x.zwc" is found, read the newer one. As a special case of this, if "x" is actually a directory listed in fpath, assume "x.zwc" contains all the same files as "x/". The "source" (and ".") search rule is similar, except using $path and without the directory special case. } $ autoload my_function } $ source /functions/myfunction } } ... I get the sourced version. Yes, because in this case you clobbered the autoload declaration by loading the full function definition on top of it with "source". } $ source /functions/myfunction } $ autoload my_function } } ... I get the version in the .zwc found on FPATH. No, you still get the one from the "source" command, because autoload won't replace an existing function definition. The only way to ever get the version found on fpath is by never doing the "source" at all.