Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: its simpler

by erroneousBollock (Curate)
on Nov 24, 2007 at 09:28 UTC ( #652713=note: print w/ replies, xml ) Need Help??


in reply to Re: its simpler
in thread its simpler

It'd help me (and likely others) evaluate your points in the context you intend if you could follow the Writeup Formatting Tips, especially w.r.t the use of <code></code> tags. :-) There's a quite reasonable subset of HTML there to illustrate your assertions/opinions/examples.

I'll try to parse what you've posted:

Basically, about C as Perl you _all_ have it wrong.
I don't see how you can plausibly make that assertion given the vagueness of your original post. A few monks parsed roughly the same ideas from your posting, and responded to them in a reasonable fashion.

However, if we've misunderstood what you tried to say, it's likely because you were too broad, not clear, and overly rhetorical.

I use (pointers) a lot in my Perl (by reference) unless you went to school when they misinterpreted value/reference. For another time.
Anyone who seriously uses Perl deals with references routinely. I'm pretty sure we all understand the analogue w.r.t C pointers. Perl's references, however, are typed in a manner such that errors are actually evident (irrespective of manipulation).

My original thought about 'until' as being somewhat like a properly wrapped C macro which would say do{...}while(0) is that C doesn't have 'until' and I've seen where it can and should be used. until else is a non-sequitor for the most part.
I believe the exact opinion you stated was "haha - they remind me of macros ...". Your detailed explanation notwithstanding, the statement still makes no sense. You've examined the statement-modifier form of until, noticed a slight similarity with respect to the do-while construct in C and extrapolated a relationship that's incomplete and mostly irrelevant.

until else is a non-sequitor for the most part.
In what sense? A 'non-sequitor' is a classification of logical error which deals with one point of argument/proof not following logically from its predecessor. I still don't understand what you want to say there. Were you after 'double negative'?

Other C things are;

sub func { my($hr_h, $ar_l, $this) = @_; # instead of all the shift, shift, shift # seems quite clear my @these; # I'll try to wantarray too. foreach my $i (keys(%$hr_h)) { if($i == $$ar_l[$i] && $hr_h->{$i} == $this) { .... push(@these, $ar_l->[$i]); } } wantarray? @these: \@these; } # not the best of examples but shows 2 ways to talk with # an array pointer and uses (for good) of wantarray as the # return value.
Perl subroutines take a flat list as argument. That's all. Entirely unlike C. Stating that a lexical declaration coupled with destructuring assignment "seems quite clear" doesn't advance your argument at all.

Since Perl's subroutine arguments come packaged in an array, programmers have the freedom to use all available built-in (or other) functions and other constructs which deal with arrays/lists. Some folks like to avoid copying. Others like destructuring assignment. Others still enjoy treating the arguments as a list. Lots of choice: no "best practices" positive correlation to C can be established without discarding lots of elegant code.

I've no idea what you intend to say about wantarray.

Your insistence on using unnecessary parentheses in order to make the code more C-like just results in Perl code that's cluttered and less idiomatic.

I can't figure out where you've advanced an argument that by writing in this style that (allegedly) mirrors C any advantage is incurred w.r.t either of

  • performance
  • readability

The fact that its a textarea is bad enough, but come on folks, if code is involved, let's get a bit more indentation-centric. That's not a word, I'm sure. I wouldn't write any real code without tabs and some smarts. Can I help you 'monks'? Indenting is _not_ 'press the space bar'. Nonsense.
Oh, the irony.

If you have more questions, especially you 'chromatic', send them on over to here http://www.theworld.com/~morourke/
You're unlikely to get many takers (AFAICT, you've only provided an email address). The discussion here is quite robust, if somewhat biased at times. Your website shows no danger of promoting any such quality.

-David


Comment on Re^2: its simpler
Select or Download Code
Re^3: its simpler
by MichaelORourke (Initiate) on Jan 30, 2008 at 18:45 UTC
    No one would ever see any of my code having this kind of indent, so I can't see what you're talking about if you can't at least stay on topic. Open '{' on the end, close '}' on the beginning. Unless and wantarray when done well are good. Moose at CPAN looks promising and shows how to be more fun than one should have. The difference between hash enumerated, set to true, reverse hash (careful keys), etc. is to be considered, I think. Names are variables and variables names. if($i == $$ar_l$i && $hr_h->{$i} == $this) # not my indent type :-) { .... push(@these, $ar_l->$i); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://652713]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-12-20 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls