Thanks for reply Starver! And don't forget that I use C#, so no &/* magic for me, just straight references!
[edit: Whoops, first meant to say "Well, I hope you understood it, at least..." (with the emphasis on
me having written something that was generally understandable!), before going on to waffle with the following diversion...]
I need to get into C#. I know most other variations on C (from K&R onwards) but, as you can see, I'm currently on a bit of a Perl-binge for prototyping[1], and tend to use a form of it even in what should be Pseudocode, and I really need to force myself back to the bleeding-edge again, and last time I touched it I got distracted by some other shiny-shiny language or other...
And while I can't believe that you
can't do something very similar in C#, I'm pretty sure that it's not best practice to overly rely on it. (Probably akin to littering the code with GOTOs...
) And the type-freedom of Perl
does tend to spoil me...
my $variable;
$variable = "Hello World"; print "$variable\n";
$variable = [split(//,$variable)]; print join(",",@$variable)."\n";
my $temp=$variable; $variable =+{}; map {$$variable{$_}++} @$temp;
print join("\t",map {"$_: ".$$variable{$_} } sort {$$variable{$b} <=> $$variable{$a}} keys %$variable);
#And that's not even using coderefs and globrefs!
Hello World
H,e,l,l,o, ,W,o,r,l,d
l: 3 o: 2 e: 1 H: 1 r: 1 W: 1 : 1 d: 1
(But as for readability... I can do much better than that...
)
[1] In the more mundane "build it quickly, to test", sense, rather than the usual procedural-definition sense!