»ö« | perl6.org/ | nopaste: paste.lisp.org/new/perl6 | evalbot usage: 'perl6: say 3;' or rakudo: / pugs: / std: , or /msg p6eval perl6: ... | irclog: irc.pugscode.org/ | UTF-8 is our friend!
Set by diakopter on 25 January 2010.
pmichaud I'm looking for a method (name) that can be used on an Iterator to get it to return itself in a form appropriate for a Seq 01:07
(without actually being a Seq) 01:08
for example, if I have
diakopter .net has GetEnumerator
pmichaud my $i = (1..5).iterator; $i.get; $i.get; $i.foo
diakopter GetSequencer
.sequencer 01:09
pmichaud I'd like $i.foo to return me 3..5
diakopter .seq 01:10
jnthn .rest
pmichaud yeah, I thought of .seq, but somehow that feels like it ought to return a Seq
oooh, .rest might work
the key feature is that
$file.foo # returns the remaining lines of the file
jnthn But why not .clone, because you're taking a snapshot of the iterator at the curent state?
Or have I missed the point?
pmichaud because $file.clone should clone the iterator, but doesn't give me all of the lines 01:11
jnthn Oh, it's meant to give all the rest of the values?
pmichaud right
rest of the values
jnthn OK, gotcha.
I rest my case.
:-)
pmichaud but it's also allowed to do so lazily, if state isn't an issue
jnthn That's OK, it's still the rest of them, in some way. 01:12
pmichaud i.e., a RangeIterator is allowed to return a range without having to eagerly generate them all
and a MapIterator is allowed to return a new MapIterator
jnthn *nod*
pmichaud but a filehandle would go ahead and slurp up the remaining values, because that causes a state change
jnthn OK, makes sense. 01:13
Is this really the "fairly eager" level?
pmichaud here's the larger issue
yeah... "fairly eager"
"mostly eager" as defined now suffers from a sequencing issue
pmichaud in that it stops evaluating at the first potentially non-finite item 01:14
jnthn oh, mostly eager was the term I was looking for :-)
pmichaud what I'd really like is a form of eagerness for a transactional-type of thingy 01:15
for example, to be able to evaluate (1..1000, $file.lines)
such that it gives me back
1..1000, "line 1", "line 2", "line 3", ..., "last line"
i.e., the 1..1000 can still be lazy
jnthn Ah, I see. 01:16
pmichaud but $file.lines went ahead and flattened out into values
jnthn Could you not define mostly eager as looking through the things available and asking them to DTRT in a "mostly eager" context?
pmichaud yeah, I suppose. or we could say that Ranges in mostly eager context are allowed to not flatten 01:17
Tene I really like how leaving off word boundaries on my hilight ends up notifying me of most of these conversations, due to "flatTened".
jnthn I think it's a decision for the iterator, tbh.
pmichaud so, .eagerize
jnthn .eagerish
Tene Will definitely read when I get home from work. 01:18
jnthn .eagerize suggests to me "completed eager", at first glance.
pmichaud yes, it's a decision for the iterator, definitely -- I'm just trying to decide what to call it
.eagerify (c.f. "stringify" and "numify") 01:19
or, perhaps, .itemize :-)
jnthn Perhaps .eagerify by default could give you the mostly eager semantics, and .eagerify(:really) maybe the "completely eager" one or something. 01:20
pmichaud well, "completely eager" is probably just .eager
jnthn Ah
pmichaud c.f. the "eager" function
jnthn Yeah, you're right.
In that case, I'm not sure you want a name too close to .eager
pmichaud but perhaps it's .eager(:mostly)
jnthn Well, perhaps, but... 01:21
...mostly eager feels to me like the default.
As in, what's usually the right thing.
pmichaud depends on the operation
jnthn True.
pmichaud surely if I say my @a = eager 1..10, $file.lines;
I really expect that 1..10 to be converted to the actual elements
jnthn Yes, but then you're throwing in something to explicitly say you want a different level of eagerness. 01:22
(My point being that since that's the special case because you had to write eager there, I'd expect it to be the special case in the iterator API and the one specified by an adverb...) 01:23
pmichaud yeah, but I'd expect (1..10).iterator.eager to also give me back 10 items 01:23
jnthn Yeah, me to.
So...I think maybe the adverbs are a bad idea.
pmichaud right. 01:24
and I haven't convinced myself to like .mostlyeager or .meager :-)
jnthn :-)
.rest is cute but doesn't quite convey the transactional or mostly eager sense. 01:25
Maybe an overly-descriptive method name is a bad thing though. 01:26
.getstuffeagerlythathastransactionalsemantics sucks. :-)
jnthn Anyway, I think defining mostly eager to be aware of these transactiony needs is the main issue. 01:27
Method names are easily tweaked if somebody thinks of a better one; semantics less so.
pmichaud well, I might just go with .seq for now then -- I've not come up with much better 01:28
pmichaud it has reasonable analogues with .item, .list, .hash, etc. 01:28
jnthn yeah, but confusion with .Seq
pmichaud well, that may not be too bad -- the whole point of this is to get something that can be placed into a Seq
jnthn Yeah, true. 01:29
The "distinguished by a capital" just makes me twitchy.
pmichaud oh, we already do that with Hash <-> hash
and we used to do it with List <-> list
jnthn Yes, true.
.oO( to avoid the confusion, we rename it to .hashish...implementation available in Morocco )
01:30
pmichaud anyway, I can use .seq for now and we can change it later if we decide on something more appropriate. I may discover that my planned design doesn't work anyway
jnthn Yes, wfm.
OK, it's late and I gotta actually work tomorrow, rather than wondering around Slovak castles in -10C. 01:33
*wandering
pmichaud okay, see you tomorrowish
jnthn Aye, night o/
diakopter so 02:54
sjohnson hi dia 02:55
diakopter hey
cjk101010 morning 05:20
sjohnson hi 06:16
Su-Shee good morning 07:16
cjk101010 morning
moritz_ good morning 08:46
sjohnson hi 08:51
diakopter till the morn' 10:54
PST
sjohnson diakopter: hows it going? 11:22
lichtkind what changes where made in s01? cant find them 13:04
moritz_ r29431, lwall++ [S01] take another lap around Mt Sinai... 13:06
before that r28174 and r28172
sjohnson moritz_: ot question 13:08
ever done any clipper programming?
moritz_ nope
that was quick :-)
colomon morning! 13:10
lichtkind or to aks the other way arout are there anywhere changelogs for the svn ?
morning
colomon lichtkind: svn log is the command you are looking for, maybe? 13:11
moritz_ lichtkind: I keep a git-svn mirror of the specs locally on disc, then 'git log $filename' is pretty quick
svn log also works, but is a tad slow for my taste :-)
sjohnson moritz_: just doing a bit of a clipper => transition lately.. haven't been doing much perl lately *sad face* 13:11
err.. harbour transition 13:12
(32/64 bit modern compiler)
colomon moritz_: thought of course, if you don't already have the git-svn mirror, plain svn log is probably much faster. 13:16
moritz_ colomon: yes. It's all a matter of how often you need it 13:17
I'd be lost without my git mirror of the test suite
rakudo: {redo} 13:22
locally that prints a newline 13:23
to STDERR 13:24
moritz_ that's less than awesome 13:24
sjohnson rakudo: say "have hope, sjohnson" 13:55
sjohnson kills himself 13:55
moritz_ hugme: hug sjohnson 13:56
hugme hugs sjohnson
sjohnson ( ° ー°)
moritz_ we have a bot for hope. It's not p6eval :-) 13:57
sjohnson bless { hugme } 13:57
"saved 6 people from suicide... and counting!" is its slogan i believe 13:58
moritz_ and the Perl 6 slogan is "Perl 6 - gets your job done, or gets you job" 13:58
*a job
Su-Shee both, actually. 14:09
sjohnson heh 14:14
perl 6 is smarter than i'll ever be in life
Su-Shee sjohnson: I use the idiot's subset. ;) 14:17
sjohnson so Su-Shee, how's it oging 14:27
Su-Shee got my full contract yesterday (I'm finished with probation period) and I'm the designated perl 6 driver err developer now. ;)
(and the UI chick..) 14:28
colomon \o/ 14:29
Su-Shee I essentially got served my dream job. :) 14:31
sjohnson nice
my job lets me use perl about 10% of the day 14:32
those are happy periods though at work, though
moritz_ networking++
moritz_ sjohnson: that's more than average, I'd say :-) 14:32
sjohnson moritz_: yeah... i better not jinx it 14:32
:)
lichtkind i found in the svn log only one change relataed to S01 ... around mt sinai thing 14:45
moritz_ before that there were some typo fixes, and about .pl vs. .p6 or .pl6
lichtkind was there any other?
moritz_ longer ago, though
moritz_ lichtkind: nopaste.snit.ch/19401 all changes to S01 in 2009 and 2010 14:47
pmichaud jnthn: ping 14:50
(good morning, #perl6)
frettled good morning!
pmichaud: so, how are you doing today?
pmichaud well so far 14:51
making good progress on iterators and laziness
frettled \o/
_ash my $a = 5; my @b; @b[0] := $a; $a = 6; say @b; #should print 6 right? 15:19
moritz_ yes
pmichaud binding doesn't work for array elements yet
(in any of the implementations, although I know how to do it in ng) 15:20
moritz_ hopes that somebody submits a non-regex Perl 6 talk to the Copenhagen Open Source days 15:20
we now have two regex talks
masak++ and me
pmichaud I need to see if jonasbn reserved a talk spot for me or if I should still submit
moritz_ pugs: my $a = 5; my @b; @b[0] := $a; $a = 6; say @b
pmichaud: you should
pmichaud I'll do that shortly. 15:21
moritz_ in his mail yesterday he wrote "something, if anybody else intends to give a talk, please submit your abstract ASAP to: [email@hidden.address] and Cc me."
where me = jonasb <at> gmail
_ash are there any other shortcuts for := binding? just curious if there is a way to write it like my @a = ($b) and get a similar kind of binding 15:22
moritz_ I'm not aware of any
pmichaud my @a = \$b; # might work 15:23
pmichaud rakudo: my $a = 5; my @b = \$a; $a = 6; say @b; 15:23
ENOP6EVAL
> my $a = 5; my @b = \$a; $a = 6; say @b; 15:24
6
_ash if you msg p6eval it works
that printed 6 since i messaged it
so, in theory, you could do my @a = (\$b, \$c); $b = somethingelse; $c = somethingelse and @a is updated? 15:25
pmichaud I believe so.
_ash does my $a = \$b; work similar to my $a := $b? 15:26
pmichaud yes.
they're slightly different, but the end result is the same
for many operations
_ash okay, cool 15:26
moritz_ rakudo: my $a = 5; my @b = \$a; $a = 6; say @b; 15:27
_ash ng: say 'hi'';
moritz_ I don't understand what's wrong
I see all the messages in the logging console 15:28
pugs: say 1
_ash it worked when i messaged it still, so you know
korpenkraxar hi all! what text editors/IDEs are there out there that can do Perl 6 syntax highlighting and/or checking? I only know of Padre, but have not used it for Perl 6 yet.
moritz_ there's a Perl 6 plugin for Padre
and there's a rather good syntax file for vim 15:29
_ash vim and emacs too as always, although the emacs one's a bit spotty at times
moritz_ and a slightly less up-to-date one for emacs
hudnix oh , where can I find the emacs one?
moritz_ in the pugs repo in misc/
no 15:30
util/ or so
hudnix thanks
moritz_ svn.pugscode.org/pugs/util/cperl-mode.el
hudnix: if you want to update it, I can give you a commit bit - just /msg me your email address and desired nickname
hudnix ok, I'll take a look 15:31
moritz_ (or if I'm offline, ask somebody else - many people here can hand out commit bits) 15:31
_ash the emacs one is a bit dated, as a warning
hudnix has given up getting padre working on his ubuntu box
moritz_ #padre on irc.perl.org is usually very friendly 15:32
hudnix yeah, they gave up on me when they found out I've been forcing my cpan installs :) 15:32
moritz_ :-) 15:33
I do that too at times, I have to admit
Su-Shee me too. especially gui stuff which tries to activate a test requiring popping up a window - which will fail if I'm root or work over the net. 15:46
jnthn pmichaud: pong 15:56
_ash my is a lexical function right? 16:08
pmichaud jnthn: was just noticing a few things about the binder code 16:13
currently, the binder expects to create the objects and set their properties?
jnthn pmichaud: I think in ng we're duplicating some of the work there. 16:14
pmichaud okay.
jnthn pmichaud: e.g. they get set up as lexical decls
But then the binder re-does it.
pmichaud right.
jnthn There's some cleanup to be done there, I suspect.
pmichaud which one _should_ be doing it?
jnthn Suspect the binder. 16:15
Oh
I know why we're doing this.
Parrot regalloc issue iirc - if you don't init a register visibly somewhere, it reuses them and the lexicals end up sharing registers. :-( :-(
pmichaud that's a different issue
oh, wait, no it isn't
well, we could certainly simply do null $P0 16:16
instead of having to allocate an object
jnthn pmichaud: We could. 16:17
pmichaud: It was in the back of my mind as a "thing to revisit at some point to be more optimal" 16:18
pmichaud okay
jnthn Though I've been more concerned about making things work / correct semantics for now. :-)
pmichaud yeah, I think we have a few inefficiencies in place
I just modified the binder in ng1 so that it creates a Parcel for slurpy args instead of a RPA 16:19
I'm also wondering if it's possible for me to eliminate the 'flatten' property soonish
...but not entirely certain about that yet.
jnthn OK.
moritz_ pmichaud: push it 16:20
jnthn That shoulda helpefully been an easy change.
pmichaud it was
_ash ng: say 'hello p6eval?':
hmm odd 16:21
moritz_ somehow p6eval is even more broken than it used to be
moritz_ has to leave, see ya all tomorrow 16:23
_ash moritz_: i think diakopter fixed class creation in it though 16:24
in rakudo i mean specifically
pmichaud jnthn: I'm thinking I'd still like all of an array's elements to share a common prophash. Any reason you can think that might not work? 16:34
pmichaud TimToady: I'm rapidly coming to a point where I could use at least a hint on Pm-19. 17:17
(it's okay if it's a provisional answer)
TimToady still recovering from having to take antihistimines last night, but will look 17:18
pmichaud understood
(and thanks)
TimToady btw, haven't finished backlogging, but if you want something transactional, maybe you want a transactional verb like commit 17:19
or purify, or something
pmichaud those seem plausible also
for the moment I've gone with making Array and Seq strictly eager, just to get me over the current humps
TimToady also "eager" defaults to mostly eager; spec says you don't get either of strict eager or strict lazy without pragmas, iirc 17:20
pmichaud oh, if that's the case, I can definitely live with that
would that be true of the 'eager' listop, as well?
my @a = eager 1..*; # still returns a lazy list?
TimToady if it makes things simpler, sure 17:23
pmichaud okay
TimToady eager doesn't mean you get what you want :)
that would be more like demanding
pmichaud and just to verify -- same is true for 'lazy' -- it's "mostly lazy" by default and you have to do something special to mean "strictly lazy"? 17:24
TimToady parsimonious or some such :)
pmichaud okay
need to fold those into my mental model, but that does simplify things a bit, I think 17:25
TimToady I think the answer for Pm-19 is that map is transparent to the parcel structure of the input, running on each element, but preserving parcel structure in the output 17:26
TimToady (with extra parcel around each map results) 17:26
but that could just be SleepyBrane talking
pmichaud ummmm. ouch
I hope that's sleepy brane 17:27
TimToady yes, I agree, but it seems to be what's wanted semantically to keep the binding lazy
or the assignment
pmichaud what if the {...} block took 3-at-a-time instead of 1-at-a-time
?
then how would we preserve the parcel structure?
TimToady good question 17:28
pmichaud and colomon++ also posed the possibility that a 1-at-a-time input could be producing parcels of n elements
TimToady that part's easy
pmichaud (indeed, there's not even a requirement that the parcels produced by .map are all of the same "dimensions")
pmichaud fwiw, my (weak) preference at this point is that we require the input to map to explicitly indicate slicing if that's what is desired 17:30
(slice 1,2,3 X 4,5,6).map({...})
TimToady or (1,2,3 X 4,5,6).slice.map? 17:31
pmichaud that'd be fine also
in general I tend to treat the prefix listops as method forms :-) 17:32
the alternative is that we always assume slices, and explicitly require list for 1-at-a-time
the tricky part to that is that we sometimes get sliced parcels even when we didn't intend them
so it tends to make sense to default to list context until explicitly indicated otherwise 17:33
TimToady no, I think flat is better
pmurias why is strictly lazy and strictly eager pragma only? 17:34
pmichaud I'll start that way for now then
we can leave the question open in Pm-19 for now
TimToady strictly eager is good mostly for blowing up memory
strictly lazy is good mostly for writing impenetrably recursive Haskell definitions 17:35
pmichaud but I'll assume that map gets 1-at-a-time "flat" semantics for now
thanks
TimToady might possibly have a pmap that does parcel at a time, say
pmichaud that could happen too
but then we might want a pgrep also :) 17:36
TimToady or meta-operators on postfixes :)
pmichaud is NOT going there today. :) 17:37
would it make sense to use Iterable as a designator that "this data structure tends to flatten in flattening contexts?" 17:38
pmichaud (keeping in mind that other things might suppress that, such as storage in a scalar var) 17:38
TimToady or maybe it's just -> \$parcel {...} or some scuh 17:38
such, even
also -> @@slice {...} might be useful 17:39
pmichaud ooooh
I like --> @@slice 17:40
TimToady well, except for the @@, which nobody likes :)
pmichaud that might be a bit tricky, still 17:40
TimToady yes, well, that's why it should be up to a signature how much it binds, not .arity 17:41
pmichaud especially if we have something like -> $a, @@slice { ... }
TimToady I keep saying that...
pmichaud oh, I agree fully it shouldn't be .arity (or .count). I'm just waiting for the construct that lets me do a partial bind of a signature against an active iterator :-) 17:42
jnthn wishes he'd first heard TimToady say this before he'd re-designed the signature binder :-)
Think I can do it without too many changes... 17:43
TimToady basically, has to have a backchannel for the modified capture to feed on to the next iter
I wrote a way to do that once by cheating with a where block at the end 17:44
something like \$remainder where { $external_state = $remainder } 17:45
pmichaud on the other question I just posed...
jnthn Could it not be a way of calling with an iterator, and it just iterates it a bit?
TimToady but one needs a way of specifying that in the forward direction too
pmichaud 17:37 <pmichaud> would it make sense to use Iterable as a designator that "this data structure tends to flatten in flattening contexts?"
TimToady how does binding to a capture not iterate its positions anyway? 17:46
jnthn And then after the call you're ready for the next one.
TimToady: It does, my point is why do we need a "here's what's left" backchannel?
TimToady: If it's used the iterator to obtain N values that it needed to do the binding, for example.
TimToady ah, yes, that's perhaps a better way to look at it 17:47
pmichaud yes, that's what I was thinking
jnthn TimToady: Then the next call, it'll pass in the smae iterator as the argument source.
pmichaud we need to rethink much of the spec replacing the word "list" with "active iterator", I think.
TimToady so we only need the forward signal that says OK to leave some
jnthn Yeah.
pmichaud i.e., "list" is something that we tend to consume elements from
TimToady I don't generally believe in lists these days 17:48
pmichaud (I'm finding that in the current implementation of stuff as well)
TimToady it's a figment of the user's imagination
it's all really parcels and captures and iterators and such
pmichaud well, "List" is starting to look like it's a mechanism for grabbing elements from a set of iterators using list context
TimToady yes 17:49
TimToady so I try to avoid the term in describing any data structure 17:49
pmichaud it also seems to be the thing that we use to talk about "all of the remaining elements of an iterator" -- i.e., to turn an iterator back into something that can flatten
TimToady (internally)
pmichaud (without actually producing the iterator's elements at that point)
TimToady isn't that just whether the next binding is slurpy? 17:50
hmm, there's a problem with mutable capture 17:51
nextsame
jnthn ah, hm.
:-/
That is a problem.
TimToady capture more like a Seq with a pointer into it? 17:52
s/pointer/index/
jnthn Maybe...
TimToady or possibly pessimize to that when we see nextsame 17:53
you're not "consuming" the capture currently, are you? 17:54
(or nextsame wouldn't work)
so maybe we're not losing much by keeping a cursor into it 17:55
jnthn TimToady: No, relying on captures being immutable.
TimToady yes, it's the original string you're parsing, as it were, and the work is done by cursors 17:56
jnthn TimToady: Iteration of the capture doesn't modify the capture.
TimToady but the positionals have to get reified internally 17:57
that's more like a Seq
(current definition of Seq) 17:58
pmichaud on a related noted, if I have my $a = Seq($b, $c); 17:59
TimToady are you saying that we can use the internal reified status as the cursor?
pmichaud does $a get the values of $b and $c or does it actually refer to the $b and $c containers? 18:00
TimToady in any case, a sig of ($a,$b,\$c) wants to know the state after binding two positionals
TimToady hmm, and nextsame has to reset that state, urq 18:00
jnthn TimToady: What do you mean by "know the state"?
TimToady the place to begin parsing the next time 18:01
jnthn TimToady: Well yes, nextsame essentially needs a "snapshot" of the state.
pmichaud e.g.: my ($b, $c) = 4,5; my $a = Seq($b, $c); $b++; say $a; # "4 5" or "5 5" ?
jnthn TimToady: It gets that now just by virtue of the capture being immutable, so it staches that away. 18:02
*stashes
Which is cheap.
TimToady so the current binding position is an external cursor into the capture 18:03
jnthn Right.
pmichaud wanders off to lunch.
TimToady that's what we need to keep around for the next map etc
jnthn Oh, I'd not seen in that way. 18:04
I'd seen the bind as working us through the iterator, but we remember the position before we start, and make that available to nextsame.
TimToady and nextsame uses the cursor that was in effect at the beginning of the call
jnthn So it can "replay" the bind.
TimToady we can bind to further than the iterator reifies, when we bind a slurpy 18:05
jnthn Wouldn't a slurpy just end up sucking in the lot?
TimToady not in the eager sense 18:06
pmichaud 17:37 <pmichaud> would it make sense to use Iterable as a designator that "this data structure tends to flatten in flattening contexts?"
TimToady a lazy slurpy has to copy in the remaining iterator
pmichaud oops
TimToady no, you can't use intrinsic typing for the flattening decision 18:07
pmichaud not completely, no, but as part of it?
TimToady or $array starts flattening
yes, Iterable does mean "flattenable" 18:08
pmichaud i.e., check the container (or reference) to see if it's "don't flatten", and if not, then check the type
TimToady or to put it another way, flattening a non-Iterable is the identity function
hmm, I think I just came up with an argument against @@ 18:10
we bind to a sequence of parcels with *@@ 18:11
but how do we bind to a single parcel?
pmichaud right now in ng1 I have Parcel as a object that doesn't tend to disappear 18:12
TimToady the *$,*@ trick doesn't work out, or we'd get *$$,*@@
pmichaud wouldn't bind to a single parcel just be @@ by itself? 18:13
TimToady what we really want is something more like **$,**@
@@[*$,*@] maybe
pmichaud afk, lunch 18:16
TimToady but I'm thinking maybe we want something else to say "look for a parcel here"
and leave the sigils out of it
maybe steal \ 18:17
and use |$c to trap binding state
TimToady then -> \$x {...} maps parcel to parcel 18:18
*\$ and *\$ fall out naturally too
er, s:2nd/'$'/@/ 18:19
and ugly @@ can probably die
shower & 18:20
TimToady or maybe | is the opposite of flattening 18:21
sjohnson OT: anyone ever been super close to having their car towed, and saved it at the nick of time? 18:23
in*
hudnix no, but I once succeeded in getting my piece of crap car towed... 19:10
colomon RangeIterator is Iterator ! \o/ 19:13
ooo, and range-iterator.t runs now. nice. pmichaud++ 19:17
pmichaud jnthn: I'm thinking I'd still like all of an array's elements to share a common prophash. Any reason you can think that might not work? 19:22
pmichaud walks off to think for a while. 19:25
sjohnson hudnix: thanks for sharing 19:26
diakopter oops 19:39
supernovus If I make a container class using something like: class MyArray is Array { ... } shouldn't I be able to use it later by doing my @array is MyArray; ? 19:48
pmichaud yes 19:49
but 'is MyArray' is NYI in rakudo
supernovus Ah, okay, that explains the problem I was having... is there a way to force the container class without using 'is' that works in Rakudo currently? 19:50
pmichaud no
and I don't think there are tests for the behavior yet (hint hint)
you could potentially do my $array = MyArray.new(); 19:51
jnthn pmichaud: Sorry, was afk nomming...common prophash may well work.
pmichaud: What's gonna go in there?
pmichaud rw, mainly
jnthn OK
pmichaud any common type information
jnthn Just wanted to make sure you didn't expect type in th...d'oh. :-)
pmichaud: Type information comes through the role parameter. :-)
Though I guess you could cache it in the prophash... 19:52
pmichaud you mean on the array?
jnthn Yeah
@foo.of # what's the type constraint on my elements
pmichaud ultimately we end up doing !STORE on the element, and that's what's does the type check
*what
jnthn Right, agree.
pmichaud so if the element doesn't have type information on it, then there's no typecheck
it's okay for the type information to be in two places 19:53
and I'd be fine if the shared prophash simply had its 'type' property bound to the 'of' property of the Array 19:54
(or role, or whatever)
jnthn Yup, we could also do that.
The type info don't change once it's set anyway.
pmichaud well, it might. or we'll have to get a little fancier on type checks
but I suspect we'll have to do that anyway
jnthn Trying to change the type of things an already created and populated array accepts is Really Evil. :-) 19:55
pmichaud oh, it's not changing the type that would do it 19:56
my Int $b = 4; my Num @a; @a[0] := $b; @a[0] = 3.4;
pmichaud @a[0] ends up with two constraints at runtime 19:57
it has its own constraint (Num), as well as the constraint of the underlying thing it's bound to (Int)
jnthn oh, ouch.
But yes, true. 19:58
pmichaud so, we're not really "changing" the type of @a[0] -- we just have to know to check multiple types
because @a[0] can still be re-bound to something else
anyway, the type property for any individual container is effectively immutable, yes.
I'm also wondering if I can find a good way to identify container PMCs 19:59
including things that may objectref a container PMC 20:00
jnthn I think somewhere in S32 it aludes to a Container role or some such. 20:01
pmichaud well, I'd prefer it to be a "fast check" :-)
.ACCEPTS(Container) is likely to be unbearably slow
anyway, I'll try out the shared prophash shortly then. Glad you don't see any obvious blockers for that. 20:03
jnthn No, we'd discussed it before, and I don't remember having any objections - I just mostly cared about the types stuff, which I could do without a property on everything in a different way. 20:04
pmichaud I don't understand that last bit... but okay. :) 20:05
jnthn pmichaud: Yeah, that sentence was a tad fail... 20:06
pmichaud: I meant that because I did typed arrays using parametric role stuff, I didn't need to stick a property on everything. 20:07
pmichaud right
jnthn Now we care about doing More Other Stuff.
But I think we'd got to the point of agreeing it was workable before, I just didn't ever do it because I didn't need it. :-) 20:08
pmichaud I couldn't remember if we agreed it would work or not
plus, things could've happened in the interim to say "oh yeah, that won't work because... "
anyway, having a shared prophash will make things a ton easier on this end :-) 20:09
jnthn: can you think of any easy (and reasonably efficient) way to have objects of the Iterator class automatically receive a 'flatten' property? 20:13
maybe override the init_pmc vtable?
jnthn That would do it. 20:14
pmichaud if we override the init_pmc vtable, do we also have to make sure to somehow invoke the superclass' init_pmc ?
TimToady hmm, has to be able to happen halfway through a sig binding
jnthn pmichaud: What's the interface to create an iterator?
pmichaud or does that happen automatically somehow?
jnthn pmichaud: Probably, yeah, which is...ugh.
pmichaud: tbh I'd rather avoid relying too much on vtable overrides. 20:15
pmichaud that's fine, me also
any other way you can think of to optimize a check for "isa Iterator" or "does Iterator"?
or, alternatively, a way to optimize "doesn't Iterator" :-) 20:16
TimToady maybe the default is flat, and we have a getitem for positionals (that aren't in any repeating sig)
jnthn pmichaud: Perhaps some kinda caching scheme. 20:17
pmichaud: But I'd rather optimize those in general rather than special case this.
pmichaud jnthn: well, I strongly suspect that most things will be checked for flattening behavior only once
complete arrays and hashes being the exception 20:18
TimToady I think iterators should assume they're flattening unless specifically told otherwise, item by item
pmichaud TimToady: yes, that's not the difficulty
pmichaud the main thing that has to flatten is a Parcel 20:19
jnthn The hard bit is doing that check quickly.
Our isa is a bit slow... :-/
TimToady introspection is usually wrong 20:20
jnthn pmichaud: I'd say worry about correct semantics over going really fast for now on that part.
pmichaud but in general, it would be more useful if we could quickly know that something *doesn't* flatten
TimToady I'd say that Iterator *overrides* .get
and normal .get is identity
pmichaud well, that's a method call overhead 20:21
jnthn pmichaud: Hmm. Trouble is we're generlly more optimized for when a does check is gonna succeed.
TimToady you have method call overhead anyway
pmichaud (I'm fine with method call overhead for now)
TimToady why not use the existing mechanism?
presumably cached already too
pmichaud but more generally, it's possible that .get will give me back something that needs further flattening (in list context)
TimToady introspection is almost always a design smell 20:22
whether it's .isa or .arity
pmichaud so I still have to check whatever I .get to see if more flattening can occur
(I could check for identity.)
TimToady or looking at passive properties
pmichaud but checking .get for identity seems smelly also 20:23
TimToady some ideas are worth a bit in the data structure 20:24
pmichaud well, that's effectively what a property is
also, flattening/non-flattening has to be a property of the container, not just the object
jnthn gotta go for a bit - also something is very wrong with my net connection today and it keeps dropping. :-/ 20:26
back later
pmichaud ok, afk for a walk also
TimToady lunch, and thinking about how map's sig is actually in the variadic area of some implicit supersig 20:27
pmichaud brane hurts, going to bed 20:49
diakopter !
_ash pmichaud: i am sure your aware of this but on ng1 i get the following when i do @a.perl; 21:03
> my @a = [1, 2]; say @a.perl;
Method 'perl' not found for invocant of class 'ResizablePMCArray'
my @a = (1, 2); say @a.perl; works though
colomon _ash: ng1 actually fails the basic test for arrays (the one that "make test" runs) right now. 21:06
_ash ah, okay, i just wanted to make sure it was known a parrot object was leaking into perl6, thats all
colomon not a bad thought, at all. 21:08
I'm just warning you not to expect any Array-related code to work at the moment in ng1. 21:09
_ash although, my @a = [1, 2]; say @a.WHAT; returns Array
yeah
i figured as much
colomon ng: my @a = [1, 2]; say @a.perl 21:10
p6eval ng b8201f: OUTPUT«[[1, 2]]␤»
diakopter anyone around to commit a synopsis typo for me? 22:19
(no pugs checkout here) 22:20
in S02: undefined instance ofthat
oh, I guess I do have one on the p6eval vps
pmurias diakopter: i could do that, you could checkout just the synopses though 22:22
diakopter done
pugs_svn r29594 | diakopter++ | [S02] typo
diakopter anyone: the only interface to buf8/buf16/buf32 is the positional indexer? 23:01
also, how would one know whether a buf holds ints or uints? (referring to buf native buffer (finite seq of native ints or uints, no Unicode) 23:03
)
pmurias diakopter: shouldn't a unint buf be a different type? 23:05
diakopter pmurias: yes, but I don't see that defined/explained in S02 23:05
diakopter here's my assumption/inference: 23:09
buf of uint - buf32 of uint32 23:11
buf of int - buf32 of int32
buf8 of uint - buf8 of uint8
buf8 of int - ??
buf16 of uint - buf16 of uint16 23:12
etc.
does this mean you always must declare the item type of a native buf container? 23:13
or is there a default one?
(byte?)
diakopter pmurias: any thoughts? 23:16
diakopter or must you declare either 1) a number of bits per buf element, or 2) the element type? 23:19
diakopter how does one define the length of a buf one wants to initialize? 23:22
I'd be glad to write some tests to t/spec/S02-builtin_data_types/buf.t once I know how to write them 23:25
pmurias diakopter: the buf (withought a number takes the length from the string it's initialised with) 23:28
diakopter: buf16 of uint seems a bit confusing, as it might not be a buffer made of uints 23:30
diakopter ok, but how do you declare the length of a buf without an initializing string
I mean, I take it a buf is supposed to serve as the lowest level array of numbers (regardless of whether they're intended to represent strings/chars) 23:31
pmurias buffers are mutable? 23:33
diakopter: my buf16 $foo;$foo[30] = 5; 23:35
diakopter: i think the resize when needed
diakopter but 23:36
that's what I'm asking 23:37
it doesn't make sense to me if the length is mutable. 23:38
pmurias why shouldn't it be
diakopter I mean, I thought it was supposed to be a "compact array"
pmurias it is
diakopter but not necessarily laid out sequentially in memory?
pmurias normal arrays are laid sequentially in memory 23:39
diakopter I don't see "normal array" in these lists of native types
pmurias if you want to resize a buffer just alloc a new bigger chunk of memory and copy over the old stuff 23:40
diakopter are you saying the Perl 6 user should do that? or the Perl 6 engine behind the scenes? 23:41
pmurias the Perl 6 engine
diakopter ok. why wouldn't Array of <native type> be considered a native type?
pmurias because it's an Array 23:42
native types aren't a fully featured objects (so that some overhead is avoided) 23:43
diakopter that much I knew. 23:44
but your answer of "because it's an Array" doesn't answer the question 23:45
pmurias why doesn't it?
diakopter I knew it was an Array; I was asking what makes it an Array such that it's not a native type?
Tene pmurias: what behavior must "Array of int" support, such tha tit's "fully featured" in ways that would not work for a native type?
pmurias looks 23:46
diakopter and if it has anything, why isn't there a lower-level native type of a fixed-length array of native types?
diakopter and if Array is the lowest-level fixed-length vector, how then does one declare the length of the Array at initialization? 23:48
(without assigning it a Range uselessly, I guess)
pmurias: wait a second, Array's length is mutable 23:49
why did you say it's immutable
pmurias diakopter: did i? maybe it's too late for me to speak sensibly 23:50
diakopter hm. maybe you didn't. perhaps I wrongly inferred you implying that. 23:51
(from when you said "normal arrays are laid out sequentially in memory") 23:52
pmurias Tene: you can mix in things with does? you can store undefined values in a thing of Array type 23:52
diakopter I don't see how an Array can be laid out sequentially in memory if its length is mutable.
that's just impossible. 23:53
pmurias how do you imagine it being implemented?
diakopter what do you mean by "it"
pmurias an Array that's not sequentially laid out in memory
diakopter I didn't say I was imagining that. 23:54
pmurias diakopter: when you resize an Array it allocates an new block of memory and copies over the old data 23:55
diakopter that's fine
but that has nothing to do with what I'm asking for
pmurias diakopter: you stated that's impossible
diakopter I'm asking for something that does Positional with a fixed-length
once initialized.
and fixed item size.
(a native type) 23:56
or struct.
I assumed that was buf
pmurias: I did not say that was impossible. 23:57
pmurias diakopter: "That's just impossible." 23:58
diakopter your "that" is different from my "that" 23:58
pmurias my int16 @array[100]; 23:59