3 ms·
Overriding the Backtick in Ruby
- draegtun 16y agoThis related URLs in Ruby HN post maybe of interest: http://news.ycombinator.com/item?id=994716 http://news.ycombinator.com/item?id=994716 This inspired me at the time to write PerlX::QuoteOperator (http://search.cpan.org/dist/PerlX-QuoteOperator/ http://search.cpan.org/dist/PerlX-QuoteOperator/) which allows you to create new custom quote-like operators (http://perldoc.perl.org/perlop.html#Quote-Like-Operators http://perldoc.perl.org/perlop.html#Quote-Like-Operators). So for example to create a URI quote-like operator called u: use PerlX::QuoteOperator u => { -emulate => 'q', -with => sub ($) { require URI; URI->new( $_[0] ); }, }; my $uri = u(http://google.com);
- avdi 16y agoOh, Perl. Sometimes I honestly do miss you.
- draegtun 16y agoThe overriding unary operators article referred to in post was discussed on HN. See Charging Objects in Ruby (http://news.ycombinator.com/item?id=2022107 http://news.ycombinator.com/item?id=2022107)