Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Indispensible language features

by theorbtwo (Prior)
on Jun 30, 2004 at 23:08 UTC ( [id://370936]=note: print w/replies, xml ) Need Help??


in reply to Indispensible language features

I find it amazing that you find five characters (the space is optional) for lambdas too long -- heck, the proper name of the feature is longer then that. OTOH, while I find them useful from time to time, they aren't a basic feature of my code often.

OTOH, I would include the ability to do predictable memory layouts and pointer arithmetic as at least something that is very nice to have. OTOH, perl has these, via pack.

I wouldn't inlcude higher-order functions on my list because they are a neccessary side-effect of coderefs as far as I can tell.

On the other hand, I would include a CPAN, or something close to it... but I would also note that I consider apt-get, and even similar (but worse) repositories of other distributions, close enough to CPAN to count, at least for C and C++. Freshmeat and even sourceforge are also vaugely close.

Easy foreaches are also important, even across somewhat abstract list-like things, which leaves out C, C++, and Java, so far as I know.

Really, though, the number one requirement for a language (beyond obvious stuff like turing-completeness) is hashes.

Replies are listed 'Best First'.
Re^2: Indispensible language features
by hardburn (Abbot) on Jul 01, 2004 at 12:45 UTC

    Easy foreaches are also important . . . which leaves out C, C++, and Java

    Java now has a foreach-like construct.

    beyond obvious stuff like turing-completeness

    I dunno. I think you could get some pretty nifty stuff in a language which isn't TC. Maybe it wouldn't work for general programming, but it may solve a specific problem domain very well.

    Which is why I'm more interested in Parrot than Perl6, but that's another issue.

    ----
    send money to your kernel via the boot loader.. This and more wisdom available from Markov Hardburn.

      The C++ STL also has std::for_each(), so I guess that just leaves C.
Re^2: Indispensible language features
by FoxtrotUniform (Prior) on Jul 07, 2004 at 23:57 UTC
    I find it amazing that you find five characters (the space is optional) for lambdas too long -- heck, the proper name of the feature is longer then that.

    I've given this a bit of thought: it's not so much the sub {...} part that I find verbose as the fact that I can't bind variables in a convenient way: I either have to use up keystrokes with a my ($x,$y,$z) = @_; at the front of the lambda, or constantly index @_ (which looks awful).

    For instance, in Haskell the "zip" function (take a pair of lists and return a list of pairs) is defined as:

    zip = zipWith (\x y -> (x,y))
    (What's important here is the lambda.) In Perl, assuming an equivalent zipWith, you'd have to say:
    zipWith {[$_[0], $_[1]]} @foo, @bar; # or: zipWith {($a,$b)=@_;[$a,$b]} @foo, @bar; # or: zipWith {[unshift,unshift]} @foo, @bar;
    none of which looks as pretty. That's more a matter of opinion, of course.

    --
    F o x t r o t U n i f o r m
    Found a typo in this node? /msg me
    % man 3 strfry

      I agree, none of those are pretty. In Perl 6 you can also use either of:
      zipWith {[$^a, $^b]} @foo, @bar;
      or
      zipWith -> $a, $b {[$a,$b]} @foo, @bar;
      But then, your entire OP reads a bit like an ad for Perl 6... :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-25 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found