Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

How can 'goto' command be used in Tcl......

3 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Sudhir Srikantian

ungelesen,
19.05.1993, 08:49:4119.05.93
an

Hi,

Is there goto command in Tcl.

If it's not there can anyone show me a example how
to do one.

I was trying not to use goto commands but in my program I
have to jump back.

thank you


sudhir
sud...@pyramid.cs.unr.edu

Gerald W. Lester

ungelesen,
20.05.1993, 09:39:0520.05.93
an
In article <1993May19....@physics.unr.edu>, sud...@dws016.unr.edu (Sudhir Srikantian) writes:
>
>
> Hi,
>
> Is there goto command in Tcl.

There is no goto. (thanks be to John and God)

>
> If it's not there can anyone show me a example how
> to do one.

Use the proc, while, and if-the-else constructs.

In the late 60s early 70s (refereences anybody) N. Wirth amd others wrote
several papers and books on goto-less programming, you may find them useful
reading.

>
> I was trying not to use goto commands but in my program I
> have to jump back.

This can be avoided through the use of the above mentioned statements. I once
had teh pleasure of removing two of the three gotos in a Pascal compiler (in
Pascal of course). The third goto was scheduled to get removed but we ran out
of time to do it.

Bud Bach

ungelesen,
20.05.1993, 18:32:0020.05.93
an

Oh no... Goto wars... Hit the KILL button!


--
Bud Bach
TechniSource, Inc.
708 632-3449

Francesco Stajano

ungelesen,
21.05.1993, 06:19:4121.05.93
an
In article <1993May20.1...@cpu.com>, gwle...@cpu.com (Gerald W. Lester) writes:

|> In the late 60s early 70s (refereences anybody) N. Wirth amd others wrote
|> several papers and books on goto-less programming, you may find them useful
|> reading.

The main result was the "Boehm - Jacopini" theorem, which proved
(constructively) that for any given program you can write an equivalent program
that only uses sequence, selection (IF) and iteration (WHILE). The reason why I
remember the name is that I was lucky enough to have Corrado Boehm as a
professor (and an extraordinary one at that) in one of my university courses.

--

Frank (Filologo Disneyano)

Hamish Macdonald

ungelesen,
21.05.1993, 08:45:0021.05.93
an
>>>>> On 21 May 1993 05:19:41 EST,
>>>>> In message <1993May21.1...@infodev.cam.ac.uk>,
>>>>> f...@cam-orl.co.uk (Francesco Stajano) wrote:

Francesco> The main result was the "Boehm - Jacopini" theorem, which
Francesco> proved (constructively) that for any given program you can
Francesco> write an equivalent program that only uses sequence,
Francesco> selection (IF) and iteration (WHILE).

The big question would be:

"Is that equivalent program less readable and maintainable than the
original".

John Ousterhout

ungelesen,
21.05.1993, 13:46:4621.05.93
an
In article <1993May20.1...@cpu.com>, gwle...@cpu.com (Gerald W. Lester) writes:
|> In article <1993May19....@physics.unr.edu>, sud...@dws016.unr.edu (Sudhir Srikantian) writes:
|> >
|> >
|> > Hi,
|> >
|> > Is there goto command in Tcl.
|>
|> There is no goto. (thanks be to John and God)
|>

Actually I don't have a strong philosophical objection to goto. I think
that goto's should be used very sparingly, but there are definitely
situations where programs are a lot clumsier without them. The reason
they're not in Tcl is that I haven't been able to figure out how to
implement them (the structure of Tcl and its interpreter make it hard
to skip backwards or forwards).

0 neue Nachrichten