Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

In 1750 Issac Newton became discouraged when he fell up a flight of stairs.


devel / comp.lang.tcl / Script completion status

SubjectAuthor
* Script completion statusAlan Grunwald
`* Re: Script completion statusapn
 `* Re: Script completion statusAlan Grunwald
  `- Re: Script completion statusAlex P

1
Script completion status

<tdjmh4$i9fa$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19840&group=comp.lang.tcl#19840

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: nospam.nurdglaw@gmail.com (Alan Grunwald)
Newsgroups: comp.lang.tcl
Subject: Script completion status
Date: Wed, 17 Aug 2022 22:28:04 +0100
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <tdjmh4$i9fa$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 17 Aug 2022 21:28:05 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="5c6683907771cabcf2edadb6c6787031";
logging-data="599530"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rqglyY+u0IwVk+spwQV4OAiGwsTDFUoY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:oC3g3V1IA/P7t7i0h5C+P+AOsfI=
Content-Language: en-US
 by: Alan Grunwald - Wed, 17 Aug 2022 21:28 UTC

Summary:

I've found the following:

% puts stdout [catch {incr i}]
0 % puts stdout [catch {error foo}]
1 % puts stdout [catch {return foo}]
2 % puts stdout [catch {break}]
3 % puts stdout [catch {continue}]
4

Which is all as expected and documented.

However

% puts stdout [catch {return -code ok}]
2 % puts stdout [catch {return -code error}]
2 % puts stdout [catch {return -code return}]
2 % puts stdout [catch {return -code break}]
2 % puts stdout [catch {return -code continue}]
2

I'd expect these to return 0, 1, 2, 3 and 4 as in the previous case.

What am I missing?

Background:

I'm doing some web scraping and I want to check if something has
appeared on the page, if so, I'm done, otherwise I want to pause and
retry a few times, and if it's not there at the end there's an error.
So, I'm trying to develop a new control structure of the form

proc wait {testScript} {backoff script} {timeoutScript} {
.
.
.
}

I want to return some application-specific information from the
timeoutScript, and I've been trying to do so via [return -code error],
but the error isn't being propagated to the code that calls wait because
timeoutScript is using return -code error -errorinfo {...} {other
stuff}. I've changed this to error {other stuff} {...} and my code in
[wait] works as I want it to, but the return manpage seems to suggest
using [return] rather than [error].

I'm using tcl 8.6.9 from ActiveTcl and testing with tkcon.

Alan

Re: Script completion status

<tdk4q4$lor6$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19842&group=comp.lang.tcl#19842

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: palmtcl@yahoo.com (apn)
Newsgroups: comp.lang.tcl
Subject: Re: Script completion status
Date: Thu, 18 Aug 2022 07:01:47 +0530
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <tdk4q4$lor6$1@dont-email.me>
References: <tdjmh4$i9fa$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 18 Aug 2022 01:31:48 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="79f9b285835aeccff216e6b1f77e4fbb";
logging-data="713574"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UbDNtcL7hocI5TUC8fdx1"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.12.0
Cancel-Lock: sha1:oCax4+x6Gp5mx1XENbtIQffQfEY=
In-Reply-To: <tdjmh4$i9fa$1@dont-email.me>
Content-Language: en-US
 by: apn - Thu, 18 Aug 2022 01:31 UTC

The -code option value has to be interpreted in conjunction with the
-level option which defaults to 1.

% puts [catch {return -code error -level 0}]
1 % puts [catch {return -code break -level 0}]
3 % puts [catch {return -code continue -level 0}]
4

Without the -level 0, the codes are seen one level up the stack
(defaulting to -level 1), not by the return invocation itself.

% proc xx {} {return -code break} ; # Defaults to -level 1
% catch {xx}
3 % proc yy {} {return -code break -level 2}
% proc zz {} {yy}
% catch yy
2 % catch zz
3

/Ashok

On 8/18/2022 2:58 AM, Alan Grunwald wrote:
> Summary:
>
> I've found the following:
>
> % puts stdout [catch {incr i}]
> 0
> % puts stdout [catch {error foo}]
> 1
> % puts stdout [catch {return foo}]
> 2
> % puts stdout [catch {break}]
> 3
> % puts stdout [catch {continue}]
> 4
>
> Which is all as expected and documented.
>
> However
>
> % puts stdout [catch {return -code ok}]
> 2
> % puts stdout [catch {return -code error}]
> 2
> % puts stdout [catch {return -code return}]
> 2
> % puts stdout [catch {return -code break}]
> 2
> % puts stdout [catch {return -code continue}]
> 2
>
> I'd expect these to return 0, 1, 2, 3 and 4 as in the previous case.
>
> What am I missing?
>
>

Re: Script completion status

<tdl9a2$1154p$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19846&group=comp.lang.tcl#19846

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: nospam.nurdglaw@gmail.com (Alan Grunwald)
Newsgroups: comp.lang.tcl
Subject: Re: Script completion status
Date: Thu, 18 Aug 2022 12:54:41 +0100
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <tdl9a2$1154p$1@dont-email.me>
References: <tdjmh4$i9fa$1@dont-email.me> <tdk4q4$lor6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 18 Aug 2022 11:54:42 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="eb5574b479df9817771bdf12981183c6";
logging-data="1086617"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LbJdF1xDXp2Wl6ZxRpa/kJgyqOqaADJg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:YLPLHxjvveIRfIBrhdU6KA57/1A=
Content-Language: en-US
In-Reply-To: <tdk4q4$lor6$1@dont-email.me>
 by: Alan Grunwald - Thu, 18 Aug 2022 11:54 UTC

Thanks Ashok,

That has certainly fixed my problem.

I guess the problem is that the code with the 'return' in it is executed
via uplevel rather than some variety of call. I suppose the lesson is
that this is pushing my understanding of Tcl to its limits.

Thanks again,

Alan

On 18/08/2022 02:31, apn wrote:
> The -code option value has to be interpreted in conjunction with the
> -level option which defaults to 1.
>
> % puts [catch {return -code error -level 0}]
> 1
> % puts [catch {return -code break -level 0}]
> 3
> % puts [catch {return -code continue -level 0}]
> 4
>
> Without the -level 0, the codes are seen one level up the stack
> (defaulting to -level 1), not by the return invocation itself.
>
> % proc xx {} {return -code break} ; # Defaults to -level 1
> % catch {xx}
> 3
> % proc yy {} {return -code break -level 2}
> % proc zz {} {yy}
> % catch yy
> 2
> % catch zz
> 3
>
> /Ashok
>
> On 8/18/2022 2:58 AM, Alan Grunwald wrote:
>> Summary:
>>
>> I've found the following:
>>
>> % puts stdout [catch {incr i}]
>> 0

<snip>

>>
>> Which is all as expected and documented.
>>
>> However
>>
>> % puts stdout [catch {return -code ok}]
>> 2

<snip>

>>
>> What am I missing?
>>
>>
>

Re: Script completion status

<4a3aeadf-6361-44e8-8e98-2a537d9ab215n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19847&group=comp.lang.tcl#19847

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:4691:b0:6bb:297e:279 with SMTP id bq17-20020a05620a469100b006bb297e0279mr4975111qkb.35.1660907907352;
Fri, 19 Aug 2022 04:18:27 -0700 (PDT)
X-Received: by 2002:a05:6830:56b:b0:638:d57d:2253 with SMTP id
f11-20020a056830056b00b00638d57d2253mr2722270otc.384.1660907906984; Fri, 19
Aug 2022 04:18:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 19 Aug 2022 04:18:26 -0700 (PDT)
In-Reply-To: <tdl9a2$1154p$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=85.249.18.81; posting-account=VcikiQoAAAB8qn43rZQzxdhWq0g1FGMy
NNTP-Posting-Host: 85.249.18.81
References: <tdjmh4$i9fa$1@dont-email.me> <tdk4q4$lor6$1@dont-email.me> <tdl9a2$1154p$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4a3aeadf-6361-44e8-8e98-2a537d9ab215n@googlegroups.com>
Subject: Re: Script completion status
From: aplsimple@gmail.com (Alex P)
Injection-Date: Fri, 19 Aug 2022 11:18:27 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1196
 by: Alex P - Fri, 19 Aug 2022 11:18 UTC

Just to not limiting yourself:
https://www.magicsplat.com/ttpl/index.html


devel / comp.lang.tcl / Script completion status

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor