> ++; # An anonymous state variable, for very fast loops Perl, never stop being you
Also: react { whenever } # Code runs when a condition is met. I can only think this must be a generic https://en.wikipedia.org/wiki/COMEFROM . It is sure going to create some viciously subtle bugs.
Larry Wall Unveils Perl 6.0.0
131–140 of 336 posts
Re: Larry Wall Unveils Perl 6.0.0
#132Earlier quoted context omitted.
Method modification is trivially done through "alias" and then just redefining the method in Ruby, if you re-open the same class. If you subclass, then "super" is sufficient. I'm curious what you actually mean here. As for writing your own constructors, you only need to do so if you actually need to initialize something, and since instance variables can be used without having initialized them in a constructor (they'l…
> Method modification is trivially done through "alias" and then just redefining the method in Ruby I don't know how to convert this into ruby then without needing to manually gensym a bunch of names: use Class::Method::Modifiers; sub foo { 2 } before foo => sub { warn "before foo 1" }; around foo => sub { my ($orig, $self) = (shift, shift); warn "around foo"; (1, $orig->$self(@_), 3); }; before foo => sub { warn "be…
The basic idea is this:
module Mst
def self.included(base)
# define a method on base using define_method named :before, which takes an
# argument and a block
# in that method, you grab the method with that name, using .method()
# you then define a new method, named method, which calls the block and
# then calls the original method
end
end
class Foo
include Mst
def test
puts "test"
end
before :test do
puts "before"
end
end
Module named after you. You can see how the logic only changes a bit for after and around. You could then wrap this up as a library, and all you'd need to do is the include.http://api.rubyonrails.org/classes/ActiveSupport/Callbacks/F... has an example, I think.
Re: Larry Wall Unveils Perl 6.0.0
#133I'm really surprised this site is the source y'all chose to upvote. Not only was the second-newest article published in 2012, they also have an assortment of other questionable content[0][1]. Advertising from rotten.com and a category named "Jonny Jihad" are also professional touches. I mean, whatever floats your boat, but HN, is this really one of your go-to trusted news sources? [0] http://www.pigdog.org/in_the_pin…
Re: Larry Wall Unveils Perl 6.0.0
#134I honestly did not expect to see the day Perl 6 gets finished. This must have been one of the most difficult - if not the most difficult - births in the history of programming languages. At work, I have been using Perl 5 increasingly often over the past two years, mainly because handling unicode in Python 2 is not a lot of fun (and I still haven't come around to learning Python 3), and I have rediscovered why I used…
Why?
Re: Larry Wall Unveils Perl 6.0.0
#135Sounds like a v2.0 with feature bloat. ""Any infix operator can be replaced by itself in square brackets..." Later someone asked, "In a world of user-defined operators everywhere, how do you define precedence?" And Larry pulled out is tighter() and is looser(), noting that Perl 6 even has customizable precedence levels. "You can add an infinite number..."" It's been said that most of programming is about managing com…
Re: Larry Wall Unveils Perl 6.0.0
#136I honestly did not expect to see the day Perl 6 gets finished. This must have been one of the most difficult - if not the most difficult - births in the history of programming languages. At work, I have been using Perl 5 increasingly often over the past two years, mainly because handling unicode in Python 2 is not a lot of fun (and I still haven't come around to learning Python 3), and I have rediscovered why I used…
"At work, I have been using Perl 5 increasingly often over the past two years, mainly because handling unicode in Python 2 is not a lot of fun (and I still haven't come around to learning Python 3)," Why?
Re: Larry Wall Unveils Perl 6.0.0
#137Earlier quoted context omitted.
Or until you trip over the API differences between str and bytes in Python 3 that do not exist in Python 2 (because str == bytes in Python 2). Chiefly, printf-style formatting... >>> b"%u" % 5 Traceback (most recent call last): File " ", line 1, in TypeError: unsupported operand type(s) for %: 'bytes' and 'int'
Fixed as of a month ago. https://www.python.org/dev/peps/pep-0461/
json.loads(foo) blahblahException foo is bytes not text.
That said I still endorse py3 for new things
Re: Larry Wall Unveils Perl 6.0.0
#138Re: Larry Wall Unveils Perl 6.0.0
#139Seems too little too late. Is Perl still relevant in 2015? What would you build in Perl today that you wouldn't build in another language instead? I used to be a big fan of Perl but it seems to have fallen behind the times, I doubt Perl 6 is enough to catch up.
There are quite a few Perl shops in LA writing new code and more than a few maintaining apps that have been around for a while. Lacking the sex appeal of Node and Go (or whatever the next hotness will be) doesn't mean something isn't relevant. Why build something in Perl? The same reasons you'd write something in Python, Ruby, C#, Java, etc: - Mature tooling - Excellent library support - Code samples written for rele…
> There are quite a few Perl shops in LA writing new code
These include Broadbean (in Irvine) and ZipRecruiter in central LA.Re: Larry Wall Unveils Perl 6.0.0
#140Earlier quoted context omitted.
> Method modification is trivially done through "alias" and then just redefining the method in Ruby I don't know how to convert this into ruby then without needing to manually gensym a bunch of names: use Class::Method::Modifiers; sub foo { 2 } before foo => sub { warn "before foo 1" }; around foo => sub { my ($orig, $self) = (shift, shift); warn "around foo"; (1, $orig->$self(@_), 3); }; before foo => sub { warn "be…
You can do this. I tried to draw up a quick gist, but I am late, and I've been writing too much Rust... The basic idea is this: module Mst def self.included(base) # define a method on base using define_method named :before, which takes an # argument and a block # in that method, you grab the method with that name, using .method() # you then define a new method, named method, which calls the block and # then calls the…
I hope, however, that you can understand from the POV of somebody who keeps being driven off ruby by ruby being too much work, that "you could make it less work by first porting all the perl5 libraries that make perl5 OO more pleasant" isn't really a convincing solution :)