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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 C1609260A3 for ; Fri, 17 May 2024 17:58:37 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1715961517; b=LYlv64zPSzb5ScR5v6RTKgK4UVCxojBKsSnuyTpNGGCsRhMhdJmJeTAxTK31RGDxJzyRG1aDQs Z/TXALUvZZRGS3jqGOJU5yQHedg2gHufooJVKeVU3Zgc9cJXLxrpsh6FzzplK+fuFyNqKPaSjb J7/4Vd08/iSOyL5fg9Q2iRGtJ11DQHEnVDQrSx7uQAB6DwCize5UPqLLAiQj5Gt3hOcVbNj3Oz ifbD1DFXwlSdhIB2AkaFjd3mNvtK/DZWr5u9DhI6AiPtoxNpRhR2kbXoIGgDOl++ikdZf88yhQ aQfO9SQ6S8EjZeTRNfjXkxXUFjKojWqOcmrH4klU5fvBeA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; 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=1715961517; bh=DyR3op+Ifus/j5MUoN1O8/KcHXPHie9KAtSK3BaTQRA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Content-Type:DKIM-Signature; b=oBq8gmtFVdZSxfHXoPwuJ8oDGyol3YUiYJk83Bv67Pge/xtF257H/K4ROzYWpATQpIZb386tHh XUR/W69DnyBG4PcqHIIna6M+788PT82AwCuELr+hHIWTTevUhRDByZzF7duVQ75QrA0tWZwzkR my+U8tA/skMHFw9NyimeqOtdbWcuYfEmiQN08LNgi9vxlxQNB1VtVDsUCr0LUzl6RwJo/u4bv7 yQlSMuYRDPny1bp6zZiwRK/r0vJQfHgK/+bU7SZdNFMggTSH9ejWWqusm9qHs0rPeFdE/2xwG6 D9RDRqDYQMhJJLy4+nfYujDLjrTuRqqb742JplVmZdMPjg==; 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:In-reply-to:From:References:To: Subject:MIME-version:Date:Message-id:Content-type:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=9Ry7k0hX4NqEznHDrv1lL4iw7FeZsF+n8HqBRgq0s/E=; b=iZrSEjVhCpBoXMY87Z1ao7CzSA qhohsq4ZSJPooeHrjYENSXobp4uA9vN+X2m3QHZW1qLDVQO/mgjdy1FcHLBTLZ6AlX7N63MsbW/TS KuBn0Je1XBiuVgFfEmQHJiFh611XBSsSwc3D/ArqFyz/6L8XsItU0ypbYaHWn/Z0yOhsSpB0o2xM3 jVCYmKm4v8bAqrs8E6ClEAVhem+CoQ0AsdmuaxleSRmT87NgGlDXOzLNaXNpftN5cCZ5IWjoE+c2J 2ks0hV6VoyP2IFzPIHobvdCDuGckoptyqUZ8WVL1VHYR7QLmlI9o024HXtPf0kE3ae09HoFZuXtTF DEtYiGiQ==; Received: by zero.zsh.org with local id 1s7zyf-000OFL-QA; Fri, 17 May 2024 15:58:37 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:33783) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1s7zy9-000NYl-6S; Fri, 17 May 2024 15:58:06 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta02.eastlink.ca ([24.224.136.13]) with ESMTPS id <0SDN0ZUD7062EP81@mta02.eastlink.ca> for zsh-users@zsh.org; Fri, 17 May 2024 12:58:03 -0300 (ADT) Received: from [192.168.0.15] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp02.eastlink.ca ([71.7.199.167]) with ESMTPSA id 7zy6s6058xAjx7zy7s7Dvv (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Fri, 17 May 2024 12:58:03 -0300 X-Authority-Analysis: v=2.4 cv=EfprQ+mC c=1 sm=1 tr=0 ts=66477e8b a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=Dovr2K0aO16GYI7xODkA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=hrWa4x_5luWhrprrUQsA:9 a=SS0AnOaz5ONdWV2o:21 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdehgedgtddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurheptgfkffggfgfuvfhfhfgjsegrtderredtvdejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpefhteethfevgeeuvdelgefgvdevudefueduffdvgfelvddvgfdtieegueeuleeifeenucfkphepvdegrddvtdejrdduledrudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdduledrudefpdhhvghloheplgduledvrdduieekrddtrdduhegnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------9orPQaat1tPLqUdHjuAbmnvh" Message-id: <4b8449d3-7dfe-4d37-9c6d-1dcf63d1d9b1@eastlink.ca> Date: Fri, 17 May 2024 08:58:02 -0700 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: exit to shell from nested function calls. To: zsh-users@zsh.org References: <9b97bc99-1d92-46f1-8841-c757d1dcee68@eastlink.ca> <09115b25-9017-4233-aaf2-6e4378aba53f@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: X-Seq: 29940 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: This is a multi-part message in MIME format. --------------9orPQaat1tPLqUdHjuAbmnvh Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-05-17 08:40, Mark J. Reed wrote: > Functions are great, and I recommend using them - just use them > _inside_ the script. For anything but the most trivial scripts I make > the main body of the script a function, too, something like this: > > #!/usr/bin/env zsh > main() { >     main program code here > } > Hmmm.  So we can have it both ways -- the flow control of functions but it all vanishes when the script exits?  I'll experiment with that. ... > Only define functions inside your interactive shell when they need to > make changes that persist after they exit - like changing directories, > or updating variable values, etc. That would limit their number considerably.  Ok, goodbye functions ... I mean ... how do you say it?  ... functions at the 'zero level' ... not within a script.  Hearing the same thing from yourself and Roman seals the deal. --------------9orPQaat1tPLqUdHjuAbmnvh Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 2024-05-17 08:40, Mark J. Reed wrote:
Functions are great, and I recommend using them - just use them _inside_ the script. For anything but the most trivial scripts I make the main body of the script a function, too, something like this:

#!/usr/bin/env zsh
main() {
    main program code here
}

Hmmm.  So we can have it both ways -- the flow control of functions but it all vanishes when the script exits?  I'll experiment with that.

...

Only define functions inside your interactive shell when they need to make changes that persist after they exit - like changing directories, or updating variable values, etc.
That would limit their number considerably.  Ok, goodbye functions ... I mean ... how do you say it?  ... functions at the 'zero level' ... not within a script.  Hearing the same thing from yourself and Roman seals the deal.



--------------9orPQaat1tPLqUdHjuAbmnvh--