Camelia, the Perl 6 bug

IRC log for #moe, 2013-02-04

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

All times shown according to UTC.

Time Nick Message
00:22 moe [moe] jasonmay pushed 1 new commit to ast-json-serializer: http://git.io/4QXO6A
00:22 moe moe/ast-json-serializer 74048fa Jason May: Pass dumpAST into the REPL
01:54 moe [moe] jasonmay force-pushed jasonmay/interpreter-hashes-arrays from 9c07b00 to 74048fa: http://git.io/RY36pw
01:54 moe [moe] jasonmay pushed 2 new commits to jasonmay/interpreter-hashes-arrays: http://git.io/meB4UA
01:54 moe moe/jasonmay/interpreter-hashes-arrays 10c4af3 Jason May: Pass in a StatementsNode by default instead of a list
01:54 moe moe/jasonmay/interpreter-hashes-arrays b4386c9 Jason May: Introduce arrayrefs so arrays can be declared, assigned, and accessed
01:55 jasonmay ^ was done so I could do: my @foo = (1, 2, 3); $foo[1] etc in the repl
01:58 stevan jasonmay: nice
01:59 awwaiid repl?
01:59 stevan jasonmay: feel free to merge to runtime-improvements whenever you like
01:59 awwaiid where have I been
01:59 stevan awwaiid: yespl
02:00 stevan awwaiid: still only parses a percentage of the language, but jasonmay is refining the interpreter and I am hacking the runtime
02:00 awwaiid how do I run this thing?
02:00 stevan we just need a man with a hat to complete the trinity
02:00 stevan ;)
02:00 stevan awwaiid: the sbt shell for now
02:00 stevan basically
02:00 stevan sbt
02:00 awwaiid you act like I know what that means
02:00 stevan oh wait
02:00 stevan sorry
02:01 stevan so, checkout jasonmay/interpreter-hashes-arrays
02:01 stevan and then run this on the command line
02:01 stevan sbt "run-main org.moe.Moe"
02:01 stevan and it should drop you into the repl
02:02 jasonmay also sbt "run -u" to get pretty ast dumps!
02:02 jasonmay "pretty"
02:03 stevan nice
02:03 stevan jasonmay: I am actually thinking that $foo[1] should really be @foo[1]
02:03 stevan cause the whole $ stuff is annoying
02:04 awwaiid eh. make 'em both work :)
02:04 stevan yeah, true
02:05 awwaiid though you could make the $foo[1] one warn about a deprecated construct that will be removed in moe 5.22 :)
02:05 stevan yeah
02:06 stevan 5.22, nice and arbitrary
02:06 awwaiid arbitrary? I figured we could have moe replace cperl by then :)
02:07 stevan sure, sometime around christmas
02:07 awwaiid right
02:08 awwaiid ok, so we still don't have 2+2, eh?
02:09 * awwaiid reads code
02:10 stevan nah, addition is overrated
02:10 stevan still trying to decide how operators should work
02:11 stevan 2 work though
02:11 awwaiid oh, like should they be methods
02:11 awwaiid and then comes the should the literal be a boxed object
02:12 awwaiid so I'll just say yes to both and see where we get :)
02:14 stevan the literals are boxed already
02:14 stevan but no methods on them yet
02:14 awwaiid just noticed that
02:15 stevan I feel like the "method on the boxed object" + "implicit conversions" is the most Perl 5ish
02:15 stevan but multi-subs are the most Perl 6 ish
02:15 awwaiid ya
02:15 awwaiid multi-subs in a namespace?
02:16 stevan I dunno, ask the perl6ers
02:17 awwaiid hey, MethodCallNode is just a stub! it even says 'stub'
02:17 stevan yeah, getting there
02:17 stevan I am focused still on the runtime
02:17 awwaiid I'm just teasing you :)
02:17 * stevan cries
02:18 awwaiid you should ignore anything that doesn't come in the form of code
02:48 moe [moe] awwaiid created awwaiid/expressions (+1 new commit): http://git.io/2T67VA
02:48 moe moe/awwaiid/expressions c30047f Brock Wilcox: Add addition
02:55 awwaiid I probably have to dissapear again for a few days, feel free to merge that if you like it
03:01 perigrin operators are multimethods
03:02 perigrin duh.
03:02 perigrin or uh generic functions ? is that the clos thing?
03:03 doy yeah, generic functions
03:04 doy perl 6 calls them multi subs
03:05 perigrin cause nothing should keep the same name as anything else
03:05 perigrin *sigh*
03:09 perigrin so stupid question but is there a significant difference between multimethods and generic functions ?
03:10 doy well, multimethods are methods
03:10 doy generic functions are functions
03:11 perigrin I might be biased by Perl a bit here but I don't really see a huge distinction between those when the method has multiple invocants
03:12 perigrin alternatively I don't understand how to determine which class the method is associated with if it has multiple invocants.
03:12 doy not sure what you mean by multiple invocants
03:13 perigrin then it really must be the Perl speaking for me ... what's the difference between a method and a function?
03:14 perigrin (I thought I knew this but I'm not so sure now.)
03:14 doy well, a method has an invocant
03:14 doy you can think of a method as a special case of a function
03:14 doy (which is basically what perl does)
03:14 doy but you're right that multiple invocants don't really make sense
03:14 doy you really should think of it as no invocants
03:14 perigrin right so multi-method is (I thought) a method that has multiple invocants to trigger dispatching.
03:15 doy i mean, the same way that a multi method picks the appropriate version to call
03:15 doy just do that, except without looking at an invocant
03:16 perigrin or ... in a lanugage where everything is an object ... assume *all* of the parameters are invocants?
03:16 doy having multiple invocants doesn't really make sense
03:16 doy you don't need an invocant in order to call a subroutine
03:16 doy look at regular subs in perl
03:16 perigrin I blame Damian for my understanding of OO at this level.
03:17 perigrin fair enough
03:18 perigrin that's just some kind of a symbol lookup
03:18 perigrin so to get back to where I started with this ... the distinction between a multimethod and a generic function is a multimethod is associated with a class?
03:18 perigrin and a generic function is not?
03:18 doy right
03:19 doy the main point there
03:19 doy is that say you're trying to implement a Rational class
03:19 doy if all you have is multimethods, you can implement addition for Rat + Int
03:19 doy but Int + Rat will require some extra thing to figure out what to do
03:19 doy because Int won't have an appropriate method already
03:20 doy if everything is generic functions (or multi subs, in perl 6)
03:20 doy you just write the function, and it will just get chosen based on the signature like anything else
03:21 doy it's more natural for operators like that because so many operators are commutative
03:21 doy and so it's awkward to treat one side of the operation as special or more important than the other
03:21 perigrin okay I think I see part of my problem here
03:21 perigrin my only exposure to multimethods is CLOS and Damian.
03:22 perigrin which are just 'generic functions' with a hat.
03:22 doy i mean, c++ function overloading is effectively multimethods
03:22 doy just handicapped by c++'s awful type system
03:22 perigrin how similar are they to Java's?
03:23 doy probably the same
03:23 doy i don't know much java
03:23 doy but java was pretty heavily influenced by c++
03:23 perigrin I had to unlearn method overloading as multimethods when reading AMoP
03:24 perigrin it hurt.
03:24 doy shrug, just a different way of looking at it
03:25 perigrin yeah I appreciate that now.
03:26 perigrin but I didn't have a very formal CS background, so I spend a lot of time playing catch up.
03:26 doy fair enough(:
03:28 * perigrin chuckles as TADS is on the list of languages with multimethods.
03:29 perigrin but yeah they seem like the obvious choice for implementing operators.
03:31 stevan so
03:31 stevan treating one side of the operation as special is okay as long as you have sensible coecions
03:32 stevan which is p5
03:32 stevan scala allows a lot of control over this, in a lexical sense
03:32 stevan but, meh, this is p5
03:32 stevan now, multisubs are basically "generic functions" in the CLOS sense
03:33 stevan which means that all varients of a sub are compiled into a single version which does some crazy topological sort on the argument combiations to arrive at the best approach
03:33 stevan this is (afaik) the part where CLOS starts to shit in the bed
03:34 perigrin yeah that sounds like a horrible implementation
03:34 stevan meaning, it is where shit gets really slow
03:34 perigrin I'd keep them as seperate, do the topological search as some form of hashing algorithm ... and cache the results ... sort of like how perl5 currently does method lookup.
03:35 perigrin (not that I think there's a horrible difference in performance though)
03:36 stevan topological *sort*
03:37 stevan meaning when you define a new generic function, it re-sorts all of them to make sure the correct one is chosen
03:37 stevan I dont recall the details cause ingy stole my copy of AMoP
03:37 * perigrin isn't sure where his is
03:37 stevan anyway, mutli-methods are never performant
03:37 stevan shit is always slow
03:37 perigrin but the implementation in AMoP I suspect is for demonstration purposes
03:38 stevan Java only does it by arity
03:38 stevan scala seems to do it on types
03:38 stevan but I dont know
03:38 awwaiid how about by types
03:38 awwaiid oh beat me
03:38 stevan that is adding a LOT of complexity to the language
03:38 stevan and really implicit coercion is more perlish
03:39 perigrin well perl5 only has a few basic types
03:39 stevan perl5ish anyway
03:39 perigrin heh I like this reversal of our roles.
03:39 perigrin but yes you're right
03:39 stevan break compat, only when it is okay ;)
03:40 perigrin well I don't think either would neccessarily break compat
03:40 perigrin at the basic language level they'd show up the same
03:40 perigrin 2 + 2 = 4
03:40 perigrin for some values of 4
03:41 stevan yeah, just one make shit a lot harder in the runtime
03:41 stevan and the other is pretty much just Ruby ;)
03:42 perigrin Ruby has Multimethods?
03:42 * perigrin hides.
03:43 stevan :P
03:44 stevan ok, going back to the hand-egg world cup
03:44 stevan I will make sense of this tomorrow
03:44 * stevan also needs to post some blogs and shit
03:44 stevan *sigh*
03:44 perigrin whos winning the hand-egg world up?
03:44 perigrin Gryffindor?
03:44 perigrin Ravenclaw?
03:47 anelson there's been some suspicious officiating, which to my mind indicates Slytherin
04:00 gizmomathboy meanwhile hufflepuff is showing her tits in the 'quarter...
04:00 gizmomathboy for beads of course...
04:22 doy generic functions aren't slow if you can determine enough type information at compile time
04:22 doy but yeah, a real type system would be a bit much
04:41 d0as8 joined #moe
05:18 am0c joined #moe
08:06 d0as8 joined #moe
08:38 clintongormley joined #moe
09:34 clintongormley1 joined #moe
09:50 rob joined #moe
10:59 clintongormley joined #moe
13:05 stevan doy: yes, thats true, but they are slow as shit at runtime
13:30 tadzik stevan: why did you chose prefix:? rather than postfix:? for optional parameters?
13:35 stevan tadzik: hmm, I just felt that ?$foo looked better then $foo?
13:35 stevan but I am not stuck on it
13:43 tadzik stevan: well, I'm just Perl6-biased
13:43 tadzik but it may be that ?$foo would be parsed as boolification of $foo
13:43 stevan how does p6 do it?
13:43 tadzik it's $foo? there
13:44 tadzik $foo! for explicitely mandatory param
13:44 * clintongormley prefers $foo? over ?$foo because the important bit (the name) comes first, unobscured by syntax
13:44 tadzik obscured only by $, you mean ;)
13:44 stevan hmm, yeah, ok, I am down with that
13:44 clintongormley well yes :)
13:45 tadzik may be worth asking TimToady about reasoning behind postifix:?
13:45 stevan tadzik: is this up to date? -> http://en.wikibooks.org/wiki/P​erl_6_Programming/Subroutines
13:45 tadzik I generally wouldn't count on that, but looks ok at the first glance
13:45 jasonmay does shouldmatchers show better output?
13:46 jasonmay the annoyance of asserts for me is that you don't get a nice "got this but expected that"
13:46 stevan jasonmay: the === often will provide that
13:46 jasonmay ah
13:46 tadzik stevan: http://feather.perl6.nl/syn/S06.html#Signatures is probably the most reliable source
13:46 stevan but as for better output with shouldmatchers, I don't know I 've never really looked
13:47 tadzik http://feather.perl6.nl/syn/​S06.html#Required_parameters and onwards
13:49 stevan tadzik: okay, added a bit more detail into the issue and moved it to postfix
13:49 * stevan will always defer to Perl 6
13:52 wircus joined #moe
14:07 bluescreen joined #moe
14:11 gizmomathboy joined #moe
14:18 wircus joined #moe
14:19 bluescreen joined #moe
14:26 wircus joined #moe
14:30 jnap joined #moe
14:50 isBEKaml joined #moe
14:53 isBEKaml joined #moe
14:55 isBEKaml stevan: about #39, we already have a half baked solution right now - sbt package + shell/batch wrapper.
14:55 isBEKaml stevan: sbt package generates a compiled listing of all classes (without dependencies - which we have to package separately, unless we have another sbt task that does this).
14:56 isBEKaml if you meant a ELF or PE32 executable, I'll have to think about this further.
14:56 isBEKaml NOW WHERE'S THE LOG???
14:58 isBEKaml stevan: the repl is kinda broken right now - something I actually wanted to fix last night until it got too late in the night for me. :(
14:59 isBEKaml stevan: I'll also assign #37, #38 to myself.
15:04 perigrin isBEKaml: http://irclog.perlgeek.de/moe/2013-02-04
15:04 perigrin ^^^ THE LOG
15:05 isBEKaml perigrin: awesome. Thanks!
15:18 stevan isBEKaml: re: repl, excellent
15:18 stevan isBEKaml: I cherry-picked some of your build changes btw
15:19 isBEKaml stevan: yeah, saw that in the backlog (IRC logs are good!)
15:19 stevan :)
15:19 stevan I responded to you in github re: executable
15:20 stevan I guess what would be nicest is some kind of bin/moe, be it a shellscript or a java exe, I am fine either way
15:22 isBEKaml stevan: java -jar thing is okay too, I guess.
15:26 stevan yeah
15:27 gizmomathboy does anyone know if there is a video of liz's FOSDEM talk? https://fosdem.org/2013/schedule/event/perl​s_diaspora_perl5_moe_rakudo_niecza_perlito/
15:27 perigrin this isn't #fossdem!
15:27 stevan gizmomathboy: no, but I have asked her to upload the slides
15:28 gizmomathboy stevan: thanks...I'm going to go ask over in freenode #fosdem as well...
15:28 perigrin seriously how hard is it to produce crappy poorly lit ustreams?
15:28 gizmomathboy perigrin: well, it would be of interesting to this crowd...maybe
15:28 stevan gizmomathboy: i've gotten a copy of the slides, but I am not sure if I am allowed to share them
15:29 gizmomathboy ok
15:29 perigrin just the one where she burns you in effigee
15:30 stevan nah, she and I had a long email conversation on the subject
15:31 gizmomathboy so she burned stevan in email, too. :-)
15:32 gizmomathboy I'm as much interested on her take on moe as perlito and the abstract in general...
15:33 isBEKaml I don't know - how active is perlito? Last I heard, it went into a lull of sorts.
15:34 gizmomathboy isBEKaml: true, but it does show an interest in getting perl on some extreme platforms...not that shimmying it in android (or smartphones in general) is an extreme platform...
15:35 gizmomathboy also, it looks like the FOSDEM videos will be video.fosdem.org. No eta, but maybe 10 days, per #fosdem
15:35 isBEKaml gizmomathboy: Everyone wants to be on Android! ;)
15:36 gizmomathboy isBEKaml: well, it is a good sized market.. :-)
15:37 isBEKaml so far, no programming language has been able to bootstrap successfully (completely). If we do, we'd be the first I guess.
15:38 stevan I am not sure that is true
15:39 stevan TypeScript is itself written in TypeScript
15:39 isBEKaml stevan: I meant on android.
15:39 stevan oh
15:39 stevan yeah
15:39 * stevan has an iPhone :)
15:39 isBEKaml stevan: not programming language/compiler bootstrap. (I a word)
15:40 isBEKaml stevan: Well, you can try avian. I heard somebody (soc on #scala) had been able to successfully run scala on iOS. :)
15:42 isBEKaml stevan: http://oss.readytalk.com/avian/
15:55 stevan isBEKaml: interesting
15:57 stevan gizmomathboy: so the crux of liz's talk is basically "Perl 5 is alive and kicking"
15:57 stevan and she uses the various Perl 5 and Perl 6 projects as an example of that
15:58 stevan she pretty much runs through all the projects starting from perl 1 to Topaz to Perl 6 to Perlito to Moe
16:01 gizmomathboy cool
16:01 gizmomathboy that's what I was half expecting.
16:56 isBEKaml whee: http://pastie.org/6044185
16:56 isBEKaml That's how the repl should crash. :P
17:23 stevan isBEKaml++
19:17 gizmomathboy joined #moe
19:34 isBEKaml Is there any particular reason why most of the combinators use interned regexes?
19:34 isBEKaml """ foo """.r  forms
19:37 awwaiid no
19:37 awwaiid if they are static things they should be strings
19:38 awwaiid if a regex succinctly describes something though... well then that's probably good
19:39 isBEKaml well, strings are interned too.
19:40 isBEKaml I see stuff like """\[""".r in code too.
19:40 awwaiid oh. in that case I don't know what that means :)
19:41 awwaiid """\[""".r doesn't make much sense, but def sigil = """[$@%]""".r or """-?[1-9][0-9_]*""".r seem fine
19:42 awwaiid I think I dno't nkow what "interned" means :)
19:43 isBEKaml .r compiles strings into regexes and are cached for future use.
19:43 isBEKaml Interned strings mean that for the same string, it doesn't create a new string but just picks up the reference from JVM heap.
19:44 isBEKaml That is, String foo = "FOO" and String bar = "FOO" don't create two new objects, but just one.
19:44 awwaiid ah. So do you care abotu the interned part, or just the regex part?
19:44 isBEKaml That's based on primitive equality and hashcode of the value.
19:44 isBEKaml regex part.
19:44 awwaiid ah. ok :)
19:45 awwaiid for something like """\[""".r , I don't think there is any reason to keep it
19:45 awwaiid so feel free to switch it to a plain string
19:45 isBEKaml Also, """" quoted forms are just for pretty printing. :)
19:46 jasonmay isBEKaml: in one of my branches I started switching over to literl("string")
19:46 jasonmay provided by JavaTokenParsers
19:46 isBEKaml jasonmay: Ah, while at it, can you also check that we don't get stamped on by reserved keywords in java? :)
19:46 isBEKaml override def keywords = /* blah /* I think
19:47 awwaiid jasonmay, what does literal("string") give us?
19:47 jasonmay literal("[") instead of """\[""".r
19:48 isBEKaml awwaiid: literal is one of the combinators defined in JavaTokenParsers
19:48 jasonmay it wraps strings around a parser
19:48 awwaiid what's the difference between that and just "[" ?
19:48 isBEKaml awwaiid: none at all.
19:48 jasonmay awwaiid: you can't combinate raw strings
19:48 jasonmay for some reason
19:49 isBEKaml jasonmay: I think we can ignore raw strings.
19:49 jasonmay parsers pick them up when directly hitting them, but when you use a parser containing a raw string in another parser, it fails to parse it
19:49 jasonmay I don't really iknow why
19:50 awwaiid interesting
19:50 awwaiid wonder if that would mess with backgrtracking in a packrat too
19:50 jasonmay so many times I ended up with "why is this failing to parse. hmm. what if I made this string a regex. oh it works now!"
19:52 jasonmay isBEKaml: I'm not sure what you mean about reserved keywords in java
19:57 isBEKaml jasonmay: nevermind, you'd stumble on them only when you're using StdLexical/StandardTokenParsers.
19:57 isBEKaml They have a caseclass defined Keyword
19:57 isBEKaml val reserved = new HashSet[String]
19:58 isBEKaml so, when we use any of the lexical combinators, we override this with our set of keywords.
19:58 jasonmay oh like ident and stuff
19:58 isBEKaml yes
20:05 isBEKaml jasonmay: I don't actually understand what it is about rawstrings and parsers. I can look at it tomorrow, if you want me to.
20:05 jasonmay I forbid you.
20:05 jasonmay no go right ahead :)
20:05 isBEKaml :)
20:06 isBEKaml Which branch do you have that on?
20:06 gizmomathboy joined #moe
20:06 awwaiid jasonmay, you should merge my branch into yours to make it go away :)
20:06 jasonmay isBEKaml: I accidentally lumped it in another commit so I don't remember
20:07 jasonmay awwaiid: I need to merge my branch into stevan's to make mine go away as well
20:07 jasonmay there are lots of things I should do but I'm at work
20:07 isBEKaml awwaiid: Careful. PackratParsers mean that you should make all of them Parsers into PackratParsers typed where you can see them backtracking. :)
20:09 isBEKaml awesome. more crashes.
20:11 isBEKaml Oh, our combinators are whitespace sensitive. :|
20:12 jasonmay oh crap that reminds me
20:12 jasonmay that means you can do stuff like my $ foo;
20:12 jasonmay haha
20:12 isBEKaml yeah
20:12 isBEKaml and (2 + 2)
20:12 isBEKaml boom!
20:12 jasonmay hm?
20:13 jasonmay what breaks with that?
20:13 isBEKaml stackoverflow error
20:13 isBEKaml :)
20:13 jasonmay I was getting those when futzing with lists
20:13 jasonmay a greed/backtracking issue or something
20:14 jasonmay not sure though. I'm no parser expert
20:14 jasonmay I ended up restructuring what got parsed first
20:14 jasonmay what makes you certain the errors is whitespace related?
20:14 jasonmay are
20:15 isBEKaml it always comes out of:     at org.moe.parser.MoeParsers$.han​dleWhiteSpace(Parser.scala:9)
20:15 jasonmay ok
20:15 jasonmay that's just because that's one of the parsers it traces through
20:15 jasonmay so that's why you see that in the trace
20:16 jasonmay hmm
20:16 awwaiid I think these parsers ignore whitespace, to a fault
20:18 awwaiid you had 2+2 parsing already? that's what I added in my branch, with packrat so it backtraces and doesn't overflow
20:18 awwaiid (instead of factoring out left recursion)
20:20 doy for what it's worth, "my $ foo" is valid perl
20:20 jasonmay huh!
20:20 stevan $ perl ++
20:20 jasonmay haha
20:21 awwaiid probably for our purposes we should get a list of the places where perl requires space/nospace
20:21 jasonmay in any case I'm sure there's some operator that indicates "don't skip whitespace here"
20:21 doy i'm fairly sure (although i could be wrong) that outside of string-like constructs, all tokens are split on [\b\s] or so
20:22 doy so you can put whitespace almost anywhere
20:23 doy i think this is a good thing to some extent, perl 6 tries to be more intelligent about where whitespace is allowed, but just ends up making it too hard to easily remember (in my opinion anyway)
20:37 moe [moe] svatsan pushed 1 new commit to extra-y-stuff: http://git.io/GWypsw
20:37 moe moe/extra-y-stuff a7287f0 isBEKaml: Barebones repl for now.
20:37 isBEKaml bah, more failures.
20:37 isBEKaml I'll do some more tomorrow.
20:37 isBEKaml For now, you have a barebones repl, courtesy jline. :)
20:38 isBEKaml Later, I plan to add error reporting and pretty printing, with some repl-specific commands thrown in.
20:38 isBEKaml Have fun playing with it.
20:38 isBEKaml g'night
20:40 stevan nice, tail recursive too ;)
20:53 jnap joined #moe
22:31 gizmomathboy joined #moe
23:19 jasonmay heh, in moe apparently you can assign a value to $
23:19 jasonmay my $ = 4; $
23:19 doy heh
23:20 doy that parses as $= in perl

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