Camelia, the Perl 6 bug

IRC log for #moe, 2013-03-29

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

All times shown according to UTC.

Time Nick Message
00:20 jnap joined #moe
00:45 moe [moe] stevan pushed 8 new commits to master: http://git.io/LAzB3g
00:45 moe moe/master 8bbb9a3 Stevan Little: add note about docs
00:45 moe moe/master 4330798 Stevan Little: filling in some missing nodes in the Serializer
00:45 moe moe/master d98393f Stevan Little: namespaceIdentifier actually needs to match at least one
00:46 stevan moe> sub sum (@x, $acc?) {  @x->length == 0 ? $acc || 0 : sum( @x->tail, @x->head + ($acc || 0) ) }; sum( 1 .. 10 )
00:46 stevan 55
00:47 stevan subroutine declaration and calling ^^
01:41 awwaiid stevan++ # booya
01:45 moe [moe] stevan pushed 2 new commits to master: http://git.io/VAMydA
01:45 moe moe/master 46c8158 Stevan Little: really no need to make this a trait, and no need to duplicate unboxToString either
01:45 moe moe/master 22b2d7d Stevan Little: some more subroutine tests
02:19 moe [moe] stevan pushed 3 new commits to master: http://git.io/3GNAyw
02:19 moe moe/master 3d55b6d Stevan Little: this is Scala, no need for semicolons
02:19 moe moe/master 088292b Stevan Little: clean up the Range expansion a little bit
02:19 moe moe/master 09d0f3c Stevan Little: correcting this typo
09:38 tobyink joined #moe
10:02 arnsholt joined #moe
10:58 hiratara joined #moe
12:18 jnap joined #moe
12:27 melo joined #moe
12:43 jnap joined #moe
12:46 gizmomathboy joined #moe
12:46 melo joined #moe
13:10 awwaiid wait.... the first sub you wrote is recursive? you crazy
13:10 awwaiid stevan ^^
13:13 sartak well... that's a good test of whether setting up lexical scopes actually works :)
13:14 stevan awwaiid: no, I wrote some other simple ones to test the params
13:14 awwaiid I see your tests
13:14 stevan but the first complex sub was a recursive one yes
13:16 awwaiid Do we already have a wrapper/holder for native scala objects? is that what MoeNativeObject is?
13:18 sartak stevan: so given the way you wrote that sum function, does tail recursion already work?
13:19 awwaiid maybe I need to make MoeScalaObject? I'm again poking at "use java::lang::Integer::from<java>" again
13:20 awwaiid MoeJavaObject more like. MoeJavaClass maybe. I'll noodle.
13:21 stevan sartak: no, there no tail-recursive optimizations
13:22 stevan awwaiid: I have not tried to connect a random java class yes no
13:22 stevan but MoeNativeObject would be the bridge I think
13:22 stevan https://github.com/MoeOrganization/moe/​blob/master/src/main/scala/org/moe/runt​ime/nativeobjects/MoeNativeObject.scala
13:22 stevan it is very basic
13:23 stevan https://github.com/MoeOrganization/moe​/blob/master/src/main/scala/org/moe/ru​ntime/nativeobjects/MoeIntObject.scala
13:23 stevan but I am already wrapping the core objects
13:23 stevan then you wrap that with a runtime layer -> https://github.com/MoeOrganization/​moe/blob/master/src/main/scala/org/​moe/runtime/builtins/IntClass.scala
13:24 stevan I suspect with reflection you can make it even simpler
13:25 stevan I got this working last night
13:25 stevan class Foo { method bar {"BAR"} }; my $foo = ^Foo; $foo->new->bar
13:26 stevan can't seem to get the class access with just a bareword, so I am using the old Perl 6 class sigil
13:26 stevan but classes are first class objects
13:26 stevan need to add in attributes to the parser too
13:26 stevan the parser really needs a re-write, but so far so good
13:27 awwaiid re-write or re-factor?
13:27 awwaiid I guess it's not that big
13:27 stevan either one :)
13:27 stevan we've been kind of just piecing it together one by one
13:27 awwaiid well I practiced some java reflection from the scala REPL last night, made me an Integer from a string and did some stuff with it
13:28 stevan nice
13:28 PerlJam heh. "old Perl 6" :)
13:28 awwaiid looks like the trick will be if you call java::lang::Integer->new(...), which will probably just alias to the ->Integer class method to be perlish, we have to look up _which_ constructor they're using based on the params
13:28 * stevan pictures awwaiid hunkered over a REPL and a bunson burner cooking up some strange concoction
13:29 stevan awwaiid: yeah, thats the tricky bit, mapping the methods and their params
13:29 awwaiid so I'll do it the slow way first, so that when we invoke $javaThingie->blah(...) we'll loop over all the methods and find the one that fits at that time
13:29 awwaiid and later we can try to move that out of the runtime
13:30 stevan yeah
13:30 stevan no need to prematurely optimize
13:30 awwaiid also, as always, if someone else gets to this before me then that is OK :)
13:30 stevan if I wanted to do that I would not have gone with the tree walking interpreter
13:30 stevan :)
14:03 jasonmay awwaiid: how much did you write already?
14:04 jasonmay awwaiid: I have some stuff in a branch that's broken
14:04 jasonmay consists of a JVM class and $JVM object in the core env
14:05 jasonmay for tracking classpaths and stuff
14:05 jasonmay but I plan on continuing this weekend
14:05 awwaiid jasonmay, I wrote nothing, I just started thinking and toying in REPL land
14:06 awwaiid what branch?
14:06 jasonmay I didn't push it yet
14:06 jasonmay it doesn't compile :)
14:06 awwaiid CODE HOARDER!! WE HAVE A CODE HOARDER HERE
14:06 awwaiid cool
14:07 awwaiid I may play some more, but I will consult you before doing anything significant.
14:07 awwaiid Unless my code compiles. in which case may the best coder push
14:07 awwaiid tricky though, since whoever pushes last gets to keep their code in there
14:08 awwaiid May the best coder push last, then.
14:10 jasonmay I was going to construct the moe-encapsulated jvm classes at import time
14:11 awwaiid me too
14:11 jasonmay so for the equivalent of 'import java.util.Set' would create a moe class and map the methods right there
14:11 awwaiid ME TOO YO
14:11 jasonmay oh ok
14:15 awwaiid goal: use java::lang::Integer::from<java>; my $n = java::lang::Integer->new("23"); ... and then I don't know.
14:29 jnap joined #moe
14:34 jasonmay awwaiid: here - http://linode.jarsonmar.org/brock.patch.txt
14:34 jasonmay have at it :)
14:36 awwaiid fancy!
14:37 awwaiid you're way ahead of me. I'm just waving my hands so far :)
14:37 tobyink joined #moe
14:40 stevan :)
14:40 stevan just got this working
14:40 stevan class Foo { has $.bar = 0 .. 5; method bar { $.bar->pop }; method baz { $.bar } }; my $f1 = ^Foo->new; my $f2 = ^Foo->new; [ $f1->bar, $f1->baz, $f2->bar, $f2->baz ]
14:40 stevan gives me
14:40 stevan [5, [0, 1, 2, 3, 4], 5, [0, 1, 2, 3, 4]]
14:40 awwaiid damn G
14:40 stevan the whole instance creation thing needs work
14:41 jnap joined #moe
14:44 doy is relying on the ordering of execution of subexpressions like that going to be a thing?
14:44 awwaiid do you have a counter proposal?
14:46 awwaiid hm. reading the code more carefully I guess the results should be [5, [0, 1, 2, 3, 4], 4, [0, 1, 2, 3]], eh?
14:46 awwaiid oh f1 f2
14:46 awwaiid nevermind
15:27 moe [moe] stevan pushed 7 new commits to master: http://git.io/bzQdjw
15:27 moe moe/master 42693e0 Stevan Little: attribute defaults are now functions so that they can create new versions for each instance
15:27 moe moe/master a45fd93 Stevan Little: construct objects correctly
15:27 moe moe/master c25afa9 Stevan Little: add in predicates for constructor/destructor
15:43 jasonmay awwaiid: I don't want to step on your toes so I was just passing my code off to you. I'm just gonna wait and see what you come up with
15:45 jasonmay stevan: awesome!
15:48 bluescreen joined #moe
16:07 jasonmay awwaiid: food for thought, wildcards on packages
16:07 jasonmay jvm packages I mean
16:07 jasonmay awwaiid: import foo.bar._
16:14 stevan jasonmay: thanks, I am happy with this progress
16:22 am0c joined #moe
16:39 jnap joined #moe
16:43 tobyink joined #moe
16:53 melo joined #moe
17:26 tobyink joined #moe
17:27 awwaiid jasonmay, in java can you do "import java.lang", or is that nonesense? I know "import java.lang.*" pull in everything in that tree
17:27 awwaiid or in other words, maybe just "use foo::bar::from<java>" will effectively be the wildcard without needing explicit syntax.
17:27 jasonmay there are a bunch of reflection stuff for traversing the package trees as far as I know
17:28 jasonmay qah
17:28 jasonmay ah*
17:28 doy "import java.lang" lets you do things like "lang.Object" instead of "java.lang.Object"
17:29 jasonmay and I believe scala's ._ is java's .* in importing
17:29 awwaiid ah, so it just provides a shortcut
17:29 jasonmay yup
17:29 awwaiid and in java the * is fully recursive, right?
17:29 doy relatedly though, it's probably worth thinking about how we want to handle exporting in moe
17:29 awwaiid I guess it too is a shortcut, just one level deeper
17:29 jasonmay awwaiid: what do you mean?
17:29 jasonmay yeah just one level
17:29 awwaiid nevermind I intuited it
17:30 jasonmay doy: I also can't wait to get .mo files to import classes from other .mo files
18:27 stevan doy: yeah I was thinking that too
18:38 phaylon any idea yet on what moe's strategy for limiting access to values in attributes will be? e.g. $notmyobj->somearray->push($nonsensevalue);
18:38 phaylon besides "use a container with the api you want" :)
18:39 stevan attributes wont be public
18:39 stevan so if you want to expose, you make an accessor
18:39 phaylon well, yea
18:40 doy if you expose somearray, and it returns an array, it doesn't make any sense for $notmyobj to have any effect on how that array is used
18:40 phaylon so you just make sure you return a new array every time?
18:40 stevan if that is what you want, yes
18:41 doy yeah, it's up to you to make the somearray method return something that makes sense
18:41 doy or just not expose somearray as a method at all
18:41 doy you can keep it as a private attribute if you don't want to expose it
18:41 phaylon does moe have ++? that one really bit me
18:42 stevan it does
18:42 stevan right and left
18:42 stevan phaylon: what about them bit you?
18:42 phaylon so, what would $mydbobj->id++ do if that was a simple reader?
18:42 phaylon stevan: the above :)
18:42 stevan yeah, I am not sure
18:43 phaylon bit me in my brain I mean, not in moe :)
18:43 stevan thats getting into lvalue territory
18:43 phaylon yea. you'd have to be sure to always return either a copy or something readonly/const
18:43 stevan in Perl that would never work cause perl copies numbers and strings around
18:43 phaylon right
18:43 stevan Moe doesn't do that
18:43 stevan here, one sec, lemme check
18:44 phaylon my former question was in the same vein: class Foo { my @allowed_flags; method allowed_flags { return @allowed_flags } } #  would that copy the array?
18:44 stevan hmm, right now the parser just chokes on it
18:45 stevan I dont allow my in a class body
18:45 stevan only attribute declarations, method declarations, and constructor (BUILD) and destructor(DEMOLISH)
18:45 phaylon I was considering limiting ++ to variables, i.e. treating them as assignments. but that didn't seem right because it feels more mutaty
18:45 phaylon ok. my @allowed_flags = (...); class Foo { method allowed_flags { return @allowed_flags } } then
18:46 phaylon or even just my @allowed_flags = (...); sub flags { return @allowed_flags }
18:46 stevan yeah, in Moe this wouldnt copy the array
18:46 stevan cause everything is a reference
18:47 stevan more like Perl 6
18:47 phaylon so $foo.allowed_flags.push('somethingelse') would change the lexical?
18:47 awwaiid RE accessor access, are we going with the classic smalltalk all attributes private all methods public?
18:47 stevan hmm ++ is broken totally
18:47 stevan phaylon: yes it would
18:47 stevan awwaiid: yes sir
18:48 awwaiid stevan++ # makes the awwaiid happy
18:48 awwaiid oh, and no way to do otherwise, right?
18:48 phaylon stevan: then my first question could be refrased as "given automatic accessor generation, is there any mechanism to make it easy to return copies"?
18:48 phaylon *rephrased
18:48 awwaiid sounds like a mop metatraitsomething
18:49 phaylon well, if everythings a reference I'd expect this to be a common pattern
18:49 stevan awwaiid: no plans to no, but who knows
18:49 stevan phaylon: I am not giving you automatic accessor gen :)
18:50 phaylon well, not just for that, it's just an example :)
18:50 phaylon but I assume we'd just see return @foo.copy in certain places, or have a returnscopy method trait or something, would that fit in?
18:51 stevan yeah I dunno
18:51 stevan yeah, I honestly find myself not worrying about this stuff when I program in Java/Scala/C# much
18:52 phaylon don'T know them, but I do worry about it in perl :)
18:52 stevan as well you should, but in Moe you wont ;)
18:53 phaylon I'd like to understand why :)
18:54 phaylon one thing I always worry about with such things is that if $obj.foo returns a mutable array, that becomes part of the public api
18:55 phaylon so I'm thinking about things like does proxy(Array::Readable)
18:55 stevan haha, in Scala
18:55 stevan "error: value ++ is not a member of Int"
18:55 stevan mutation is bad mkay
18:55 phaylon heh
18:56 phaylon yea, referentially passed numbers with mutative methods can be surprising
18:56 stevan yeah, that was always my issue with Moose::Autobox, it exposes the implementaion
18:57 perigrin and tightly binds several layers of abstraction together.
18:57 perigrin (which is probably the same thing)
19:02 melo joined #moe
19:05 jnap joined #moe
19:33 moe [moe] stevan pushed 3 new commits to master: http://git.io/8u5pXg
19:33 moe moe/master d15be0e Stevan Little: add the ability to clear out a variable (not often necessary, but you never know)
19:33 moe moe/master 441a032 Stevan Little: make sure to restore the current package
19:33 moe moe/master e69685b Stevan Little: make sure to unset the current Class once outside of the body
19:53 bluescreen_ joined #moe
19:54 bluescreen__ joined #moe
20:01 awwaiid moe == perl5½
20:01 awwaiid use v5½.4;
20:11 tobyink joined #moe
20:18 moe [moe] stevan pushed 2 new commits to master: http://git.io/yBVUow
20:18 moe moe/master c007202 Stevan Little: improve the lookup of subs, packages and classes, they now go through the runtime so that we can check the CORE package as a backup (TODO - add package hierarchy traversal)
20:18 moe moe/master 89af61e Stevan Little: add in the CorePackage and implement say, print and warn
20:18 stevan hehe
21:20 bluescreen joined #moe
21:31 jnap joined #moe
22:06 gizmomathboy joined #moe

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