Ashley Winters:
# > You've got a point.  There's an easy way to say "I want a sub":
# >
# > my $sub = -> { ... }
# >
# > But I can't think of a similarly punctuation-intensive way 
# to say "I 
# > want a hash."  (someone please step in and correct me).
# 
# I nominate:
# 
# $() == scalar()
# %() == hash()
# @() == array()
# 
# For the above function:
# 
# $hashref = %(function_returning_list_which_needs_to_be_hashified());
# 
# That would make %() a hash constructor, just like {}.

IIRC, $() and @() are already being used to denote scalar and array
context.  Of course, an array or hash in scalar context would probably
referencify.

I'd suggest that $(), @(), and %() all be syntactic sugar for a
context() keyword:

        $(foo)              = context SCALAR  : foo();
        @(foo)              = context ARRAY   : foo();
        %(foo)              = context HASH    : foo();
        foo();              = context VOID    : foo();
        \foo()              = context REF     : foo();
        foo()[0..5]         = context ARRAY, 6: foo();
        my MyClass $x=foo() = my MyClass $x=context MyClass : foo();

This context() keyword would be like the opposite of want().  Of course,
something like:

        context $x: foo();

Might not work.

--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

He who fights and runs away wasted valuable running time with the
fighting.

Reply via email to