Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2008-09-02

Perl 6 | Reference Documentation | Rakudo

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

All times shown according to UTC.

Time Nick Message
00:00 ruoso my $a = map { } behaves differently then my @a = map { }
00:00 TimToady it only behaves differently if you depend on side effects
00:00 TimToady which is naughty :)
00:01 ruoso and how am I supposed to know if I depend on side effects?
00:02 speckbot r14578 | larry++ | added Rat type to list of immutables, mbiggar++
00:02 TimToady because either you wrote the code you're calling, or it's documenting in the API
00:03 TimToady a function that returns Void is a pretty good clue that it has side effects too :)
00:04 ruoso I didn't mean myself in the "I", but the interpreter...
00:06 pugs_svn r22092 | ruoso++ | [smop] adding postfix:<++> to native int
00:06 ruoso how is it going to decide when something in the map block has side effects?
00:09 TimToady some of it could be via declaration, and some of it could be by propagating that info upwards into the linkage info
00:09 TimToady it's not possible to decide completely, of course
00:09 ruoso you know that there isn't a way to have that in any reliable way, don't you...
00:10 TimToady for "Useless use" warnings 95% is good enough
00:10 TimToady it's mostly a matter of training people to think about it
00:11 * ruoso would rather promote laziness on everything
00:11 ruoso although "void == eager" is acceptable
00:11 TimToady well, algol tried call-by-name and found it wanting...
00:12 TimToady I think lazy scalars would be the same mistake
00:12 TimToady it's enough to be able to treat a lazy object as a scalar when you want one
00:14 TimToady I think lazy scalars are a lot more confusing to mortals than lazy lists are
00:14 TimToady and perl already has the fundamental scalar/list distinction, so it maps fairly naturally, most of the time
00:14 ruoso the point is that lists can be stored in variables with the '$' sigil with no loss
00:15 TimToady and where it doesn't, we force it. :)
00:15 ruoso and we don't even need the "de-referencing" anymore..
00:16 ruoso my feeling is that the sigil lost a lot of its power in p6... and having that kind of decision attached to it seems awkward...
00:17 ruoso the scalar/list distinction is much less "fundamental" in p6
00:17 ruoso we can easily have something that behaves as scalar, list and hash...
00:17 ruoso at the same time
00:17 ruoso we even take advantage on that for some built-in types (Capture and Match)
00:19 TimToady well, the singular/plural distinction is awkward in English too, but I live with it.  :)
00:24 ruoso TimToady, are you aware on how I am implementing context propagation in SMOP/
00:24 ruoso ?
00:26 dduncan question ... is there supposed to be a distinct Float type as there is a distinct Rat type, or does Num really just mean anything a float can represent?
00:28 TimToady dduncan: there is no Float type
00:28 dduncan note that in my mind, floating point is just a syntax for specifying a rational number, if the numbers are radix agnostic and unlimited precision
00:28 dduncan okay
00:28 TimToady ruoso: vaguely, but I can't track every detail...
00:29 TimToady returning a smart return value has its limits when you have to clone a bunch of closures you're unlikely to use
00:30 TimToady (depending on how expensive the clone is, which I'm sure varies from VM to VM)
00:30 ruoso but why would I need to eagerly clone the closures?
00:30 bacek joined #perl6
00:30 allbery_b I was wheezier than usual all last week; maybe it's something in the air
00:30 allbery_b whoops
00:30 s1n joined #perl6
00:30 allbery_b how'd I end up here?
00:31 meppl good night
00:34 TimToady ruoso: I dunno, I didn't write everyone's VM.  Maybe they wanted to take pressure off the GC by not leaving a lot of pointers outstanding, or something...
00:36 TimToady or maybe there are favoriable cache characteristics if we batch the examination of the lexical context
00:36 TimToady *favorable
00:37 ruoso TimToady, btw.. I do plan to have "forward propagation" of the context... I just wanted to keep that to be implemented as a later optimization... but conceptually, it would be implemented as late method calls requesting specific contexts...
00:37 TimToady anyway, there's usually some balance between declarative optimizations and lazy optimizations
00:37 TimToady it seems a bit odd to delay declarative optimizations till run time
00:38 TimToady but if you're thinking the compiler's run time...
00:38 TimToady anyway, I'm not willing to make the decision on that tradeoff for the implementor
00:40 ruoso TimToady, we could consider the return type as part of the signature for a multi...
00:40 ruoso the only thing I'm trying to do, actually, is to keep the invocation as simple as possible...
00:40 TimToady that tends to produce time paradoxes though
00:41 ruoso and that's why I'm avoiding "forward propagation of the context" at this time
00:41 ruoso so the concept keeps itself simpler
00:42 ruoso because the runtime will always enforce all contexts
00:42 ruoso by doing the appropriate method calls
00:43 ruoso I see "forward propagation" as an optimization because it would require some coordination between the caller and the called code to find out when no coercion is needed...
00:46 ruoso TimToady, about time paradoxes... return type in the signature could be used for contexts that could be detected at compile-time...
00:47 ruoso and they could also be used by JIT compilers...
00:47 eternaleye joined #perl6
00:48 TimToady well, sure, this is conjectured somewhere in S12, but it's another thing that could get in the way of getting 6.0 out, so I'm not inclined to insist on it
00:49 ruoso but anyway... we lost ourselves in the point I was trying to clarify
00:50 ruoso if the runtime cannot infer side effects, should it consider my $a = map { } lazy?
00:51 TimToady I don't think so; it knows at compile time that it will be coercing a list into item context, and I think that is eager
00:52 ruoso even if a list in item context simply returns itself...
00:52 ruoso pugs: my @a = (1,2,3); my $b = @a; say $b;
00:52 p6eval pugs: OUTPUT[1 2 3␤]
00:52 TimToady it's specced to turn into an array :)
00:53 ruoso does that mean that it should rebuild any list into a new array?
00:54 wknight8111 if that's the case, why would we need the @ sigil at all?
00:54 wknight8111 if $b = @a, and then $b is an array
00:55 TimToady @$a = map { } stays lazy
00:55 lambdabot Maybe you meant: . ? @ bf faq ft id map pl rc v wn
00:56 ruoso pugs: my @a = (1,2,3); my $b = @a; say @a.WHICH, $b.WHICH;
00:56 p6eval pugs: OUTPUT[123123␤]
00:56 ruoso pugs: my @a = (1,2,3); my $b = @a; say @a.WHERE, $b.WHERE;
00:56 p6eval pugs: OUTPUT[*** No such method in class Array: "&WHERE"␤    at /tmp/oSvShCREjz line 1, column 34-42␤]
00:57 ruoso so my $b = @a creates a copy ?
00:58 TimToady probably not
00:58 TimToady since coerction to array would be a noop
00:59 TimToady it's certainly possible that coercion to item context stays lazy in this case, and it's void context that is specially eager
01:00 ruoso that looks saner to me...
01:00 ruoso void being special is interesting because use of a list in void context is a clear symptom of imperative programming...
01:00 TimToady doesn't really bother me if a listish container inside a scalar is lazy
01:01 TimToady I think I'm fine with that, but consider I'm still rather jet-lagged... :)
01:04 ruoso cool... so "for" is simply a "map".... and lists in void context are eager...
01:04 ruoso and that's all
01:05 ruoso it's important to realize that...
01:06 ruoso sub foo { for 1..10 { say $_ } }; my $x = foo(); say 'not yet...'; $x; say 'thats it...'
01:07 ruoso would print 'not yet' before each of the numbers...
01:08 ruoso perl6: sub foo { for 1..10 { say $_ } }; my $x = foo(); say 'not yet...'; $x; say 'thats it...'
01:08 p6eval pugs, rakudo 30694: OUTPUT[1␤2␤3␤4␤5␤6␤7␤8␤9␤10␤not yet...␤thats it...␤]
01:08 p6eval ..elf 22092: OUTPUT[Useless use of private variable in void context at (eval 127) line 8.␤1␤2␤3␤4␤5␤6␤7␤8␤9␤10␤not yet...␤thats it...␤]
01:09 ruoso and that possible return is in the specs...
01:09 ruoso and if "for" is simply a "map" and it's lazy... "not yet" would appear first....
01:12 speckbot r14579 | larry++ | clarify that statement introducers may not use function syntax, which is
01:13 speckbot r14579 | larry++ |     reserved for user functions of the same name
01:16 TimToady yes, and "eager for" would print them first, and "hyper for" would print them in random order
01:16 ruoso cool
01:17 * ruoso sleep & (not that I'm really awake...)
01:17 TimToady dinner &
01:19 kanru joined #perl6
01:22 kanru joined #perl6
01:22 Limbic_Region joined #perl6
01:23 s1n moritz_: is the pugs suite being moved with an svn move or are the files being added as dups under the spec folder?
01:23 Limbic_Region I think the former
01:23 Limbic_Region salutations all
01:24 s1n if they're being copied, is there any indication a file or test has been copied over?
01:35 ting joined #perl6
01:49 ludan joined #perl6
02:27 hercynium joined #perl6
02:45 Auzon joined #perl6
02:53 s1n rakudo: $ref = ("foo", "bar"); say $ref.WHAT;
02:53 p6eval rakudo 30694: OUTPUT[Scope not found for PAST::Var '$ref'␤current instr.: 'parrot;PCT::HLLCompiler;panic' pc 156 (src/PCT/HLLCompiler.pir:103)␤]
02:54 s1n rakudo: my $ref = ("foo", "bar"); say $ref.WHAT;
02:54 p6eval rakudo 30694: OUTPUT[Array␤]
03:03 BinGOs_ joined #perl6
03:40 BinGOs joined #perl6
03:59 Alias_ joined #perl6
04:01 justatheory joined #perl6
04:02 audreyt joined #perl6
04:07 jiing joined #perl6
04:24 xuser left #perl6
04:34 Guest70230 joined #perl6
05:15 alester joined #perl6
05:19 Psyche^ joined #perl6
05:33 penk joined #perl6
06:04 fullermd joined #perl6
06:19 ashizawa joined #perl6
06:25 pmurias joined #perl6
06:35 pmurias TimToady: we always know the context of a subcall? is it possible to use a context stored in a variable something like my $context = get_the_context();use_the_context($context,foo(...))?
06:35 pmurias s/we/do we/
06:38 Front_slash joined #perl6
06:42 moritz_ s1n: moved with 'svn mv'
06:56 pugs_svn r22093 | lwall++ | [t] more system, require, does, defer, label cleanup
06:56 dduncan left #perl6
07:02 BinGOs joined #perl6
07:10 zamolxes joined #perl6
07:16 cosimo joined #perl6
07:31 iblechbot joined #perl6
08:12 elmex joined #perl6
08:25 lambdabot joined #perl6
09:01 meteorjay joined #perl6
09:35 meteorjay joined #perl6
09:37 masak joined #perl6
09:39 scrottie joined #perl6
09:56 pugs_svn r22094 | moritz++ | [t]
09:56 pugs_svn r22094 | moritz++ |  * update TASKS
09:56 pugs_svn r22094 | moritz++ |  * moved operators/smartmatch.t to spec/
10:06 pugs_svn r22095 | moritz++ | [t/spec] fudged not.t for rakudo
10:18 pugs_svn r22096 | moritz++ | [t/spec] smartmatcht.t: removed tests for deprecated features, fudged for
10:18 pugs_svn r22096 | moritz++ | rakudo
10:20 pugs_svn r22097 | moritz++ | [t] move operators/brainos.t to spec/
10:27 moritz_ operators/listquote.t has some freaky syntax
10:27 moritz_ my $s = join |<< <a x y z>;
10:29 moritz_ why isn't that just 'join |<a x y z>'?
10:43 Juerd What the heck is |<<? :)
10:43 moritz_ it's prefix:<|> prefix_postfix_meta_operator:« << »
10:43 moritz_ prefix:<|> intpolates arrays and hashes into captures
10:43 Juerd What's prefix |?
10:43 Juerd I see
10:44 * moritz_ had to run STD.pm to identify that
10:44 Juerd Wasn't that * at some point?
10:44 moritz_ dunno, * is Whatever now
10:45 Juerd Right
10:46 Juerd It used to be nicknamed splat
10:58 sri_work_ joined #perl6
11:16 tessier_ joined #perl6
11:31 masak joined #perl6
11:32 masak @tell jonathan Welcome back from vacation. I would very much like to discuss #58392 with you when you have the time.
11:33 lambdabot Consider it noted.
11:41 zamolxes joined #perl6
12:15 rindolf joined #perl6
12:21 Lichtkind joined #perl6
12:31 ruoso joined #perl6
12:57 alanhaggai joined #Perl6
13:01 p6eval joined #perl6
13:02 moritz_ pugs: say "test"
13:02 p6eval pugs: OUTPUT[test␤]
13:04 pugs_svn joined #perl6
13:06 rakudo_svn joined #perl6
13:06 rakudo_svn r28699 | pmichaud++ | [rakudo]:
13:06 rakudo_svn r28699 | pmichaud++ | * Add workarounds for argument checking of 0-ary functions (RT#56366).
13:06 rakudo_svn r28703 | pmichaud++ | [rakudo]:
13:06 rakudo_svn r28703 | pmichaud++ | * Add .pick methods and functions.
13:06 rakudo_svn r28703 | pmichaud++ | * Add .elems methods and functions to Any.
13:06 rakudo_svn r28703 | pmichaud++ | * Resolves RT#56266 and RT#49085.
13:06 rakudo_svn r28704 | petdance++ | adding some type sanity
13:06 rakudo_svn r28705 | pmichaud++ | [rakudo]:
13:06 moritz_ sorry, that was old news :/
13:07 rakudo_svn joined #perl6
13:10 frobnitz joined #perl6
13:10 speckbot joined #perl6
13:10 moritz_ ok, after rebooting the server I started p6eval, speckbot, rakudo_svn and pugs_svn again
13:11 moritz_ anything crucial that I forgot?
13:17 jhorwitz joined #perl6
13:34 xinming joined #perl6
13:40 xinming_ joined #perl6
13:46 penk left #perl6
13:53 clintongormley joined #perl6
13:58 clintongormley joined #perl6
13:58 clintongormley left #perl6
14:05 kanru joined #perl6
14:35 moritz_ rakudo: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl
14:35 nwc10 joined #perl6
14:36 moritz_ pugs: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl
14:36 nwc10 I realise that I asked this question some months ago, but I fail to remember the answer - where is S3 in svn?
14:36 moritz_ evalbot control restart
14:36 [particle]1 what is s3?
14:36 [particle]1 oh, S03?
14:36 nwc10 er, yes
14:37 nwc10 synopsis 3
14:37 nwc10 ah. http://svn.perl.org/perl6/doc/trunk/design/syn/S06.pod
14:37 [particle]1 http://svn.perl.org/perl6
14:37 lambdabot Title: Revision 14579: /
14:37 nwc10 so is there a svnweb for that?
14:37 nwc10 to annotate it?
14:38 moritz_ you shouldn't
14:38 [particle] not that i know of
14:38 moritz_ send patches to p6l
14:38 p6eval joined #perl6
14:39 moritz_ pugs: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl
14:39 p6eval pugs: OUTPUT[*** Odd number of elements found where hash expected: VList [VStr "a",VRef <Array:0xb5e9c541>]␤    at /tmp/lITpBp5aY3 line 1, column 1-32␤]
14:39 moritz_ rakudo: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl
14:39 p6eval rakudo 30696: OUTPUT[[1, 2, 3, 4]␤]
14:39 moritz_ overly eager list flattening
14:40 moritz_ elf: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl
14:40 p6eval elf 22097: OUTPUT[[[1,2],[3,4]]␤]
14:40 moritz_ elf++
14:42 moritz_ which prevents rakudo from running rounders.t
14:46 nwc10 seems there is soemthing: http://svn.perl.org/viewvc/perl6/doc/trunk/design/syn/S03.pod?r1=7615&amp;r2=14556
14:46 lambdabot Title: 1 [ 5 perl6 1 ] 1 25 Diff of /doc/trunk/design/syn/S03.pod 30, http://tinyurl.com/5dggcx
14:51 nwc10 left #perl6
14:52 jferrero joined #perl6
14:58 pugs_svn r22098 | moritz++ | [t/spec] corrected rounders.t; fudged for rakudo (ugly mess)
14:58 pugs_svn r22098 | moritz++ | simplified brainos.t a bit
14:58 rakudo_svn joined #perl6
14:59 rakudo_svn r23021 | bernhard++ | Set properties for newly added files.
14:59 rakudo_svn r23165 | pmichaud++ | [perl6]:
14:59 rakudo_svn r23165 | pmichaud++ | * Correct location of nqp in ROADMAP document (robwest++)
14:59 rakudo_svn r23260 | coke++ | [perl6] remove integer type IDs
14:59 rakudo_svn r23371 | coke++ | [perl6] RT #48024 : use new_p_s
14:59 rakudo_svn r23464 | pmichaud++ | [perl6]:
14:59 rakudo_svn r23464 | pmichaud++ | * Merging perl6-devel into trunk.  The perl6 compiler still fails quite
14:59 moritz_ sorry
14:59 moritz_ bot gone wrong
14:59 * moritz_ tries again
14:59 rakudo_svn joined #perl6
15:03 rakudo_svn r30698 | moritz++ | [rakudo] add two files to spectest_regression
15:17 eternaleye joined #perl6
15:20 Exodist joined #perl6
15:35 tessier_ joined #perl6
15:43 kanru joined #perl6
15:53 justatheory joined #perl6
15:57 BinGOs_ joined #perl6
15:58 BinGOs_ joined #perl6
16:07 lisppaste3 joined #perl6
16:27 lisppaste3 joined #perl6
16:33 hercynium joined #perl6
16:59 pugs_svn r22099 | moritz++ | [t/spec] moved operators/identity.t to spec/
17:05 Jedai joined #perl6
17:05 pugs_svn r22100 | moritz++ | [t] removed operators/relational.t, which is mostly integrated into
17:05 pugs_svn r22100 | moritz++ | spec/S03-operators/relationial.t. migrated the rest over there
17:13 pugs_svn r22101 | moritz++ | [t] simpliefied tests a bit, removed duplicate tests
17:16 pugs_svn r22102 | moritz++ | [t] tests for autoincrementing uninitialized variables
17:19 pugs_svn r22103 | moritz++ | [t] move context_forcers.t to spec/
17:19 pugs_svn r22104 | moritz++ | [spec] s/_/-/ in file name
17:22 pugs_svn r22105 | moritz++ | [t/spec] fudge context-forcers.t for rakudo
17:27 scrottie left #perl6
17:28 pugs_svn r22106 | moritz++ | [t] moved operator precedence tests to spec/
17:35 armagad joined #perl6
17:39 pugs_svn r22107 | moritz++ | [t/spec] fudged precedence.t for rakudo (over-eager fudge due to fudge bugs)
17:45 REPLeffect joined #perl6
17:51 rakudo_svn r30701 | moritz++ | [rakudo] add two files to spectest_regression
17:53 pugs_svn r22108 | moritz++ | [t] moved scalar binding tests to spec/
17:58 pugs_svn r22109 | moritz++ | [t/spec] some fudgings
17:58 pugs_svn r22110 | lwall++ | [STD] typo on defer token
18:10 pugs_svn r22111 | moritz++ | [t] move junction tests to spec/, make them not rely on the internal ordering
18:15 * ruoso just heard about prophet... obra++ clkao++ ;)
18:17 rindolf clkao-- - won't fix svk.
18:18 rindolf Or help me with a major svk problem.
18:18 moritz_ should I start to give negative karma to everybody who doesn't help with my work on the test suite?
18:19 * Khisanth wonders if rindolf is related to BKB
18:19 rindolf Khisanth: I'm not BKB.
18:19 rindolf moritz_: svk is unusable on my system.
18:19 moritz_ rindolf: so is Perl 6 on mine
18:20 rindolf moritz_: and I have my homepage there.
18:20 rindolf moritz_: so what depends on Perl 6 now?
18:20 rindolf I'm using svk for production.
18:20 Khisanth moritz_: yes! perhaps they will reincarnate as one of your minions that will be easier to control :)
18:20 moritz_ rindolf: easy coding and a good release of perl depend on Perl 6
18:20 * moritz_ is not impressed by the "production" meme
18:21 moritz_ Khisanth: they don't have to be easy to control, just easy to motivate ;)
18:21 Khisanth minions do not require motivation
18:22 moritz_ ;)
18:22 rindolf moritz_: I have reported the bug a few weeks ago and heard nothing from clkao.
18:22 rindolf moritz_: and someone reported a similar problem earlier.
18:22 rindolf moritz_: I asked him that on IRC.
18:22 rindolf moritz_: and then I posted it on the svk mailing list.
18:22 moritz_ rindolf: well, Perl 6 was announce 8 years ago, and we still have no release
18:22 rindolf moritz_: so? It can wait.
18:22 Khisanth was it only 8?
18:23 rindolf Or it's not that critical for our well-being.
18:23 [particle] please take your frustrations out in #bang-head-here
18:23 moritz_ can it? then so can your svk bug
18:23 moritz_ rindolf: in case you haven't noticed, you're off-topic here with your rants
18:23 rindolf moritz_: ah.
18:23 TimToady in any event, you should not personalize it
18:24 rakudo_svn r30708 | moritz++ | [rakudo] add binding tests to spectest_regression
18:25 pugs_svn r22112 | moritz++ | [t] moved hash binding tests to spec/
18:27 Chillance joined #perl6
18:29 pugs_svn r22113 | moritz++ | [t/spec] fudged hash binding tests for rakudo
18:31 pugs_svn r22114 | ruoso++ | [smop] update the "for" test to be a "map" test, and also tests the lazyness of the map return
18:32 pugs_svn r22115 | moritz++ | [t/spec] moved array binding tests to spec/
18:35 pugs_svn r22116 | ruoso++ | [smop] updating CMakeLists.txt for the new test
18:36 ruoso pugs: my @a = map { say $_ } 1..10; say @a[0]; # no numbers above "1" should be seen
18:36 p6eval pugs: OUTPUT[*** ␤    Unexpected "1"␤    expecting ",", ":" or operator␤    at /tmp/lPm0i26xnE line 1, column 24␤]
18:37 ruoso pugs: my @a = map { say $_ } 1 .. 10; say @a[0]; # no numbers above "1" should be seen
18:37 p6eval pugs: OUTPUT[*** ␤    Unexpected "1"␤    expecting ",", ":" or operator␤    at /tmp/IUgPrgwobN line 1, column 24␤]
18:37 ruoso pugs: my @a = map { say $_ } (1, 2, 3, 4); say @a[0]; # no numbers above "1" should be seen
18:37 p6eval pugs: OUTPUT[*** ␤    Unexpected "("␤    expecting ",", ":" or operator␤    at /tmp/6BsfzgwdMN line 1, column 24␤]
18:38 ruoso pugs: my @a = map { say $_ }, (1, 2, 3, 4); say @a[0]; # no numbers above "1" should be seen
18:38 p6eval pugs: OUTPUT[1␤2␤3␤4␤1␤]
18:38 moritz_ ruoso: pugs doesn't to lazyness yet
18:39 ruoso hmm...
18:39 ruoso ok
18:39 moritz_ s/to/do
18:42 * ruoso wonders what "my @a = map { }; say @a.WHAT" should output
18:43 zamolxes joined #perl6
18:44 pugs_svn r22117 | moritz++ | [t/spec] really fudged array binding tests for rakudo
18:44 moritz_ List?
18:44 [particle] isn't that map missing a param?
18:46 ruoso [particle], yeah yeah... it's just a conceptual exercise...
18:46 ruoso not real code ;)
18:48 rakudo_svn r30711 | moritz++ | [rakudo] two more binding tests for spectest_regression
18:56 TimToady pugs: my @a = map { }; say @a.WHAT
18:56 p6eval pugs: OUTPUT[*** Cannot cast from VList [] to Pugs.AST.Types.VCode (VCode)␤    at /tmp/Px0RY5FZnM line 1, column 9-16␤]
18:57 TimToady pugs: my @a = map { }, (); say @a.WHAT
18:57 p6eval pugs: OUTPUT[*** Cannot cast from VList [] to Pugs.AST.Types.VCode (VCode)␤    at /tmp/XaPKFtdEsj line 1, column 9-20␤]
18:57 TimToady pugs: my @a = map { 42 }, (); say @a.WHAT
18:57 p6eval pugs: OUTPUT[Array␤]
18:57 [particle] rakudo: my @a = map { }, (); say @a.WHAT
18:57 p6eval rakudo 30711: OUTPUT[No applicable methods.␤␤current instr.: '_block11' pc 42 (EVAL_13:15)␤]
18:57 TimToady pugs: my @a = map { ; }; say @a.WHAT
18:57 p6eval pugs: OUTPUT[Array␤]
18:57 [particle] rakudo: my @a = map { 42 }, (); say @a.WHAT
18:57 p6eval rakudo 30711: OUTPUT[Array␤]
18:57 TimToady Array is correct
18:58 TimToady regardless of how lazy its internal interators may be
18:58 TimToady now if you'd bound something to @a instead of assigning, you can get a different answer
18:59 * ruoso keeps getting back to the "iterator API" issue
19:00 ruoso I cannot use @originalarray.elems to figure out the size of the array, because that would force eagerly evaluation...
19:00 TimToady well, unless the interators involved know how to calculate their length without evaluation
19:01 ruoso which is not the case for a map, usually
19:01 TimToady 1..100 knows how long it is
19:01 ruoso or a grep
19:01 TimToady correct
19:01 ruoso Ideally... I should have an API that allows unordered arrays...
19:02 TimToady but asking for the length is an error of the same sort as asking whether you're at end-of-file, or wanting to write a loop (;;) when you should use for
19:02 ruoso TimToady, I'm implementing "for" actually...
19:02 ruoso and "for" need to know when the input is over
19:03 TimToady it's over when you've exhausted your iterators and they return "I'm exhausted, dear, not tonight" errors
19:03 moritz_ so it thrown an exception when it's exhausted?
19:03 ruoso and what if we have a list of failures?
19:04 TimToady you're looking for that particular failure
19:04 ruoso so that particular failure may never be part of an array
19:05 TimToady something has to be out-of-band sometime
19:05 ruoso TimToady, java solves that by using "has_next"
19:05 TimToady and maybe the iterator object has some out-of-band way of indicating that it was a hard fail
19:06 TimToady has_next is really just "eof" in disguise, which I tend to despise
19:06 TimToady in general you get cleaner semantics by just trying and failing
19:07 TimToady so maybe an interface that returns 0 or 1 elements, and 0 indicates failure
19:07 ruoso considering I don't have an exception mechanism in place... may I start with the out-of-band way?
19:07 TimToady that's how a lot of STD works
19:08 ruoso hmmm
19:08 ruoso that's a cool solution, actually
19:08 TimToady ratchet mode always returns 0 or 1 list elements
19:08 TimToady non-ratchet can return more than 1
19:09 ruoso prefix:<=> returns a List... where an empty list means the iterator is exhausted..
19:09 ruoso but it should be a special list... that returns the first element or failure in scalar context
19:10 [particle] like when dbi's fetchrow_arrayref returns undef, you know you have a problem
19:10 [particle] that's not an arrayref with undef inside, so it's not valid data
19:11 ruoso yeah...
19:11 TimToady but we don't officially have references :)
19:11 [particle] mjd talks about that in HOP
19:11 [particle] in the iterators chapter
19:12 ruoso TimToady, I think that's why [particle] used 'like'
19:12 ruoso ;)
19:12 [particle] indeed
19:12 TimToady now if he'd just use "and stuff" as well, we could mistake him for a Californian
19:14 TimToady lunch &
19:14 ruoso but there's still one thing that doesn't feel right...
19:14 ruoso =@foo seems to imply that @foo keeps an internal iterator state...
19:15 ruoso having the iterator externalized looks more natural to me...
19:15 TimToady I suspect = on an array is just a synonym for shift
19:15 TimToady since that's how an array keeps track of its state
19:15 TimToady lunch really &
19:16 moritz_ that's what one of the tests also say
19:16 moritz_ (that prefix:<=> invokes .shift)
19:16 [particle] ooh, lunch. good idea
19:16 ruoso alright... so prefix:<=> not only iterates, but actually "consumes"
19:18 moritz_ that's what you usually want when your iterate over =$handle
19:18 moritz_ otehrwise you'd have to keep the whole file in memory
19:20 larsen_ joined #perl6
19:21 ruoso so... since map receives an array as argument, it's sane to think that it can actually consume the incoming array using shift....
19:21 ruoso which makes me wonder... is Range mutable?
19:22 moritz_ don't think so, but you don't iterate over a Range with prefix:<=>
19:22 ruoso pugs: say (1 .. 10).shift;
19:22 p6eval pugs: OUTPUT[*** Can't modify constant item: VUndef␤    at /tmp/ZnXti9cXtS line 1, column 5-20␤]
19:22 ruoso pugs: say (1..10).shift;
19:22 p6eval pugs: OUTPUT[*** Can't modify constant item: VUndef␤    at /tmp/nfG9SOt8Co line 1, column 5-18␤]
19:22 moritz_ I think you can just index a Range with .[]
19:23 ruoso moritz_, that brings me to the map problem again
19:23 [particle] Range is consumed as you go
19:23 ruoso so... map can "shift" the Range...
19:24 [particle] but it remembers it's original parameters
19:24 [particle] so you can query as to what the ends were
19:24 ruoso alright...
19:24 [particle] yes, i believe map can shift Range
19:25 ruoso so.... map works by shifting the input array and passing the value to the code in each iteration...
19:26 ruoso (shifting as many times as needed, according to the code's signature .arity)
19:26 ruoso is everyone ok with that? ;)
19:27 moritz_ ruoso: but at least one, even if .arity is 0 ;)
19:27 [particle] looks good to me
19:27 ruoso although it's pretty weird to think that map would modify the input array....
19:28 ruoso pugs: my @a = 1..10; my @b = map { $_ + 1 } @a; my @c = map { $_ + 2 } @a; say @c;
19:28 p6eval pugs: OUTPUT[*** ␤    Unexpected "@a"␤    expecting ",", ":" or operator␤    at /tmp/OXhhkGEviO line 1, column 39␤]
19:28 ruoso pugs: my @a = (1..10); my @b = map { $_ + 1 }, @a; my @c = map { $_ + 2 }, @a; say @c;
19:28 p6eval pugs: OUTPUT[3456789101112␤]
19:28 silug joined #perl6
19:28 moritz_ ruoso: what would you 'map { .say } =$handle' expect to do? not consume the $handle?
19:28 moritz_ that seems pretty nonsensical as well
19:29 ruoso but then you have the explicit "=$handle", which indicates that the input will be consumed
19:30 moritz_ well, map { .say } @array is not allowed to destroy @array, I'm pretty sure of that
19:30 ruoso so... map cannot shift...
19:31 moritz_ it can shift on its argument list
19:33 dr_df0 joined #perl6
19:33 ruoso moritz_, that doesn't answer the question on how to make that preserving the laziness of the input array
19:34 dr_df0 moritz_: hi
19:34 lambdabot dr_df0: You have 1 new message. '/msg lambdabot @messages' to read it.
19:34 moritz_ hi dr_df0 ;)
19:34 dr_df0 moritz_: how to read my messages?
19:34 moritz_ lambdabot tells you
19:34 moritz_ '/msg lambdabot @messages'  to read it.
19:35 moritz_ ruoso: well, it indexes the array... wihch doesn't help you because you can't know when it's over
19:36 ruoso and we keep getting back to index-based access to the array...
19:36 ruoso which makes the use of cursors harder...
19:37 ruoso maybe map should enforce "Iterator" context which then can be "consumed" by map...
19:38 ruoso that might help because each object can return a specialized iterator
19:39 ruoso and then the iterator implements prefix:<=>
19:40 ruoso for instance... the Range Iterator knows where to start and when to stop by looking at the ends of the Range
19:40 ruoso an Array Iterator knows that it starts at 0 and end at .elems
19:42 ruoso a Map Iterator (the one used when cascading maps and greps) only notices the end when the input iterator returns an empty list from prefix:<=>
19:47 fullermd joined #perl6
19:48 * ruoso . o O ( bootstrapping a lazy type system is pretty hard )
19:56 Auzon joined #perl6
20:01 donaldh joined #perl6
20:04 alester joined #perl6
20:15 donaldh joined #perl6
20:37 TimToady list context doesn't just iterate objects.  it constructs a list of iterators, asking each object to return one.  an array generates a non-destructing iterator, while a filehandle just returns itself to be destroyed
20:38 TimToady I think Range objects are more like arrays in returning a separate destructable iterator, preserving the original
20:40 TimToady note that scalar variables never return an iterator, but install their values directly into the resulting list
20:40 TimToady commuting &
21:06 BinGOs joined #perl6
21:30 pugs_svn r22118 | moritz++ | [t] moved tests for let and temp to spec/
21:36 pugs_svn r22119 | moritz++ | [t] move misc operator tests to spec/
21:42 rakudo_svn r30714 | moritz++ | [rakudo] more operator tests for spectest_regression
21:45 pugs_svn r22120 | moritz++ | [t] move tests for spaceship operator to spec/
21:50 [particle] moritz++ # impressive test conversion velocity
21:52 moritz_ [particle]: I think we *really* need PIR level coverage analysis
21:52 [particle] yes, we do. it's not easy yet, though.
21:52 moritz_ stuff like RT #58500 would be so much easier to catch
21:53 rakudo_svn r30716 | moritz++ | [rakudo] one more test for spectest_regression, and re-arrange alphabetically
21:55 moritz_ we need to decide where to put complexity/regression tests
21:58 [particle] outside t/spec/, likely
21:59 moritz_ that's not good wrt "everything that passes the test suite is Perl 6"
21:59 moritz_ for example that recursion+for bug that masak++ reported the other day...
22:00 moritz_ I think that's really something that the test suite should catch
22:00 moritz_ and I as a tester don't even know where to put recursion tests
22:01 moritz_ not to talk about bugs that only occur when several features interact, and I can't identify which one is wrong (or maybe they are all wrong?)
22:03 StephenPollei http://svn.perl.org/perl6/doc/trunk/design/syn/S01.pod Overview maybe?
22:04 [particle] i suggest regression tests live in t/regression/
22:04 [particle] t/spec/ should be reserved for spec coverage
22:05 [particle] we can expand the meaning of "official test suite" to include all of t/ once it's been refactored properly
22:05 idemal joined #perl6
22:05 [particle] also t/integration/ makes sense for complex examples
22:06 moritz_ I think it makes things easier if it lives under spec/ for now
22:06 moritz_ but we can later moved that away again
22:07 StephenPollei I like t/integration better than t/regression for something that is part of "official test suite" not tied to any particulat implementation
22:07 [particle] ok, that's fine. does t/spec/integration/ work?
22:07 moritz_ yes
22:07 [particle] there is room under t/spec/ for non-S\d\d directories
22:07 moritz_ aye
22:08 [particle] in fact, i like that better
22:08 [particle] that allows implementations to keep their tests under t/ directly if they want
22:08 [particle] the only reserved directory name is spec/
22:09 moritz_ yes
22:10 [particle] bike ride &
22:10 moritz_ sleep &
22:23 explorer__ joined #perl6
23:18 tessier_ left #perl6
23:24 cathya joined #perl6
23:41 Khisanth joined #perl6
23:45 meppl joined #perl6
23:59 ruoso joined #perl6

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

Perl 6 | Reference Documentation | Rakudo