[30139] in Perl-Users-Digest
Perl-Users Digest, Issue: 1382 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 21 14:14:15 2008
Date: Fri, 21 Mar 2008 11:14:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 21 Mar 2008 Volume: 11 Number: 1382
Today's topics:
Re: strategys other than subroutine and OO? <joost@zeekat.nl>
Re: strategys other than subroutine and OO? <yankeeinexile@gmail.com>
Re: strategys other than subroutine and OO? <szrRE@szromanMO.comVE>
Re: strategys other than subroutine and OO? <john@castleamber.com>
Re: strategys other than subroutine and OO? <No_4@dsl.pipex.com>
Re: strategys other than subroutine and OO? <john@castleamber.com>
Table creation <venkatesh.sourav@gmail.com>
Re: Table creation <glex_no-spam@qwest-spam-no.invalid>
Re: Table creation <joost@zeekat.nl>
Re: Table creation <jurgenex@hotmail.com>
Re: test <savagebeaste@yahoo.com>
Re: test <rcmitchell@gmail.com>
Re: test <savagebeaste@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 21 Mar 2008 10:06:49 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: strategys other than subroutine and OO?
Message-Id: <8763vg4f9y.fsf@zeekat.nl>
"szr" <szrRE@szromanMO.comVE> writes:
> Correct me if I'm wrong, but are not last/next/redo with labels basic
> `goto` statements that enact a last, next, or redo on the loop
> associated with the label?
Not exactly. Since you can only use them to go up the call stack another
way to think of them is as special exceptions with built-in handlers.
For real fun, see common lisp's condition/restart system.
In any case everything that alters the program flow can ultimately be
seen as a (conditional) goto. Even such basic operators as && and if()
> Does this constitute a necessary evil, or more rather, demonstrates an
> instance where `goto` (in some form) has a place?
It just demonstrates a useful pattern for program flow, which IMO is
better handled by having explicit operators with predefined behaviour
than by goto. The main problem with goto for me is that it's so
unrestricted it *can* lead to code that's very hard to understand and
bugs that are hard to analyze, not that it's inherently evil or anything
like that.
Perl has enough useful flow control operations and other features that
it's rare to run into situations where goto() is the cleanest / clearest
/ obvious choice.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: 21 Mar 2008 08:42:28 -0600
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: strategys other than subroutine and OO?
Message-Id: <87zlssqgtn.fsf@hummer.cluon.com>
John Bokma <john@castleamber.com> writes:
> RedGrittyBrick <RedGrittyBrick@SpamWeary.foo> wrote:
>
> > In nearly 30 years of programming I have completely avoided use of
> > GOTO in a professional context. All I have seen continues to convince
> > me that Dijkstra was right on this matter. YMMV.
>
> So you avoid last, next, etc. and returns in the middle of subs as well?
> To me those are all forms of GOTO.
>
One could put forward the argument: Those are syntactic sugar to cover
those cases where the "no goto" rule deserves to be excepted.
--
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
place them into the correct order.
------------------------------
Date: Fri, 21 Mar 2008 08:36:06 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: strategys other than subroutine and OO?
Message-Id: <fs0kl70815@news2.newsguy.com>
Joost Diepenmaat wrote:
> "szr" <szrRE@szromanMO.comVE> writes:
>> Correct me if I'm wrong, but are not last/next/redo with labels basic
>> `goto` statements that enact a last, next, or redo on the loop
>> associated with the label?
>
> Not exactly. Since you can only use them to go up the call stack
> another way to think of them is as special exceptions with built-in
> handlers.
Yeah but they seem to use the goto-label system in a way still (when
using loops with labels.. see two paragraphs down.)
> For real fun, see common lisp's condition/restart system.
Will do.
> In any case everything that alters the program flow can ultimately be
> seen as a (conditional) goto. Even such basic operators as && and if()
True. Though my point was a somewhat about the fact that they use the
same labels that goto uses for it's jump destination so next/last/redo +
label seemed like a goto with an additional instruction that acts on the
loop belonging to that label's context.
>> Does this constitute a necessary evil, or more rather, demonstrates
>> an instance where `goto` (in some form) has a place?
>
> It just demonstrates a useful pattern for program flow, which IMO is
> better handled by having explicit operators with predefined behaviour
> than by goto.
Agreed.
> The main problem with goto for me is that it's so unrestricted it
> *can*
> lead to code that's very hard to understand and bugs that are hard to
> analyze, not that it's inherently evil or anything like that.
True. I've just always seen it something that does have it's place like
anything else, and must be handled with much are when used (though I do
not really explicitly use goto in my programs, just never found the
need, to be perfecly honest :-)
> Perl has enough useful flow control operations and other features that
> it's rare to run into situations where goto() is the cleanest /
> clearest / obvious choice.
And this is probably /why/ I've never really needed to use goto in Perl
(though I also never needed to use it and c/c++ and the likes.)
--
szr
------------------------------
Date: 21 Mar 2008 16:11:37 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: strategys other than subroutine and OO?
Message-Id: <Xns9A6867B2D7272castleamber@130.133.1.4>
Lawrence Statton <yankeeinexile@gmail.com> wrote:
> John Bokma <john@castleamber.com> writes:
>> RedGrittyBrick <RedGrittyBrick@SpamWeary.foo> wrote:
>>
>> > In nearly 30 years of programming I have completely avoided use of
>> > GOTO in a professional context. All I have seen continues to
>> > convince me that Dijkstra was right on this matter. YMMV.
>>
>> So you avoid last, next, etc. and returns in the middle of subs as
>> well? To me those are all forms of GOTO.
>>
>
> One could put forward the argument: Those are syntactic sugar to cover
> those cases where the "no goto" rule deserves to be excepted.
Instead of rules I prefer to ask myself the following questions:
1) can I understand my own code next month without effort (can I after
one year)
2) can a peer do the same?
3) can someone who has some programming experience read the code without
wasting too much time.
I always get a good feeling if a customer contacts me that a
modification has been made to my code and that it was easy to do so.
Making up rules and then consider syntactic sugar exceptions sounds odd to
me.
--
John
http://johnbokma.com/
------------------------------
Date: Fri, 21 Mar 2008 16:22:35 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: strategys other than subroutine and OO?
Message-Id: <94OdnXWbHd5RfX7anZ2dnUVZ8t-nnZ2d@pipex.net>
John Bokma wrote:
> Instead of rules I prefer to ask myself the following questions:
>
> 1) can I understand my own code next month without effort (can I after
> one year)
> 2) can a peer do the same?
I have to read my own, and others, code from 15+ years ago.
I can assure you that in a loop a statement of:
goto DONE_THIS:
and a DONE_THIS label at the end of a loop is much easier to follow than a
last, break or continue.
goto's are not (and never were) harmful per se. Certain uses of them were,
just as certain uses of all sorts of programming constructs were (such as
Pascal insisting that everything be in one file).
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
Date: 21 Mar 2008 17:30:50 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: strategys other than subroutine and OO?
Message-Id: <Xns9A687520E7385castleamber@130.133.1.4>
Big and Blue <No_4@dsl.pipex.com> wrote:
> John Bokma wrote:
>
>> Instead of rules I prefer to ask myself the following questions:
>>
>> 1) can I understand my own code next month without effort (can I
>> after
>> one year)
>> 2) can a peer do the same?
>
> I have to read my own, and others, code from 15+ years ago.
>
> I can assure you that in a loop a statement of:
>
> goto DONE_THIS:
>
> and a DONE_THIS label at the end of a loop is much easier to follow
> than a last, break or continue.
I think that has also to do with what you're used to. with last, next,
etc. the direction is in the keyword. With goto, you have to pick a clear
label. I see no difference between:
last DOING_THIS;
goto DONE_THIS;
--
John
http://johnbokma.com/
------------------------------
Date: Fri, 21 Mar 2008 07:22:11 -0700 (PDT)
From: "Venkatesh can....can..." <venkatesh.sourav@gmail.com>
Subject: Table creation
Message-Id: <05206264-4d17-4c0b-abfe-d775a62edf8a@i7g2000prf.googlegroups.com>
How to create a table in perl ?
The table should just be displayed as output in the cli not in any
Database.
can anyone pls help??
------------------------------
Date: Fri, 21 Mar 2008 10:16:24 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Table creation
Message-Id: <47e3d148$0$89867$815e3792@news.qwest.net>
Venkatesh can....can... wrote:
> How to create a table in perl ?
> The table should just be displayed as output in the cli not in any
> Database.
> can anyone pls help??
First, you'll likely need some wood and nails. In addition to perl
some Assembly may be required and you'll probably need a saw and
some sand paper and some Java to keep you awake.
If that's not the kind of table you need help in displaying, then
provide a sample of the input, and how you'd like that to be displayed.
------------------------------
Date: Fri, 21 Mar 2008 16:16:20 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: Table creation
Message-Id: <87eja41517.fsf@zeekat.nl>
"Venkatesh can....can..." <venkatesh.sourav@gmail.com> writes:
> How to create a table in perl ?
Tables aren't built-in types, so you'll have to explain what you
actually want.
> The table should just be displayed as output in the cli not in any
> Database.
What about this?
print <<ENDTABLE;
+-------------------+
| This is a table |
+--------+----------+
| col1 | col 2 |
+--------+----------+
ENDTABLE
> can anyone pls help??
http://catb.org/~esr/faqs/smart-questions.html
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: Fri, 21 Mar 2008 16:30:51 GMT
From: Jrgen Exner <jurgenex@hotmail.com>
Subject: Re: Table creation
Message-Id: <iho7u31c0mace103kj9v5v06eemo652cm2@4ax.com>
"Venkatesh can....can..." <venkatesh.sourav@gmail.com> wrote:
>How to create a table in perl ?
>The table should just be displayed as output in the cli not in any
>Database.
>can anyone pls help??
perldoc -f printf
perldoc -f format (which will send you to perldoc perlform)
jue
------------------------------
Date: Fri, 21 Mar 2008 00:34:11 -0700
From: "Steve K." <savagebeaste@yahoo.com>
Subject: Re: test
Message-Id: <64h6nlF2bk01sU1@mid.individual.net>
Abigail wrote:
> _
> John (john1949@yahoo.com) wrote on VCCCXII September MCMXCIII in
> <URL:news:frmfvd$1jl$1@news.albasani.net>:
> ][ please ignore
>
>
> Will do.
>
>
> *PLONK*
>
>
> Johm1949 will now be ignored. For ever.
And we are supposed to give a two fucks about who you put in your
precious killfile, why?
------------------------------
Date: Fri, 21 Mar 2008 12:29:02 +0000
From: Rosalind Mitchell <rcmitchell@gmail.com>
Subject: Re: test
Message-Id: <e9mcb5-jrc.ln1@ID-307228.user.uni-berlin.de>
Steve K. wrote:
> Abigail wrote:
>> _
>> John (john1949@yahoo.com) wrote on VCCCXII September MCMXCIII in
>> <URL:news:frmfvd$1jl$1@news.albasani.net>:
>> ][ please ignore
>>
>>
>> Will do.
>>
>>
>> *PLONK*
>>
>>
>> Johm1949 will now be ignored. For ever.
>
> And we are supposed to give a two fucks about who you put in your
> precious killfile, why?
That's rather harsh, Steve.
Who puts whom in whose killfile is not of great interest to me (you can put
me in yours if you like, and see if I care), but what is of interest is
that there used to be a set of conventions that made usenet a useful place
to be, and that those conventions seem to have degenerated.
One of those conventions was that you made test posts to misc.test, which
exists for that purpose, so that test messages don't have to clog up my (or
anybody else's) inbox.
Rosie
--
Currently Reading: INDRIĐASON, ARNALDUR: Silence of the Grave (Grafarpögn)
Bye bye Livejournal - keep up with my wibblings at Enitharmon's Cave:
http://enitharmon.wordpress.com
------------------------------
Date: Fri, 21 Mar 2008 08:44:37 -0700
From: "Steve K." <savagebeaste@yahoo.com>
Subject: Re: test
Message-Id: <64i3f9F2b2osjU1@mid.individual.net>
Rosalind Mitchell wrote:
> Steve K. wrote:
>
>> Abigail wrote:
>>> _
>>> John (john1949@yahoo.com) wrote on VCCCXII September MCMXCIII in
>>> <URL:news:frmfvd$1jl$1@news.albasani.net>:
>>> ][ please ignore
>>>
>>>
>>> Will do.
>>>
>>>
>>> *PLONK*
>>>
>>>
>>> Johm1949 will now be ignored. For ever.
>>
>> And we are supposed to give a two fucks about who you put in your
>> precious killfile, why?
>
> That's rather harsh, Steve.
Quite possibly.
> Who puts whom in whose killfile is not of great interest to me (you
> can put me in yours if you like, and see if I care), but what is of
> interest is that there used to be a set of conventions that made
> usenet a useful place to be, and that those conventions seem to have
> degenerated.
I agree full heartedly. I hate having to go as far as I did. I seem some
of the people in this group who should be setting good examples for the
people they consider 'beneath' them yet stoop to the ego-idiocies like
this, like this charming example in this thread, sometimes it's too much
to bare. Maybe I should of just ignored it and gone to another thread,
but many times the very same can be said about the people around here
who consider themselves to be so high.
> One of those conventions was that you made test posts to misc.test,
> which exists for that purpose, so that test messages don't have to
> clog up my (or anybody else's) inbox.
It wasn't --my-- post. I did --not-- start this thread. I was just
responding to the useless egotistical reply a certain someone made that
should of known better, if they truly were more enlightened and so well
educated as they have claimed in the past. Many times, sadly, I just
don't see it.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1382
***************************************