Perl 6 - the future is here, just unevenly distributed

IRC log for #moarvm, 2015-06-17

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:57 FROGGS[mobile] joined #moarvm
01:07 lizmat joined #moarvm
01:13 FROGGS[mobile] joined #moarvm
01:48 ilbot3 joined #moarvm
01:48 Topic for #moarvm is now https://github.com/moarvm/moarvm | IRC logs at  http://irclog.perlgeek.de/moarvm/today
05:33 FROGGS[mobile] \o/
06:55 FROGGS joined #moarvm
07:14 psch here, too: https://gist.github.com/peschwa/f399cf10914f1d287a74
07:15 psch where am i going wrong?  the moar attempt there complains with "At Frame 1, Instruction 5, op 'wval', operand 0, MAST::Local of wrong type (4) specified; expected 8"
07:15 psch i'm not sure how else i would get the lexical lookup for Failure there
07:16 psch i recognize that maybe having a lexical lookup for Failure in every p6typecheckrv is probably somewhat slow, but i don't have an idea for either backend to hang some kind of less-expensive reference or something
07:34 zakharyas joined #moarvm
07:40 Ven joined #moarvm
07:56 JimmyZ psch: $*REGALLOC.release_register($isfailure, $MVM_reg_obj);
07:57 JimmyZ psch: should be $MVM_reg_int64, hope this will fix the problem.
09:35 psch JimmyZ: thanks, that lets me compile again at least, even if the patch doesn't have the desired effect
09:52 TEttinger joined #moarvm
09:54 TEttinger hello! one of my friends is currently designing a smalltalk-esque minimal language, and I'm wondering if he would benefit from targeting MoarVM instead of rolling his own to-C translator or generating X86, etc.
09:56 JimmyZ TEttinger: I think only if he uses nqp
09:56 TEttinger I had a bit of a hard time figuring out what MoarVM... is... to be honest.  the features page lists many language features that I'd think would be part of a high-level language like Perl, but above that it says MoarVM provides only representations
09:57 JimmyZ TEttinger: Moarvm provides only represetiations
09:57 JimmyZ the higher one is NQP
09:58 JimmyZ which is good for writting a compilier
09:58 TEttinger so when it says under Language Feature Support, Continuations (single shot; partial multi-shot support)
09:58 TEttinger that's a representation that it knows how to support, if you write it in NQP?
09:59 JimmyZ yeah
10:00 TEttinger ok, makes sense
10:00 JimmyZ NQP is a compiler tool
10:01 JimmyZ TEttinger: https://github.com/edumentab/rakudo-and-nqp-internals-course
10:01 JimmyZ which is good for better understanding
10:02 JimmyZ TEttinger: https://github.com/edumentab/rakudo-and-nqp-internals-course/tree/gh-pages for pdf
10:02 TEttinger I'm currently writing my own language in Lua, which has been sorta odd.  most things have been surprisingly easy, as I suspect it would be if I was using NQP instead of Lua, but Lua doesn't actually have true regexes, which is weird.
10:02 TEttinger the parser uses a parser expression grammar lib, and it is just nasty
10:03 JimmyZ TEttinger: there is a course about writting a  php compiler or ruby compiler by nqp
10:04 TEttinger the only real reasons I have for not using MoarVM right now are simple: I didn't know about it until recently, I don't know how well it performs relative to LuaJIT (this matters the least right now), and I don't know if MoarVM provides any way to interop with C or another host language like LuaJIT's FFI does
10:05 TEttinger other than that, it looks like a great way to write a language
10:05 JimmyZ TEttinger: Moarvm providers nativecall by dyncall
10:05 TEttinger that sounds good
10:05 TEttinger I don't know a thing about it though :)
10:07 JimmyZ TEttinger: http://moarvm.org/features.html says Native calling, passing pointers, arrays, structs, and callbacks
10:07 TEttinger is NQP a much smaller language, in regards to how much you need to learn to get up and running, than Perl 6?
10:07 TEttinger I know Perl 6 has uh, "pretty much every feature the other guys have, and then some"
10:07 JimmyZ TEttinger: yeah.
10:08 JimmyZ NQP  means Not Quite Perl 6
10:08 psch the edumentab slides are very good, imo
10:08 TEttinger cool
10:08 psch and nqp/examples has the rubyish implementation, iirc
10:08 psch although i'm not sure that's still up-to-date
10:09 JimmyZ and there is a python implementation too ,which is up-to-date
10:09 JimmyZ :P
10:09 psch oh, right!
10:09 psch https://github.com/arnsholt/snake arnsholt++
10:25 TEttinger wow, this looks excellent
10:26 TEttinger the language I'm making is "basically Clojure, minus some of the immutable data", so having Perl (and NQP) be conscious of the differences between compile and runtime is very important and useful
10:27 TEttinger since true lisp-style macros have been the most challenging part of the dev so far
10:31 JimmyZ yeah, I saw the Clojure marco implementation is very tricky :P
10:32 psch TEttinger: https://github.com/masak/007/ has musings about Perl 6 macros, maybe that's of use to you too
10:33 TEttinger JimmyZ, part of it turned out much simpler by virtue of lua's extremely simple module system
10:34 TEttinger lua doesn't have namespaces for symbols, when you require another module you typically assign it to a table, and a module is really just a table of name keys and values that correspond to what you defined for those names
10:35 TEttinger like math is just {sin=<native code implementation of sin>,pi=3.141592653...}
10:36 TEttinger so syntax quote in clojure typically has to namespace each symbol as a result of being on the JVM with its packages
10:36 TEttinger I don't!
10:52 JimmyZ MoarVM knows nothing about namespace.
10:52 JimmyZ :P
10:57 TEttinger interesting stuff, psch, read a bit of that
11:36 TEttinger so is there a difference between a QAST and a MAST?
11:37 TEttinger the MoarVM site mentioned an MAST as the starting point, the internals course calls it a QAST
11:43 psch QAST gets compiled to MAST, as i understand it
11:43 psch as in, NQP compiles to QAST and the moar backend compiles it to MAST, which moar compiles to bytecode
11:44 TEttinger ah, ok
11:45 TEttinger thanks for the help, it's nice having a friendly channel!
11:49 TEttinger hm, producing an AST is ideal for my language since currently that's the only representation of the code that Lua sees at runtime, a big ugly tree as a nested series of tables. there isn't always a distinction between tables produced by functions and tables that mean nodes in the AST, and Moar seems like a great target if only because the code would be more clear
11:52 psch well, in the end you'd probably rather target NQP
11:53 psch which means you could write a lua backend and we get that for free for Perl 6 :)
11:53 psch that's not a recommendation to implement a lua backend for NQP, i have no idea what kind of efforts would be behind that
11:53 psch more tongue-in-cheek
11:54 TEttinger err, yeah I would be producing a QAST huh
11:54 TEttinger hm, then it could run on the JVM too
11:54 psch yup
11:54 * TEttinger Mr. Burns hands
11:55 TEttinger excellent.
11:55 psch there's also a javascript backend in the works somewhere...
12:19 Ven joined #moarvm
12:24 arnsholt Has anyone tried checking MoarVM with the clang static analyzer?
12:57 TEttinger heh, wow, someone beat me to the punch! now I just need to learn perl AND japanese! https://github.com/tokuhirom/Perl6-Renshu/tree/master/nqp-lisp
13:13 tadzik haha
13:14 tadzik oh, that's plenv author :)
13:14 tadzik #122: (print "hoge")
13:15 tadzik I now imagine that Japanese have a meme with a hog that does "wow, much this, many that"
13:15 tadzik I don't know what hoge actually means, I could've just said something very insensitive
13:45 nebuchadnezzar TEttinger: even the comments in the code are in japanese ;-)
13:45 TEttinger yep!
13:45 nebuchadnezzar That was maybe a bad think to support unicode in source ;-)
13:46 nebuchadnezzar s/think/thing/
13:49 TimToady my japanese dictionary has no "hoge" in it
13:49 TimToady hogei means "whaling", if you stretch the /e/ into /ei/
14:03 Ven joined #moarvm
14:33 masak tadzik: I implore you to create a hoge image.
14:38 TEttinger hoge base? http://www.factzoo.com/sites/all/img/mammals/pigs/happy-pig-face.jpg
14:38 tadzik beautiful :)
14:40 tadzik http://imgur.com/kTiVZES hoge
14:44 nebuchadnezzar 豚 ね
14:44 TEttinger fantastic.
15:09 JimmyZ_ joined #moarvm
15:45 nebuchadnezzar MoarVM is monthly released around 20th or 21th, right?
15:47 hoelzro nebuchadnezzar: I'll be cutting a release later tonight
15:47 hoelzro unless someone wants to do it for me ;)
15:49 nebuchadnezzar ok thanks, I think we'll skip upload of Debian package for 2015.05 and work on 2015.06
15:49 japhb nebuchadnezzar: For historical reasons, Rakudo is usually released the Thursday after the third Tuesday of the month, and MoarVM is released somewhat before that.
15:54 TEttinger wow, this is kinda overwhelming all of a sudden. it looks like writing this Lisp in NQP is the best option I have now, except for one small detail... I don't know any Perl yet. How should I get started with hacking on NQP stuff? download Perl 6, swap stuff out over time?
15:58 japhb TEttinger: Have you gone through the courseware for that edumentab course?
15:58 psch TEttinger: the edumentab slides are probably your best from-the-ground-up intro
16:00 TEttinger the two things I didn't get from that were a) what software am I actually using here, there are multiple backends but I don't know what I should actually be compiling here, and b) absolute perl basics, but I think I have inferred most of that as I went through
16:01 TEttinger like, @* is the sigil for a dynamically bound list, right?
16:01 TEttinger is it different from *@ ?
16:01 PerlJam TEttinger: yes.
16:01 psch $ perl Configure --backends=moar --gen-moar --prefix=$PREFIX --make-install # builds and installs you nqp-m
16:02 PerlJam TEttinger: maybe the synopses can help with some of that?
16:02 psch from the nqp root
16:02 TEttinger aaaaalso I'm on windows
16:02 PerlJam TEttinger: design.perl6.org (for the synopses)
16:02 TEttinger thanks
16:03 psch doc.perl6.org (the "Language" tab, mostly) is probably a good idea to keep handy as well
16:03 psch the .msi for windows is 2015.03 iirc? so the nqp in there is like 3 months
16:04 psch oh, but jnthn++ runs windows too i think, so maybe he can give pointers how to build NQP there
16:06 TEttinger jnthn, the animal facts author in the course? :)
16:08 PerlJam That's the one
16:08 PerlJam Also one of the primary developers for Rakudo
16:14 Ven joined #moarvm
16:16 nebuchadnezzar japhb: ok, so packaging next MoarVM release will permit to work on nqp and rakudo
16:26 TEttinger so... rakudo is a frontend that handles the full Perl 6 language and outputs a QAST that any MoarVM, the JVM backend, and ParrotVM can all use?
16:26 TEttinger am I understanding this right?
16:27 psch the QAST is for NQP
16:27 psch and gets translated into MAST, JAST (and PAST in the past) for the backends
16:27 psch at least that's how i understand it, as at least MAST nodes can be written manually as well
16:29 TEttinger so then what is rakudo? a standard for perl 6, an implementation of perl 6 that produces ???, a packaged/versioned set of tools from multiple Perl 6 projects?
16:30 PerlJam TEttinger: Rakudo is a Perl 6 implementation.
16:30 psch Rakudo is a Perl 6 implementation in Perl 6 and NQP
16:32 TEttinger does Rakudo have multiple backends, of which Moar is one of them?
16:32 TEttinger or is that NQP that has backends
16:32 japhb I believe jnthn++ has another set of slides that explain the stack that is Rakudo
16:33 japhb TEttinger: Have you seen his talks page?
16:33 TEttinger nope
16:33 japhb TEttinger: http://jnthn.net/articles.shtml
16:33 psch there's an svg... https://github.com/rakudo/rakudo/blob/nom/docs/architecture.svg
16:33 TEttinger I really just started looking at perl-related stuff in the last 12 hours
16:34 TEttinger I know that perl 6 has had some cutting edge features for a while, I didn't realize how pretty-much-production-ready almost everything is
16:34 TEttinger looking at the future plans for Moar, it all seems like optimizations, not filling in gaps
16:35 psch yeah, the gaps are mostly in rakudo at this point i think
16:35 JimmyZ_ it is easy to run nqp on windows, just download 'strawberry perl ' and git
16:35 japhb TEttinger: Here's a useful one of jnthn's talks from before he revealed MoarVM, when the backends were just Parrot and JVM: http://jnthn.net/papers/2013-yapceu-jvm.pdf
16:36 japhb But it gives a decent idea of the layered architecture, IIRC
16:43 japhb_ joined #moarvm
16:44 vendethiel- joined #moarvm
16:52 TEttinger so... can you build NQP with rakudo star (binary distribution from http://rakudo.org/downloads/star/ ) ? does NQP need perl 5 specifically to build, or is 6 backwards compatible enough?
16:53 psch if you have R* you have NQP
16:55 psch to build you'd need perl 5 and git as JimmyZ_++ said, not enough dogfooding yet to have a Configure.pl6 — if that's even desirable, i don't know
16:55 JimmyZ_ install the msi , and you will have NQP
16:55 TEttinger ok
16:56 TEttinger so I can use the NQP in R* to build, say the Snake that was linked earlier?
16:56 japhb_ TEttinger: The assumption is that perl5 is available "everywhere", and less painful to write configure scripts in than, say, bash.
16:56 TEttinger https://github.com/arnsholt/snake this one
16:56 JimmyZ_ yeah
16:56 TEttinger muy excellente
16:58 jnthn evening, folks o/
16:59 psch o/ jnthn
17:00 jnthn Summary of NQP: a self-hosting compiler for a subset of the Perl 6 language, along with various libraries for building compilers (including targeting different VMs).
17:00 psch jnthn: not quite getting the Failure thing from yesterday ported to moar... http://irclog.perlgeek.de/moarvm/2015-06-17#i_10760551
17:01 psch jnthn: JimmyZ_++'s suggestion fixed the error, but semantics still don't work out
17:01 psch i'm wondering if there's somewhere else that lets the error through or if i just don't grok moar :s
17:01 jnthn Where's your current patch?
17:01 psch (where "error" means "create the TypeCheck::Return and throws it"...)
17:02 psch hold on, let me update
17:02 psch updated the gist, that's the last thing i tried
17:03 psch jvm bit is obviously the same
17:03 psch calling "not_i" didn'T work out at all, but that was a "maybe i have the truthiness the wrong way around" guess
17:03 jnthn gosh that's a weird way to do it...
17:03 psch well i have no idea what i'm doing :P
17:03 psch on jvm it seems simple and logical
17:04 psch i can just call getlexcaller and everything works
17:04 psch but trying that on moar gave me a "QAST::Op in WVal but not in SC" iirc
17:04 psch not sure about the WVal there
17:04 jnthn Why get getlexcaller?
17:04 jnthn A straight getlex (by name) would do it
17:04 psch i have no idea how else to find Failure
17:04 psch oh
17:06 jnthn For Moar I'd emit a const_s "Failure" and then a getlexstatic_o so spesh knows it can cache/optimize the lookup
17:06 jnthn (and then istype)
17:06 psch ah
17:06 psch yeah that sounds like something i hoped would be possible there
17:07 psch i was aware that a lexical lookup for Failure for every return type constrained sub could be somewhat costly
17:07 jnthn Yeah, I'm not too thrilled with it
17:07 jnthn But at least this way hot-path code has a good chance of it being optimized out
17:11 psch thanks, i'll try and get that in
17:20 brrt joined #moarvm
17:39 zakharyas joined #moarvm
18:12 TEttinger so... MoarVM has been gaining pretty steadily in its performance, right? how does it compare to the JVM rakudo?
18:12 TEttinger it already smokes past Parrot, right?
18:13 jnthn Tends to beat Parrot from "a bit" to "a load" depending on benchmark.
18:14 TEttinger the primary thing I care about is startup time when I am doing certain kinds of programming, and I typically use clojure for those things right now.  despite clojure on JVM having atrocious startup time
18:15 TEttinger I understand that scripty stuff is, how do you say... something Perl is really good at? :D
18:17 TEttinger but the more I read about NQP the better and better it seems
18:17 TEttinger you wonder why a high level language meant for compiler construction hasn't been made before...
18:18 jnthn We've been working hard on getting startup time down.
18:18 TEttinger I guess in part because there haven't been many language projects as ambitious as perl 6
18:18 jnthn (With decent success)
18:19 TEttinger jnthn, I saw the perl guts thing about taking ordering info out of hashes to save on memory
18:19 TEttinger that's an interesting opt
18:19 jnthn Yeah, was worthwhile. Didn't win much on speed though.
18:19 jnthn But nice for memory
18:20 jnthn Lazily deserializing meta-objects has been one of our bigger "clever" startup speed wins.
18:20 TEttinger is there any way to get the ordering info anyway?
18:21 TEttinger one of the things that is really irritating on occasion in clojure is that maps (hash equivalent) and sets are not sorted in any way
18:21 jnthn You'd need to keep it out of band at the moment
18:21 TEttinger that's fine, yeah
18:21 jnthn You couldn't rely on it before anyways.
18:21 TEttinger ah ok
18:21 jnthn Since on the JVM we didn't keep order
18:21 TEttinger right, JVM used a different hash
18:22 jnthn We could potentially provide some "ordered hash" representation.
18:22 TEttinger nah, I wouldn't worry about it, it makes sense as a userspace thing
18:22 TEttinger it's kinda funny though how calling keys on a map in clojure doesn't return a set
18:23 TEttinger because sets don't have order, if you tried to match up a key set to a val set you would always be mismatched
18:23 TEttinger *val seq
18:24 FROGGS joined #moarvm
18:25 TEttinger the stuff I want to explore in the Lisp I'm working on was initially just "make clojure, without the immutable stuff because it's really hard, then try to implement domains", where domains are first-class keysets or indexing methods to access values in a collection
18:26 TEttinger and I'm kinda in a flurry of ideas now, because perl 6 adds a lot of options to what that could mean
18:26 TEttinger junctions as indices, for instance
18:33 jnthn I thought the value/identity separation in clojure was the main interesting thing about clojure. ;)
18:33 jnthn But I've only read about it's approach, not written it, so I'm probably misinformed :)
18:33 FROGGS o/
18:42 TEttinger jnthn, it's an interesting Lisp.  definitely trying hard to be practical, lots of stuff meant for interop with Java initially, now for JS too.
18:42 TEttinger the biggest strength of clojure in practice is probably the "seq abstraction", where any of the clojure collections, and most java collections (pretty much all, anything with an iterator) can be converted to a seq, and all functions that expect a general collection expect a seq instead of special-casing every single collection they can take
18:43 TEttinger you can do line-seq on a large string, turning it into a seq of the lines in the string
18:44 TEttinger clojure handles nested heterogeneous data extremely well, and is fairly terse, though not as much as perl
18:44 TEttinger some common lispers joke that clojure is "lisp meant for one-liners"
18:45 TEttinger it certainly compresses well. http://ideone.com/L0eHc6 is the expanded, slightly improved version of, well...
18:46 TEttinger ,(let[a #(apply str(flatten %))r repeatedly p partition N rand-nth n #(a(N(concat(repeat %"")(mapcat p[1 2 3]%&))))v #(n 0"aioeu""iaai")w(fn[](let[b(n 6"!.""""...")s[(n 0"STKNYPKLG""GlThShNyFt""ZvrCth")(r(N[1 2])#(do[(v)(n 9(map str"'-"(r 2 v)))(n 0(concat"lpstnkgx"[(N["h""gl""gr""nd"])(v)])"rlthggghtsltrkkhshng")]))]][b(if(seq b)[" "s][(n 3",")" "(.(a s)toLowerCase)])]))](re-find #"[A-Z].+"(a[(r 500 w)"."])))
18:46 TEttinger meant to fit in IRC message limits
18:46 FROGGS and they say Perl is line noise :D
18:47 TEttinger haha
18:47 TEttinger yeah, the cleaned up version is a lot more than one line
18:47 FROGGS sure
18:47 TEttinger there's some cool features at play there
18:47 FROGGS I do not expend that this would be the common way to write it
18:47 TEttinger not at all common
18:48 TEttinger like this snippet, (concat"lpstnkgx"[(N["h""gl""gr""nd"])(v)])
18:49 TEttinger first, strings can be next to each other, they don't need whitespace or commas, that explains part, but the cool thing is that concat takes a sequence, not a string
18:50 TEttinger it converts "lpstnkgx" to a seq of chars, then concatenates onto the end of that seq a random string drawn from "h", "gl", "gr", "nd" with a random vowel after it (v is defined earlier, N is just random element from collection, aliased earlier)
18:51 TEttinger this is, in the clearer version, more explicit.  it actually names a list of valid consonants, etc
18:51 TEttinger but that takes too many chars to be in one IRC message!
18:52 FROGGS hehe, nice
18:52 TEttinger I don't really have an aversion to symbols anymore, I think I did at first in clojure, but then I really started realizing how much shorter some code can be
18:54 TEttinger anyway, I'm looking forward to doing a blitzkrieg learning of perl and NQP
18:58 FROGGS feel free to ask here or in #perl6
20:05 oetiker joined #moarvm
20:34 colomon joined #moarvm
21:51 colomon joined #moarvm

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary