Live data from Hacker News

Why I’m Learning Perl 6

evanmiller.org

311–320 of 380 posts

Re: Why I’m Learning Perl 6

#311

Earlier quoted context omitted.

I think you're thinking of CommonMark. That link format isn't valid in canonical Markdown either (just to some of the common variants that also went by "Markdown"). I was always partial to the variants that could do citations well. They would automatically link-ify items postfixed by [1] etc with the link included at the citation at the bottom. I implemented a customer facig newsletter system at one job using that, w…

I thought CommonMark was the attempt to standardize Markdown. Besides that, every markdown implementation I've touched since before CommonMark supported [text](url) format.

Actually, I'm totally wrong. I thought this wasn't part of the original spec for some reason, but it's totally in Gruber's list of features and works in Markdown.pl, I just missed it when checking to confirm originally (I saw automatic links and missed the other links feature).

Thanks for causing me to look again (I used babelmark[1] to check what versions supported it and noticed all of them do, including Markdown.pl). I dislike putting out wrong information. :/

1: http://johnmacfarlane.net/babelmark2/?text=%5Btext%5D(url)

Re: Why I’m Learning Perl 6

#312

Earlier quoted context omitted.

I think you're thinking of CommonMark. That link format isn't valid in canonical Markdown either (just to some of the common variants that also went by "Markdown"). I was always partial to the variants that could do citations well. They would automatically link-ify items postfixed by [1] etc with the link included at the citation at the bottom. I implemented a customer facig newsletter system at one job using that, w…

That's the way I format my bigger HN comments. Didn't know [this](wasn't) part of the Markdown standard, though. Thanks!

Actually, see your sibling comment. I was incorrect. That is a standard Markdown feature.

Re: Why I’m Learning Perl 6

#313
post #290

Earlier quoted context omitted.

Are you saying that Perl6 grammars are a replacement (maybe eventually) for Perl5 regexps?

partly, you still build Grammars out of "token", "regex" and "rule" definitions, but some things are more natural with one or the other. So, if you are doing "test if string has whitespace" you'd use a regex, while for "parse an apache log line" you'd probably use a grammar instead of a very nasty regex. IANA perl6 dev though, just a casual observer.

> while for "parse an apache log line" you'd probably use a grammar instead of a very nasty regex.

That's actually a fairly easy endeavor with perl regex capabilities, especially named captures. Parsing HTML, or a programming language, or other much more complex structures is much easier with a grammar. For example, JSON parsing[1].

That said, there are ways to approximate some features of grammars with Perl5 regexes[2].

1: https://github.com/moritz/json/blob/master/lib/JSON/Tiny/Gra...

2: http://blogs.perl.org/users/brian_d_foy/2013/10/parsing-json...

Re: Why I’m Learning Perl 6

#314

Earlier quoted context omitted.

> 10 different ways of doing the same thing Mostly an urban myth. Where it isn't, at least 8 of those ways are actually important. Exercise: write a python program that prints Python's quoting documentation, without external files, without editing the documentation. Spoiler alert: it's impossible.

So, how exactly these different ways of getting sub arguments are useful? sub add1 { my ($arg1, $arg2) = @_; $arg1 + $arg2; } sub add2 { my $arg1 = shift; # possibly two screens of dense code here, then my $arg2 = shift; $arg1 + $arg2; } sub add3 { $_[0] + $_[1] } # There may be some other ways to extract arguments # that I am not aware of. # It's possible to combine any of the methods! And this is just argument acce…

I see no problem here.

Re: Why I’m Learning Perl 6

#315
post #123

Earlier quoted context omitted.

I don't know, but Python 3 still isn't relevant to many people. For example, I have to explicitly install 2.7 to be able to use Cocos2d-x build scripts.

Someone posted an article awhile back...people are moving over by a significant amount now.

Yeah, "not relevant to many people" is a wildly false claim. If it were anywhere near true, we wouldn't see the level of Python 3 support that we have in the major packages (95.8%).

http://py3readiness.org/

Re: Why I’m Learning Perl 6

#316

Earlier quoted context omitted.

Old is relative. There is a good core dev community and recent development is promising. It's interesting you mention Lua because that is a language I picked up when looking to move from Tcl at some point in the last 8 years. I decided rather quickly against that. The reason is the swig bindings for Tcl are sufficient to generate decent package cores for just about anything I care to extend and I can optimize later.

Old is relative, but there aren't many alternatives to Tcl that are older.

Depending on your exact use case, Forth might be one

Re: Why I’m Learning Perl 6

#317

Perl6 is indeed a very nice language that I've been watching for a few years. As soon as the performance beats Python and the stability is solid I'll probably switch over from Python...there's just a lot there.

I have seen examples where the naive Perl 6 implementation is faster than the equivalent C code. (The one I'm thinking of is probably owing to Spesh and the JIT, but I forget what it was about) Here's an example where a naive Perl 6 version is going to beat the pants off of the naive version in another language: Find the sum of all integers from 10 to 1000000 inclusive. In Perl 6: say [+] 10 .. 1000000 the [+] is a l…

That's pretty cool! I started trying to learn perl6 and write my first interesting program. I have a copy of 'ray tracing in a weekend' and am trying to translate the basic ray tracer from c++ to perl6.

It's remarkably slow right now.. It takes 1.5 minutes to generate an image. I tried to do the same thing in Julia and it takes 1.5 seconds. So I guess I must be doing something wrong!

Re: Why I’m Learning Perl 6

#318

> Concurrency is hard and if you want M:N thread multiplexing (i.e. WEB SCALE CODE, where application threads aren’t pinned to pthreads) your options today are precisely Erlang, Go, .NET, and Perl 6. Putting aside the "web scale" jokes ( http://www.mongodb-is-web-scale.com/ ), this statement is still absurd. Every major language, or at least the ones that matter for backend development, has support for thread multipl…

The intersection of "needs M:N threading" and "doesn't want to use Go"...

Re: Why I’m Learning Perl 6

#319
post #92

> Concurrency is hard and if you want M:N thread multiplexing (i.e. WEB SCALE CODE, where application threads aren’t pinned to pthreads) your options today are precisely Erlang, Go, .NET, and Perl 6. Putting aside the "web scale" jokes ( http://www.mongodb-is-web-scale.com/ ), this statement is still absurd. Every major language, or at least the ones that matter for backend development, has support for thread multipl…

Unfortunately, unless the IO in the stdlib uses or is modified to schedule these fibers around evented IO, they're essentially useless as soon as you use an external library. Go and Erlang do this, Crystal does this but with only N:1 multiplexing (but that will change before 1.0), but I don't know about other languages.

.NET has both nonblocking evented IO and standard blocking IO in the stdlib. Most modern libraries use asynchronous IO, however lots of legacy applications still use blocking calls, making them unsuitable to run in the thread pool.

Re: Why I’m Learning Perl 6

#320

Earlier quoted context omitted.

It's _different_. But working for a few years with Perl 5, it really grew on me. It could use a good "Perl: The Good Parts" book, I guess. I haven't looked at Perl 6 yet, don't know if that's better or worse. Too many other things to do, and I don't think I'll ever work with Perl professionally again, that ship has probably sailed.

The Perl 5 equivalent is Damian Conway's Perl Best Practices

PBP is very good, but pretty desperately needs an update. There might end up being a new version for Perl 6, but I doubt it will ever get one for Perl 5 and that's unfortunate.

Several pretty big recommendations (particularly regarding OOP in Perl) from PBP aren't really regarded as having stood the test of time very well.

Post reply on HN