[Haskell-cafe] Re: [Off topic] Proving an impossibility

Vimal j.vimal at gmail.com
Tue Sep 4 10:43:12 EDT 2007

> I hadn't interpreted the "reminding of Knuth" that way. I
> wouldn't count break as a goto -- what makes goto especially
> nasty is that the destination isn't indicated by the
> structure of the source; it could be just anywhere. Break is
> slightly more structured.

Maybe you might need to take a look at this :-)

Linus does get a little serious about Pascal.

But I feel that gotos, like pointers is a tool that makes programming easy
(in some context, like modeling a simple FSA). So, its better that we
take them in a
"Use them with Caution" attitude!
Okay, "pointers" may not be a nice thing to discuss here :-)

I have been a little sluggish in my replies to mails that came here. I forgot
to click "Reply All". These are smoe of the missed replies ...
> But it IS possible.  Just add a boolean flag:
> done = False
> while E and not(done) do...
> I'll let you work out the rest.  Unless I am missing something here... are
> you not allowed to introduce extra variables? It's a strange thing for your
> professor to ask, since under reasonable assumptions, anything that is
> computable can be done only using if and while.  goto (which is essentially
> what break is) is never necessary.

Ah, yes, it is possible in this case, but you have used an extra variable.
It is okay, but our professor doesnt want to put emphasis on
Computability here (or maybe I dont realize it), but the point is: Are
such programming constructs really necessary in a programming
language? i.e. Is Breakl, goto, falling through switch/case
statements, necessary in a language?

This also brings another point. What if there are N loops like this,
and there is no break statement available in your language? You would
have to use N conditional variables, and would make mainting the code
a horrible thing to do.
> Possibly, you are not allowed to change the sequence of machine operations at all. See, if you change "while(A){B}" to "if(A){B};while(A){B}", the sequence is exactly the same; but it's not possible in this case.

Changing the sequence is fine as long as the execution of one doesnt
affect another.
So, he is trying to bring the idea of functional programming here, to
avoid side-effects.

> It reminds me of a paper by Knuth, where he states that "goto" statement is necessary; don't remember the title, however.

Thanks for the info! I willl check it out soon!


More information about the Haskell-Cafe mailing list