HackerTrans
トップ新着トレンドコメント過去質問紹介求人

draegtun

no profile record

コメント

draegtun
·25 日前·議論
The article doesn't mention Perl at all but it did have some direct influences on Ruby.

Even Ruby's trailing blocks syntax are an homage to Perl's block list subroutines:

  # first Ruby example in article
  users.select { |u| u.admin? }.map(&:email)

  # using Perl's block list
  map {$_->email} grep {$_->is_admin} @users;
draegtun
·7 か月前·議論
Yes (de)referencing can be a PITA sometimes but you've probably forgotten that your example code could have been better written like this:

    $hash1->{key1}{key2}
And if `hash1` was a hash (instead of a hashref) then it's just this:

    $hash1{key1}{key2}
The `%{}` de-reference you mention later is only when you have an operation that requires a hash, for eg:

    keys %{$hash1{key1}}
And for kstrauser example later in Python...

    hash1["hash_name"]["array_name"][3]
the equivalent in Perl would be...

    $hash1{hash_name}{array_name}[3]
I find having {} & [] as lookup keys for their types is not only more explicit but also safer/correct.
draegtun
·14 年前·議論
Another interesting comparison would be with the Text::Markdown CPAN module which is Gruber's original code & comments converted to an OO interface with POD documentation added + bug fixes.

This comes (including blank lines, comments & POD) to 1739 loc - https://metacpan.org/source/BOBTFISH/Text-Markdown-1.000031/...
draegtun
·14 年前·議論
>I would love pointers to Markdown processors that are implemented in a more principled way than the original code, for example using standard-looking lexing and parsing passes...

Have a look at Markdent - An event-based Markdown parser toolkit.

https://metacpan.org/module/Markdent
draegtun
·14 年前·議論
Also worth looking at the tests for Text::Markdown which is the canonical version of Markdown on CPAN.

https://metacpan.org/source/BOBTFISH/Text-Markdown-1.000031/...