in reply to Re^3: Half-serious quest for prefix anonymous refs taking
in thread Half-serious quest for prefix anonymous refs taking
After rereading your post, I realize all you asking for was a indirect-object syntax for list constructors equivalent to the indirect-object syntax for list operators such as print and join.
I personally believe that either you should reread my posts again or that I have terribly serious expressive problems for all that I "want" (please, notice the quotes) is a prefix operator that creates an anonymour arrayref or hashref out of a list, alternative to the currently existing circumfix ones: [] and {}. For completeness and consistency, I'm also asking the same thing wrt subrefs and scalar refs. Thus, instead of:
my $aref = [1..42]; my $href = { foo => 1, bar => 2 }; my $cref = do { my @x=1..42; sub () { @x } }; my $sref = do { my $x=42; \$x };
I would like, say:
my $aref = \@ <== 1..42; my $href = \% <== foo => 1, bar => 2; my $cref = \& <== 1..42; my $sref = \$ <== 42;
Except that this would clash with current Perl syntax, since perl would try to parse e.g. the construct in the first line like a reference to the @< variable, and similarly for the others.
Thus I'm asking about your own ideas for a good syntax: [] and {} only take two charachters, and I would like something just as lightweight; in addition the operators should intuitively and immediately suggest the kind of reference that they create, hence my idea of somehow using sigils. I'm not asking this out of a practical need, but just for fun and brainstorming. (But if a very good suggestion pops out, maybe...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Half-serious quest for prefix anonymous refs taking
by starbolin (Hermit) on May 31, 2008 at 16:53 UTC | |
by blazar (Canon) on May 31, 2008 at 19:15 UTC |