Okay, so I've been thinking about currying and all that funky stuff
and then a discussion cropped up on perl6-internals about JIT stuff.
And I found myself thinking about:

    &assert_with_func := { &^sub($^expected, $^got, @_) }

And it occured to me that it might actually be nice, if we're
expecting some curried args to be essentially constant once bound so
that there's a possibility that the JVM/optimizer/whatever could do
some more optimizing. And I keep coming back to the ruby/smalltalk
block approach

    &assert_with_func := {
        | &^sub is constant, $^expected is constant, $^got, $message |
        &^sub($^expected, $^got, $message);
    };

The idea being that if the curried block has an explicit parameter
declaration section we can declare properties there which may help
optimize things later. And much as I like the proposed currying syntax
for quick stuff, having a more formal approach available will help me
write code that expresses its intent more clearly. 

Note that the suggested syntax is merely a 'port' from Ruby. I've not
really considered whether this syntax would fit well with perl. The
first | is reasonably obvious, but I'm not sure we can reliably spot
the closing one.

-- 
Piers

   "It is a truth universally acknowledged that a language in
    possession of a rich syntax must be in need of a rewrite."
         -- Jane Austen?

Reply via email to