Camelia, the Perl 6 bug

IRC log for #moe, 2013-02-13

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

All times shown according to UTC.

Time Nick Message
00:11 jasonmay stevan: awesome, that is way cleaner
00:20 stevan jasonmay: I am gonna comb the p6 spec to find all the methods those should have
00:20 stevan also, I think we should make array and hash access methods too
00:20 stevan circumfex:<[]> or whatever (again from Perl 6)
00:20 stevan this should simplify the interpreter too
00:21 jasonmay ruby does that as well
00:21 jasonmay though they interchange the same circumfix method for arrays and hashes :)
00:23 stevan yeah
00:51 jnap joined #moe
00:52 moe [moe] stevan pushed 1 new commit to builtins: http://git.io/YbaQoA
00:52 moe moe/builtins af38e09 Stevan Little: moving the array indexing code into the Array class
00:53 stevan yeah, I like that much better ^
00:58 gizmomathboy joined #moe
01:07 moe [moe] stevan pushed 1 new commit to builtins: http://git.io/IuwuFw
01:07 moe moe/builtins 94dee14 Stevan Little: hashes too
03:38 sivoais joined #moe
09:33 clintongormley joined #moe
13:03 bphillips joined #moe
13:46 marcus joined #moe
13:47 gizmomathboy joined #moe
14:08 bluescreen joined #moe
14:42 awwaiid joined #moe
14:42 bluescreen_ joined #moe
14:48 masak stevan: "circumfix" :)
14:48 masak stevan: and it's worth noting that circumfix:<[]> delegates to another method, at_pos
14:49 masak stevan: the reason for this, as far as I can tell, is that circumfix:<[]> needs to handle lists, ranges and whatevers, but at_pos only does lookup of individual elements.
14:51 gizmomathboy_ joined #moe
14:56 stevan masak: actually it looked in the synopsis that it was called "postcircumfix:<[]>"
14:57 stevan and yes, I am aware that my current version is very simplistic and doesn't handle anything more then simple indexing
14:58 masak stevan: oh! yes, of course. postcircumfix.
14:58 masak circumfix:<[]> is the array constructor syntax.
15:01 stevan ah
15:01 stevan interesting
15:01 * stevan makes  a note of that
15:02 stevan masak: is circumfix:<[]> a multimethod?
15:02 masak it's a sub. most operator categories are subs.
15:02 stevan sorry yeah
15:02 masak postcircumfixes are methods.
15:02 stevan right
15:03 masak I don't see why they couldn't all be multis if they wanted, though.
15:03 stevan right
15:03 masak I mean, they could dispatch on type.
15:03 * stevan has to really remember to call subs sub and methods method
15:03 masak sometimes they do. so, yes. they can be multis :)
15:03 stevan I mentally map multi-subs to CLOS style generic methods
15:06 masak Perl 6 is much smarter about them than that, though.
15:06 masak because subs are very static.
15:07 masak every scope with a new set of multis in them essentially induces its own dispatcher.
15:07 masak ...which can be fiercely optimized at compile-time.
15:08 masak it's one of the more intriguing ideas I've learned in #perl6.
15:09 stevan nice
15:12 masak { multi sprintf( ... ) { #`[ let's defined our own variant, which meshes nicely with the original one ] }; #`[ use both, maybe even runtime-poly them ] }; #`[ back to your regularly scheduled sprintf ]
15:13 masak oh, and all of the arguments are statically typechecked to the extent possible. oh, and that *already works* in Rakudo. :D it's wonderful.
15:14 gizmomathboy_ joined #moe
15:19 stevan nice
15:19 masak define*
15:24 arnsholt Also, Common Lisp defmethod isn't quite as flexible as Perl 6 multis in my experience
15:26 masak I don't have enough CLOS experience to say.
15:26 masak but I believe we found a sweet spot wrt type-based multi dispatch.
15:27 masak cf the rock-paper-scissors example, for example
15:28 stevan right
15:28 stevan yeah I am pretty sure your version is better
15:28 stevan CLOS generic methods were kinda weird
15:28 arnsholt For example I never figured out how to have instances of the same generic function that took different numbers of arguments
15:28 arnsholt That was annoying
15:32 stevan yeah, thats cause it was dispatching on the type
15:33 stevan and not the actual value of the number
15:33 stevan this is where languages like Ada were nice, cause you could define a new type which was a specific subset of numbers
15:33 stevan course that is where Ada's niceness ended in a lot of way too :)
15:35 arnsholt ^_^
15:50 am0c joined #moe
15:59 clintongormley joined #moe
16:29 kthakore joined #moe
16:58 gizmomathboy_ joined #moe
17:57 jnap joined #moe
18:09 moe [moe] jasonmay created jasonmay/ast-validator (+3 new commits): http://git.io/5-EVDg
18:09 moe moe/jasonmay/ast-validator ae7e2f1 Jason May: Add traversal level to walkAST to help manage state
18:09 moe moe/jasonmay/ast-validator e8fcb41 Jason May: Wrap interpreter evaluation in a basic util method...
18:09 moe moe/jasonmay/ast-validator e63a23a Jason May: Validate against sub foo { sub bar {} }
18:12 sivoais joined #moe
18:33 jasonmay (that was a bad example)
18:35 stevan jasonmay: nice!
18:36 jasonmay except sub{sub{}} can very easily be checked in the interpreter :) but you get the idea for possibly parameter/argument matching and stuff
18:38 stevan yeah
18:38 stevan and type checking :)
18:38 stevan and other stuff
18:39 kthakore heyo
18:52 moe [moe] kthakore pushed 1 new commit to master: http://git.io/uzJtIw
18:52 moe moe/master 51326ab Kartik Thakore: Might as well test, array within array index test
18:54 moe-docs [moe-docs] kthakore pushed 1 new commit to gh-pages: http://git.io/h0fyjw
18:54 moe-docs moe-docs/gh-pages c5996ee Kartik Thakore: Doing doc for 51326ab
19:19 moe [moe] kthakore pushed 1 new commit to master: http://git.io/6K9j0w
19:19 moe moe/master 211e351 Kartik Thakore: Testing hashref in an arrayref
19:21 jasonmay kthakore++
19:21 jasonmay oh, yeah, those test names should be fixed to be s/ref//
19:54 kthakore jasonmay: you wanna do it or should I? I am in a meeting. I can do it later. Gonna review more test cases.
20:06 moe [moe] kthakore pushed 1 new commit to master: http://git.io/GMbPwA
20:06 moe moe/master 13eb82c Kartik Thakore: Made nest if statement test more comprehensive
20:07 moe [moe] kthakore pushed 1 new commit to master: http://git.io/rqTWPg
20:07 moe moe/master e7b5126 Kartik Thakore: Oh no. I done accident
20:18 kthakore why is  val result = interpretCode("0123")
20:18 kthakore octal?
20:18 kthakore so any leading zero on an int makes it octal?
20:18 kthakore that ... sounds insane
20:18 hobbs yes
20:18 kthakore is that a perl thing?
20:18 bphillips kthakore: that's the way perl5 does it
20:18 kthakore woah ... never new
20:18 kthakore knew*
20:19 moritz it allows you to write   chmod 0755, $file
20:19 bphillips perl -le 'print 0123' # 83
20:19 kthakore gotcha
20:19 kthakore thanks moritz
20:19 masak kthakore: it's the way C, C++, Java, and C# do it, too.
20:19 hobbs kthakore: It was a C thing before it was a perl thing — been that way for four decades, give or take :)
20:19 kthakore woah I have ALWAYS used sprintf
20:19 kthakore new shit I learn all the time
20:19 masak well, sprintf goes in the other direction, doesn't it? :)
20:20 moritz kthakore: sprintf only does the other direction
20:20 masak this is about *input*.
20:20 moritz hex/oct do the same direction
20:20 kthakore okie
20:21 kthakore should -0 be 0 ?
20:21 kthakore also that test fails
20:23 hobbs they should == each other, at least
20:24 kthakore just did sprintf again ... wtf have I been doing for octal ... I remember struggling this hard core a few years agp
20:28 kthakore with this*
20:46 stevan jasonmay: so i was looking at this
20:46 stevan https://github.com/MoeOrganization/mo​e/blob/master/src/main/scala/org/moe/​interpreter/InterpreterUtils.scala#L7
20:46 stevan if you just do i.getNativeValue.toInt
20:47 stevan that works on ints too
20:47 stevan we don't get the nice exception
20:47 jnap joined #moe
20:47 jasonmay not everything has the .toInt method
20:47 stevan oh true
20:47 stevan right, array and hash
20:47 stevan ok
20:48 stevan anyway, I was thinking of moving these out of interpreter into perhaps into runtime.StandardCoercions or something
20:48 stevan so that I could use them in the Builtins stuff too
20:48 stevan that work for you?
20:48 jasonmay that's a good idea
20:48 jasonmay yeah
20:48 stevan cool
20:50 jasonmay though I recently read about pattern alternatives
20:50 jasonmay because I tried to use them on case classes (doesn't work very well for them)
20:51 jasonmay but you can probably use them in this case
20:51 jasonmay case n: MoeIntObject | n: MoeFloatObject
20:55 jasonmay looks like it doesn't work like that
21:00 gizmomathboy_ joined #moe
21:02 stevan hmm, we really need to implement warning
21:02 stevan maybe I will detour a bit and do that
21:07 jasonmay yes
21:07 jasonmay and exception throwing
21:08 jasonmay (if that's even simple to do; haven't thought about it)
21:08 stevan so I am thinking that we need some kind of environment hash for the MoeRuntime
21:09 stevan so we can do things like pass in -w and such
21:11 stevan ok, I will think about this
21:11 stevan actually this might be worth putting in MoeSystem
21:13 stevan ah, no
21:13 stevan there arent too many actually
21:13 stevan ok, nevermind, just babbling to myself
21:14 jasonmay re runtime.StandardCoercions, a lot of those helper methods can just be polymorphic methods on native objects
21:21 kthakore stevan: pingy ... is do you know why -0 is not native (0 ) in the Int test?
21:22 stevan kthakore: uhm, not sure
21:22 stevan kthakore: I mean, not sure I understand what you mean
21:22 kthakore oh sorry
21:22 stevan jasonmay: yeah, was thinking that too, but then felt that keeping the coercions in one place is probably more sane long term
21:22 stevan also allow us to vary them more easily
21:22 kthakore let me get up exact line
21:23 stevan kthakore: ok
21:24 moe [moe] kthakore created comphrensive_tests_IntLiteralTestSuite (+1 new commit): http://git.io/YbAFxw
21:24 moe moe/comphrensive_tests_IntLiteralTestSuite fc2bb4d Kartik Thakore: -0 should be 0
21:24 kthakore stevan: ^^
21:25 stevan oh, yeah I guess that should work
21:25 stevan should be a simple fix to the parser
21:26 stevan just add the optional - there -> https://github.com/MoeOrganization/moe/blob/master​/src/main/scala/org/moe/parser/Literals.scala#L12
21:27 kthakore yays
21:32 kthakore yays ... I coded
21:32 kthakore stuff
21:32 moe [moe] kthakore pushed 1 new commit to comphrensive_tests_IntLiteralTestSuite: http://git.io/bM4vBQ
21:32 moe moe/comphrensive_tests_IntLiteralTestSuite d517e03 Kartik Thakore: Added optional '-' to 0
21:32 stevan kthakore++
21:33 kthakore I will do more int adding tests later
21:33 kthakore should I merge it to master now?
21:33 kthakore the tests I have in mind might fail more
21:42 stevan kthakore: sure, merge away
21:48 moe [moe] kthakore merged comphrensive_tests_IntLiteralTestSuite into master: http://git.io/Z6T_Ag
21:54 Mithaldu stevan: do you know if there's a good scala book?
21:54 stevan Mithaldu: the staircase book seems to be the best IMO
21:55 stevan http://www.amazon.com/Programming-Scala​-Comprehensive-Step-Step/dp/0981531644
21:55 nrr ^
21:55 stevan written by the author of hte language
21:55 sartak google image search staircase book
21:55 Mithaldu cool, a kindle edition
21:55 Mithaldu thanks stevan :)
21:55 sartak apparently it's a thing
21:55 nrr actually.
21:55 nrr Mithaldu: http://www.artima.com/shop​/programming_in_scala_2ed direct from the publisher
21:55 Mithaldu sartak: that's some badass stuff
21:56 nrr Mithaldu: they have a PDF version if that's more your thing.
21:56 stevan sartak: damn, now I want one
21:56 Mithaldu nrr: the kindle is kind of arse at pdfs :(
21:56 Mithaldu if it was epub at least
21:57 Mithaldu OH
21:57 nrr read further: "for no additional charge download a Mobi eBook version of the book that looks great on your Kindle"
21:57 Mithaldu "Also, by purchasing the PDF eBook you can for no additional charge download a Mobi eBook version of the book that looks great on your Kindle."
21:57 Mithaldu yay :3
22:00 Mithaldu good thing i actually do own a credit card
22:02 moe [moe] stevan pushed 2 new commits to master: http://git.io/7oazew
22:02 moe moe/master 0965556 Stevan Little: add in a runtime.warn method so that we can do internal warnings
22:02 moe moe/master d88866e Stevan Little: might as well add print and say while I am at it
22:02 moe [moe] stevan pushed 1 new commit to builtins: http://git.io/JTOUyg
22:02 moe moe/builtins 5eef999 Stevan Little: adding in Coercion for Native objects, and adding in a few new exceptions
22:02 stevan we now have warn/print/say in the runtime so we can communicate with the outside world
22:02 * stevan will add in subs in the CORE package eventually
22:03 stevan now back to my coercions and the warnings
22:36 gizmomathboy joined #moe
22:50 moe [moe] prakashk pushed 1 new commit to runtime-improvements: http://git.io/fdyn5w
22:50 moe moe/runtime-improvements c9fa8f4 Prakash Kailasa: Rudimentary support for string ranges
22:56 moe [moe] prakashk opened pull request #54: Rudimentary support for string ranges (master...runtime-improvements)  http://git.io/5Kcsng

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