It's funny that you compare it to the ugly new Mustangs. You're right that it looks Perl ish, but looking at this example from this article, my first guess would probably be Ruby or maybe Java (I don't actually use either of those languages) since the only real clue to its Perlness are the variable symbols, which apparently are used opposite to the way we're used to.
class Staff::Record {
has Str $.name;
has Int $.rank;
has Hash $.pref;
method CREATE(Str $name, Int $rank, Hash $cereal_pref) {
.check_rank($rank);
($.name, $.rank, $.pref) = ($name, $rank, $cereal_pref);
}
method name() returns Str {
return $.name;
}
method rank() returns Str {
return $.rank;
}
method rank(Int $new_rank) {
.check_rank($new_rank);
$.rank = $new_rank;
}
method check_rank(Staff::Record $obj: Int $rank) is private {
die "Invalid rank for $obj.class() object: $rank"
unless 0 < $rank < 10;
}
# Other methods here
}
I haven't been programming Perl for that long, but was the change from 4 to 5 anywhere near this dramatic? I know PHP 4 to PHP 5 wasn't a huge deal, and I don't think VB 5 to VB 6 was either.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|