pugscode.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, elf: etc.) (or perl6: for all) | irclog: irc.pugscode.org/
Set by Tene on 29 July 2008.
00:00 pbuetow left 00:01 KidShenck left, ZuLuuuuuu left 00:02 pedrob joined 00:09 Limbic_Region joined 00:13 fleebailey3 is now known as fleebailey33 00:16 fleebailey33 left 00:25 Exodist left 00:33 hercynium left 00:35 eternaleye joined 00:39 pedrob left 01:03 smg joined 01:10 eternaleye left 01:28 nacho_ joined 01:46 jiing left 01:53 justatheory left
pugs_svn r22890 | lwall++ | [STD] fix ws nodewrapping bug 02:08
r22890 | lwall++ | [Cursor] more refactoring
TimToady @tell ruoso you can pull out your ws workaround code now, I think
lambdabot Consider it noted.
02:11 cathyal joined 02:19 hercynium joined 02:22 felipe left 02:39 eternaleye joined 03:00 wknight8111 left 03:06 alc joined 03:17 eternaleye left
pugs_svn r22891 | lwall++ | [gimme5] more lexer call refactoring to avoid duplication 03:36
03:47 Psyche^ joined 03:48 Patterner left, Psyche^ is now known as Patterner, Limbic_Region left 03:52 |Jedai| left, Jedai joined 03:53 Ontolog joined 03:54 japhb__ left 04:00 cathyal left 04:06 jauaor joined 04:08 japhb__ joined 04:10 z80ASM joined 04:27 araujo left 04:28 eternaleye joined 04:32 araujo joined 04:33 felipe joined 04:42 d4l3k_ joined, alc left, nothingmuch left, dalek left 04:43 d4l3k_ is now known as dalek 04:46 nothingmuch joined 04:54 hercynium left 04:58 alc joined
pugs_svn r22892 | pmichaud++ | [spec]: Fudge some tests for rakudo in S03-junctions/boolean-context.t 05:12
r22893 | pmichaud++ | [spec]: Fudge a .pick test on arrays for rakudo. 05:15
r22894 | lwall++ | [Cursor] couple more micro-optimizations to help procrastinate the big one 05:16
bacek_ rakudo: my $a='a'; my $b='b'; my $c='c'; say ?(('a' | 'b' | 'c') eq ($a & $b & $c)); 05:18
p6eval rakudo 32372: OUTPUT[0␤]
bacek_ pugs: my $a='a'; my $b='b'; my $c='c'; say ?(('a' | 'b' | 'c') eq ($a & $b & $c)); 05:19
p6eval pugs: OUTPUT[all(VJunc any(VBool False,VBool True))␤]
literal what does that V in VBool/VJunc mean? 05:20
05:22 z80ASM left
TimToady value perhaps 05:23
05:42 nacho_ left 05:45 sail0r joined 05:47 Alias_ joined
pugs_svn r22895 | pmichaud++ | [spec]: Revert some incorrect unfudging in r22788. 05:50
05:51 sail0r left 06:06 sri_kraih left 06:13 ab5tract joined
pugs_svn r22896 | lwall++ | [Cursor] Heh, if we bypass TRE to just immediately revert to the stupid old 06:18
r22896 | lwall++ | backoff LTM matcher, STD (precached) can parse itself in half the time! Yow!
06:32 ab5tract left 06:57 ashizawa joined 07:08 adc_Penner joined 07:52 bacek left 07:58 pbuetow joined, iblechbot joined 08:04 bacek joined 08:05 tomyan joined 08:13 bacek_ left 08:19 alester left 08:22 simcop2387 left 08:23 elmex joined 08:24 simcop2387 joined 08:26 stephenos left 08:30 pbuetow left 08:47 japhb joined, Bzek joined 08:59 japhb__ left 09:04 cosimo joined 09:14 zamolxes joined 09:19 smg left 09:24 Ontolog left 09:25 adc_Penner left 09:34 cpfr left 09:48 jauaor left 09:53 ejs joined 10:41 zamolxes_ joined, zamolxes_ left, zamolxes_ joined 10:42 zamolxes left 10:48 zamolxes_ is now known as zamolxes 10:51 smg joined 11:04 alc left 11:05 cpfr joined
pugs_svn r22897 | jnthn++ | [spectest] Unskip some inheritance tests that Rakudo now passes. 11:22
r22898 | jnthn++ | [spectest] Correct a test that got indirect method invocation syntax wrong, and un-todo it for Rakudo. Also un-todo a test that pended on object stringification. 11:31
11:56 TheFluff_ left 12:44 schmalbe joined, z80ASM joined 12:50 renormalist joined 13:12 zamolxes left 13:32 meppl joined 13:46 ashizawa left 13:48 sri_kraih joined 14:06 pedrob joined 14:08 beppu__ joined 14:20 beppu left 14:32 |Jedai| joined 14:46 ejs_ joined, Alias_ left 14:47 ejs left 14:48 jauaor joined 14:49 Jedai left 14:54 zamolxes joined, zamolxes left 14:55 __felix__ joined 14:57 zamolxes joined, __felix__ left 15:03 pedrob left 15:04 pedrob joined 15:05 rdice joined 15:07 ludan joined 15:09 alc joined 15:14 ejs_ left 15:24 jhorwitz joined 15:37 jan_ left 15:44 alester joined 15:49 z80ASM left 15:52 hercynium joined 16:02 stephenos joined 16:06 stephenos left 16:09 stephenos joined, eternaleye left 16:24 alc left
pugs_svn r22899 | lwall++ | [Cursor] plug some syntax errors misdiagnosed by new LTM 16:25
r22899 | lwall++ | [tryfile] restore ability to report failures via exit status
16:25 zamolxes_ joined 16:32 Exodist joined, eternaleye joined 16:40 zamolxes left 16:45 jan_ joined 16:47 ab5tract joined 17:01 masak joined 17:03 pedrob left 17:04 cosimo left 17:13 z80ASM joined 17:21 TJCRI joined 17:22 renormalist left
pugs_svn r22900 | lwall++ | [Cursor] extirpate TRE 17:23
17:23 TJCRI left 17:25 eternaleye left, justatheory joined
TimToady @tell azawawi you should find your parsers running somewhat faster now, given that STD now parses itself twice as fast as it did yesterday (given a preloaded cache) 17:27
lambdabot Consider it noted.
17:27 zamolxes_ is now known as zamolxes
kolibrie TimToady++ # faster STD 17:27
[particle] nice 17:28
TimToady you don't get quite 2x gain on random tests because it still takes a second or so to parse all the p5 code involved, so shorter files parse in about 3/4 the time they used to 17:29
don't know what the relative memory usage is though 17:30
and I still haven't actually implemented a decent trie/dfa-ish lexer, so the cache is still 400MB or so after parsing all the tests 17:31
[particle] where's dmq and avar when you need them? 17:32
TimToady but now that TRE is out of the way, I'm running out of excuses :)
17:32 ruoso joined
avar mmmm 17:33
TimToady: tre out of the way? yay! 17:34
17:34 pbuetow joined
ruoso Hello! 17:35
lambdabot ruoso: You have 1 new message. '/msg lambdabot @messages' to read it.
TimToady basically, instead of using TRE and then doing my own ltm backoff, I just started with my stupid ltm backoff at the beginning, and surprised myself when it ran faster
avar nice
TimToady it's probably more efficient because of all the digraph caching, so it doesn't actually have to run over all that many patterns typically
and we no longer have TRE for a dependency either, which has something to be said for it 17:37
moritz_ you mean it might now work on other systems than linux? ;-) 17:38
TimToady some of our programs still use cat 17:40
moritz_ I guess there's a /bin/cat on solaris, for example
[particle] windows has 'type' 17:44
EU::C has a 'cat' you can use iirc
moritz_ or 'cp $file con' iirc
and Perl has open() ;)
ruoso wonders if there's a dog around to chase this cat 17:45
ruoso hides...
17:49 Aisling left
pugs_svn r22901 | lwall++ | [Cursor] use of cat deemed less than useful 17:51
ruoso TimToady++ # ws issue solved 17:52
17:53 Psyche^ joined, fleebailey33 joined 17:55 Patterner left, Psyche^ is now known as Patterner 17:57 beppu__ is now known as beppu 18:03 z80ASM left
jauaor wonders if somebody is on mac here 18:04
pugs_svn r22902 | moritz++ | [t/spec] don't rely on a lexicals working in eval() when testing ro-ness of 18:06
r22902 | moritz++ | subroutine arguments. Also TODO the now failing test for rakudo.
18:07 adc_Penner joined
ruoso in the following code: 18:11
my @a = grep { ... } @b;
from what I understand of the spec,
@a is a lazy array
lambdabot Maybe you meant: activity activity-full admin all-dicts arr ask . ? @ v
ruoso but...
if someone does... 18:12
my @c = @a;
that kinda looks like implying copying the values from @a to @c
which would mean eager evaluation...
wouldn't it be sane that list assignement always imply eager evaluation? 18:13
leaving list binding for lazy lists?
like...
my @a := grep { ... } @b;
my @c := @a;
this would keep the lazyness in all arrays...
on the same issue, I would think that if you do '@a = @b' and later use @a in slice context, it would be already flattened... 18:15
since list assignment implies list context
TimToady I basically agree, since assignment should try to behave as much like p5 assignment as possible 18:16
ruoso cool... the same for hashes, i presume... 18:17
TimToady however, I think eager context may recognize iterators that are known to be infinite, and flip to lazy at that point
so @a = 1..* would still work
ruoso wouldn't it be better if we assume one would have to use @a := 1..*? 18:18
pmichaud TimToady: jonathan++ and I had a(nother) question about .true earlier today -- do we really need it? Wouldn't it be sufficient to simply use .Bool instead?
TimToady well, the problem is that the failure mode of not detecting infinite lists is rather harsh in any case
pmichaud (this question can wait until the current thread has ended)
ruoso pmichaud, .Bool is not native... .true is native 18:19
TimToady, yes... but using infinite lists is something the user should know how to use...
the user can live its entire life without using infinite lists
TimToady it could warn
ruoso in fact...
list assignment needs to ask the length of the lsit 18:20
list
this can trigger the check
it could even fail
my @a = 1..*; would raise a "Trying to assign an infinite list" error 18:21
TimToady I think gratuitous failure is antisocial. :)
ruoso I could argue semantic inconsistency is even more antisocial ;) 18:22
TimToady I'm fine with a warning, but it should DTRT anyway
Perl is more about DTRT than consistency
ruoso TimToady, in @a = 1..*; is @a readwrite?
TimToady certainly; the initializer is just an initializer 18:23
ruoso and what @a.push(1) would do?
TimToady it's how you reify unreal values, but if an element is reified already, it is just an ordinary array element 18:24
18:24 ludan left
TimToady a push would of course fail 18:24
well, maybe not
it could just add another initializer on the end
pmichaud I would just think it'.... right.
TimToady surreal lists
jnthn pmichaud: That was what I thought too. 18:25
ruoso so... what is the border line in "to be or not to be eager"
does that gets us back to the idea of a three-state iterator? 18:26
1..* would be coerced to an iterator, which would then have "prefix:<=>" called 18:27
which would return a 'ExpensiveOperation' failure 18:28
which would cause the list assignment code to create a new lazy list that uses that iterator?
hmm...
but...
prefix:<=> is not expensive.. 18:29
TimToady it is in list context :)
well, might be
ruoso we need something else besides prefix:<=>
to do that checking
jnthn ruoso: 1..* _is_ an iterator by the Perl 6 spec.
TimToady sure, but we're haggling of the api in any case :) 18:30
ruoso jnthn, yes... sort of... since Perl 6 spec doesn't really specs an Iterator type
TimToady *over
jnthn I meant conceptually, not type wise. :-) 18:31
ruoso the problem is that i'm getting in very concrete land now
meaning the APIs
maybe a method to say 'hey, what do you think of going through all your elements'? 18:32
that could return 'no way man!\
or 'it might take a while'
or 'just do it'
TimToady or just "give me a reasonable length to eagerify over" 18:33
so I know how big to make the real part of my array
ruoso TimToady, but it's not just about length
it might require IO
like... a network stream 18:34
TimToady sure, as would any eager evaluation
ruoso sure... but we're discussing when plain '@a = @b' is eager or not
the user is not saying "I want lazy" nor "I want eager" 18:35
it's simply saying DWIM
TimToady I think that one should just assume real stays real and spec stays spec
ruoso that means 'my @a = grep { ... }, @b; my @c = @a' stays lazy? 18:36
or does that depend on what @b is? 18:37
pugs_svn r22903 | moritz++ | [t/spec] another test for ro-ness of arguments.
TimToady I'd think it depends on @b
18:37 pedrob joined
TimToady it's fine if @b has a finite spec for @a to end up with that eager, but mostly specs in arrays will be infinite, I suspect 18:38
the specs probably have to be cloned, since the two arrays are reading independently 18:39
which is a good argument for treating IO as finite
18:39 schmalbe left
TimToady I think eagerness only becomes lazy on things that are provably infinite 18:40
pmichaud to my ears, that makes things sound like eagerness is the default
*eyes
whatever.
TimToady on assignment, yes
18:41 jhorwitz left
TimToady that's the notion we're discussion 18:41
*discussing
since assignment has copy semantics
it is naturally eager-ish
we talked about this a couple weeks ago too
jnthn You could always go for copying any unevaluated iterators too.
pmichaud yes, it's been a long-standing discussion :-)
I'm just trying to make sure I'm understanding what is being implied. 18:42
TimToady it's no problem to copy iterators that are conceptually immutable
ruoso yeah... the problem is with mutable stuff
TimToady but copying a file handle is trouble
1..* is conceptually immutable, but iterable 18:43
so it doesn't matter if you clone it
it's also fine if you clone a mutable iterator derived from it, since you presumably already cloned the earlier values too 18:44
it's that pure-in-the-Haskell-sense that makes it okay
but in the absence of that purity, I think making eager the default for assignment is sane 18:45
and what a p5 programmer is expecting in any case
I think I need to hack the spec a bit though... 18:46
ruoso but I'm still a little confused by what the border-line is...
TimToady if an iterator doesn't know if it's infinite or not, assume it's not 18:47
ruoso that means everything but 1..* (and similar) are eager... 18:48
TimToady worst case is no worse than p5 now
18:48 hanekomu joined
ruoso ok... if that's the border line, it simply means that the assignment tries to fetch the size of the list 18:48
TimToady I think we can assume that 1,2,4...{mumble} is infinite 18:49
ruoso in infinite lists, it will return infinite
otherwise, returning the number of elements will require eager evaluation
TimToady we can probably also assume an explicit lazy list is to be treated as "infinite": @a = 1,2,3, lazy 4,5,6; 18:51
ruoso hmm... 18:52
TimToady or something like that
ruoso that gets us back to the beggining
TimToady I guess we currently only have lazy { 4,5,6 } syntax 18:53
ruoso TimToady, I think it's saner if it's required to use 'my @a := 1,2,3,lazy {4,5,6}' to get lazy behaviour 18:57
18:58 armagad joined 18:59 mberends joined
ruoso if we take the bind thing sanely... 18:59
my @a := 1,2,3,lazy {4,5,6}
is really something like
:(*@a) := \(1,2,3,lazy {4,5,6}) 19:00
so it does make sense if the lazyness is preserved only on bind
actually... the signature would be a bit different 19:01
:(*@a is rw) := \(1,2,3,lazy {4,5,6})
hmm...
are slurpy arrays readonly or readwrite in signatures?
TimToady depends on where the signature is 19:04
in any case, it's not really what you want
if you want to bind an actual Array object with Array semantics 19:05
that lets you modify values that were initialized with immutables
more like *@a is copy
19:05 armagad left
ruoso right... that makes even more sense 19:06
:(*@a is copy) := \(1,2,3,lazy {4,5,6})
TimToady perl6: my @a := 1..10; @a[1] = 42;
p6eval rakudo 32398: OUTPUT[Null PMC access in find_method()␤current instr.: 'onload' pc 14 (src/gen_builtins.pir:31)␤]
..pugs: OUTPUT[*** Can't modify constant item: VInt 2␤ at /tmp/s7v7OXyZua line 1, column 17-27␤]
..elf 22847: OUTPUT[syntax error at (eval 117) line 3, at EOF␤ at ./elf_f line 3861␤]
TimToady should fail
ruoso hmm... 19:07
TimToady my @a := Array(1..10); @a[1] = 42;
19:07 hanekomu left
ruoso I think you meant: 19:07
perl6: my @a := Array(1..10); @a[1] = 42;
p6eval rakudo 32398: OUTPUT[Null PMC access in find_method()␤current instr.: 'onload' pc 14 (src/gen_builtins.pir:31)␤]
..pugs: OUTPUT[*** No such subroutine: "&Array"␤ at /tmp/MLol4AjUuc line 1, column 1-22␤]
..elf 22847: OUTPUT[syntax error at (eval 119) line 3, at EOF␤ at ./elf_f line 3861␤]
TimToady perl6: my @a := item(1..10); @a[1] = 42;
p6eval rakudo 32398: OUTPUT[Null PMC access in find_method()␤current instr.: 'onload' pc 14 (src/gen_builtins.pir:31)␤]
..elf 22847: OUTPUT[syntax error at (eval 119) line 3, at EOF␤ at ./elf_f line 3861␤]
..pugs: OUTPUT[*** Can't modify constant item: VInt 2␤ at /tmp/VJdnOTXYEM line 1, column 23-33␤]
ruoso what about... 19:08
my @a <== 1..10
TimToady perl6: my @a := [1..10]; @a[1] = 42;
ruoso that expresses the desired lazyness
p6eval rakudo 32398: OUTPUT[Null PMC access in find_method()␤current instr.: 'onload' pc 14 (src/gen_builtins.pir:31)␤]
..pugs: OUTPUT[*** Can't modify constant item: VUndef␤ at /tmp/cUSVU6Btym line 1, column 19-29␤]
..elf 22847: OUTPUT[syntax error at (eval 117) line 3, at EOF␤ at ./elf_f line 3861␤]
TimToady that shoulda worked, I think
pugs: [1..10].WHAT 19:09
p6eval pugs: RESULT[::Array]
19:09 pedrob left
TimToady my @a := [1..10]; @a.WHAT 19:10
pugs: my @a := [1..10]; @a.WHAT
p6eval pugs: RESULT[::Array::Const]
ruoso that's a bug, for sure
TimToady grr
ruoso TimToady, anyway...
what do you think about '@a <== 1..10' ?
that expresses the desired lazyness and rw-ness
TimToady feed operators are considered bindings rather than assignments, I think 19:11
ruoso it's a special type of binding
iirc, the return of feeds are not readonly
TimToady perhaps it's just the syntax for adding a spec to an array
@a <<== 1..10 adds a spec 19:12
lambdabot Maybe you meant: activity activity-full admin all-dicts arr ask . ? @ v
TimToady @a <== 1..10 replaces
lambdabot Maybe you meant: activity activity-full admin all-dicts arr ask . ? @ v
TimToady maybe I didn't
ruoso I think that's ok 19:13
then list assignment is always eager, unless infinite
19:13 Exodist left
TimToady in any case, I think feeds should try to be lazy 19:13
ruoso and feeds always try to be lazy...
TimToady we're in violent agreement 19:14
ruoso ok... so we agree that the boder-line to non-eager evaluation in list assignment is only if the rvalue is infinite
TimToady I think that's sanestest 19:15
ruoso and lazy-aware people should use feeds instead
TimToady and everyone is dwimically pleased, we hope 19:16
I need to go dwim some lunch &
19:17 iktome left
ruoso TimToady, please consider spec'ing a little bit about Iterator... there are a lot of things counting on an iterator API it seems... 19:21
19:22 explorer joined 19:27 fleebailey33 left 19:28 Exodist joined, Exodist left 19:29 Exodist joined, Exodist left 19:30 Exodist joined 19:49 pedrob joined
pmichaud TimToady: any thoughts about .Bool versus .true ? 19:53
TimToady what they said
pmichaud so, if I want to change the way a class booleans, do I define a .Bool method or a .true method? 19:56
i.e., a class' notion of truth is defined by what method?
19:57 pedrob left
pmichaud jnthn was of the opinion (I concur from what little I've thought about it) that if we use .Bool to define a notion of truth, then we don't have to do anything special to get $x but True to work properly. 19:57
i.e., Bool can be an enum.
it also seems odd that we use a .Str method for stringification but not .Bool for boolification 19:58
and, we could potentially eliminate .true altogether, which might avoid some confusion with prefix:<true> 19:59
20:00 pedrob joined
ruoso pmichaud, my major concern on that issue is that Bool is not a native type 20:13
which means that you cannot assume to know how it's implemented 20:14
pmichaud I'm simply saying it's an enum.
and that the way someone defines "booleaness" for a class is to define a method called .Bool
ruoso I agree having both a native and a non-native bool is weird 20:15
pmichaud currently S02 says that we use ".true" to do this, but that seems inconsistent with the notion of using ".Str" to define stringification on a class. 20:16
ruoso and I wonder what is the use of an non-native bool?
actually... ".true" is inconsistent even with the native type
I was actually blindly using ".bool" in SMOP 20:18
PerlJam didn't it used to be called .bit ?
ruoso PerlJam, there's bit *and* bool
iirc
yes... I do rc
PerlJam oh, perhaps. My memory is fuzzy
ruoso the only use I can think of for non-native bool is allowing a undefined Bool 20:19
PerlJam there may be other "interesting" Bools 20:20
20:21 smg left 20:24 renormalist joined
ruoso pmichaud, I think the point is that you don't need to boolify anything... because every Object supports natively responding as a bool 20:25
no need to "coerce" to boolean
pmichaud ruoso: obviously there is _some_ method that people can define to change an object's notion of booleanness
ruoso: currently the spec says that method is .true
ruoso yes... 20:26
and it's not inconsistent, because it's not a coercion
20:26 rindolf joined
ruoso you use .Str() because that's how that object is "coerced" to string 20:26
there's no coercion to bool
nor Bool
pmichaud I don't understand the difference
ruoso it's an attribute of every object to be either true or false 20:27
you don't need to coerce the object to a different type
to find out it's boolean value 20:28
s/it's/its'
pmichaud so, how do you envision prefix:<?> as being implemented?
or, put another way, how can a .true method override an object's true/false attribute? 20:29
ruoso er...
there are no public attributes in Perl 6... that was just way of speaking..
it's always a method
pmichaud so, when you said "it's an attribute ..." above, did you mean "it's a method ..."? 20:30
rindolf So does @$array_ref works in Rakudo already?
ruoso pmichaud, yes...
pmichaud rindolf: not yet, we're working on it right now.
rindolf How about ones (@$m, @$n)
ruoso pmichaud, the spec says "attribute"
rindolf pmichaud: ah, cool.
ruoso pmichaud, but there are no real public attributes in Perl 6 20:31
rindolf pmichaud: I'm glad to be your catalyst.
ruoso it's *always* through methods
pmichaud I'm simply saying that the method should be .Bool instead of .true, then.
ruoso but that would return a non-native type 20:32
I could agree with .bool
20:32 hanekomu joined
pmichaud I don't mind if .Bool delegates to .bool 20:32
however, note that .true already defaults to .defined in Object 20:33
anyway, I think I have my answer for now, thanks. 20:35
ruoso pmichaud, the thing is whether "if" uses ".bool" or ".Bool"
it's sane that it uses the native-type
otherwise it would need to re-coerce to .bool
because it can only assume to know the native bool
pmichaud as long as the "native type" has some way of delegating to the user-defined methods, that's no problem.
ruoso ?
the problem is about the return of the methdo 20:36
pmichaud if $x { ... } needs to ultimately use the .true method of $x if the user has defined one.
ruoso not the method itself
it will *always* call $x.true
there's no other option
(unless $x is a native type, of course)
and $x.true should *always* return a native bool 20:37
pmichaud so, if I defined class Foo { method true() { return 'yes'; } } 20:38
20:38 eternaleye joined
pmichaud that would be an error? 20:38
ruoso method true has a more compete signature 20:39
that describes the return type
the value passed to "return" can be coerced inside the method
and not by the one calling it
pmichaud so, the above would be an error? 20:40
ruoso I presume it would at least give a warning and force a coercion...
er... not coercion...
pmichaud :-{
ruoso but calling .true in the given object
maybe it could recursively call .true until it finally gets a native bool 20:41
pmichaud that all sounds very implementation-ish and not spec-ish.
20:41 charsbar left 20:42 charsbar joined, zamolxes left
ruoso the spec part is: method .true should return a native bool 20:42
pmichaud is that specced somewhere now?
ruoso er... I think I just presumed that... 20:43
since the interpreter needs a native bool to be able to compare
pmichaud at any rate, "coerce to native bool" sounds a lot more straightforward to me than "force return of native bool"
ruoso agreed... 20:44
pmichaud indeed, "recursively call .true" sounds like a coercion to me
ruoso but you see why it needs to get a native bool in the end...
pmichaud in Parrot our notion of "native bool" is being handled through the get_bool vtable function -- each PMC can define its own notion of get_bool
for the base Object class, we're just delegating to another method that can be overridden (currently .true) 20:45
masak the recursive calls to .true might not bottom out...
ruoso ok... and this delegation could do the coercion
pmichaud it just feels more natural to say "delegate to .Bool"
ruoso but you need a native bool in the end... 20:46
having a non-native bool will just require yet another ste
step
pmichaud where .Bool returns something that can be coerced to a native bool according to its own rules
ruoso that doesn't apply only to Bool
but to every object
every object can be coerced to a native bool according to its own rules
that's why I tried to avoid the term "coercion" 20:47
20:47 explorer left
pmichaud I tend to think of it as "asked for its boolean value" instead of "coercion" 20:47
ruoso right...
pmichaud but they're essentially the same. The way we get an object's string value is through its .Str method
ruoso but usually coercions doesn't return such a small set of possible values 20:48
but that doesn't really matter
jnthn Depends how many values you can represent in the type being coerced to ;-) 20:49
ruoso what does matter is that you need a native bool at some point
pmichaud anyway, I have another task to work on now -- I'll read scrollback later in case anything else comes up.
ruoso jnthn, that's the point... a non-native Bool can have several instances
jnthn Yes. 20:50
ruoso a non-native Bool can be simply something that says true to .^does(Bool)
it might not even be an instance of Bool at all
jnthn Sure, I prefer to talk of it in that case as something that does the Bool role. 20:51
ruoso I still don't see what the Bool role does....
but that's another issue
jnthn But yes, I get your point. At some point we need to have something - at a low level - that is something we can say "is it 0 = false or otherwise"
ruoso yes... I was even thinking that instead of recursing into .true calls 20:52
[particle] the Bool role defines the .Bool method
jnthn As well as the .True and .False methods, since it's an enum, but yes.
It doesn't define any storage.
[particle] ayep
ruoso it might be simpler to assume that anything not "native false" is true in the return of .true 20:53
jnthn I kinda assumed we'd go that way, yes.
ruoso that means method true { 0 } means true 20:54
jnthn Erm?
ruoso since 0 is not a native bool
jnthn 0 is native false?
ruoso 0 is a native int
jnthn Ah...
ruoso maybe it could handle native types specially.. 20:55
and have exceptions for, say, 0
jnthn I think that we'd want to have something like method true as bool { 0 }
So we coerce to a native bool
ruoso but what if the user doesn't define the return of the method? 20:56
are we going to special case the 'method true'?
(that wouldn't be that weird)
(since it's such an important method)
jnthn We could perhaps do that... 20:57
I generally don't like special cases...but nothing better comes to mind.
I think that if we discourage people from implementing .true themselves we'd make it less of an issue anyway.
ruoso but how many use cases you see for people re-implementing true? 20:58
0 but True
already solves most of that cases
jnthn That is, follow my suggestion of .true is implemented by calling .Bool and then coercing it to a bool and returning it.
ruoso but that doesn't solve the issue
because one might still re-implement .true 20:59
jnthn Object does the Bool role and defines it in terms of definedness, as I believe is already spec'd.
ruoso it implements a true method, yes
jnthn And then we direct people to implement a Bool method.
ruoso that can be overriden
jnthn Well, I was kinda hoping we could perhaps get back to Bool really being just an enum.
ruoso I don't see much difference in telling people to write .Bool instead of .true
[particle] the true method is not defined by the Bool role
ruoso it's defined by Object
jnthn From a language design point of view, it's nicer to say "to state how to represent yourself as a certain type you write a method by that name" 21:00
ruoso I still don't see the use for the non-native Bool
but that will require additional coercions by definition 21:01
[particle] in my language, Bool autopromotes to Int after you prefix:++ twice
jnthn ...
[particle] in my friend's language, it gives an overflow error
21:01 cpfr left
[particle] in Perl 6, it throws an exception 21:01
jnthn Oh? 21:02
I thought it just stayed at 1.
erm, true
:-)
pmichaud incrementing a Bool in Perl 6 always leaves it at "true"
jnthn ruoso: I think the problem is that we want to say things like 0 but True, so we need an enum.
[particle] actually, yes, it stays at True
jnthn Or a role.
ruoso jnthn, it could be a role that re-implements true 21:03
.true I mean
jnthn Yes, fur sure.
It's just if we go that way, it's not a real enum.
ruoso well...
jnthn Which is fine, but the spec should also stop claiming it is.
ruoso Bool can be an enum
that has True and False roles as possible values 21:04
the prototypes
jnthn We can make it look like and feel like an enum
[particle] i'm sitting here next to Bool, and it's *begging* me to be an enum
jnthn But if we really in the prelude wanted to just write enum Bool <True False>;
[particle] that's all i'm saying.
jnthn And nothing else 21:05
ruoso but in Perl 6, if it looks like something, it is something
jnthn Then that isn't going to provide the .ture method
Sure, we can make it an enum-ish thing that's just a bit more special.
ruoso can't an enum hold two prototypes of the roles? 21:06
where Bool is an enum, and the values of it are the role True prototype and the role False prototype
jnthn Are role prototypes actually mentioned in S12? 21:07
But anyway, that's basically what it boils down to, if we are both thinking the smae thing when we're saying "role prototype" :-)
ruoso well... there must be something stored in the namespace 21:09
jnthn An enum as I have it, is kinda a role that introduces a storage location and methods of the name of the enum and the names of the values.
ruoso I call it prototype
l)
;)
jnthn Ah, OK. Works for me.
And the storage location can hold the current value. 21:10
ruoso and the current value is the role "prototype" ;)
jnthn Yes.
Which are also in the namespace, as you sya.
*say
ruoso so, no .Bool...
right?
jnthn Well, if you declare an enum Bool, then when you "but True" then you get a method Bool. 21:11
ruoso right... but nobody actually uses it
jnthn You'd get a .Bool, .True and .False
Well, to me it seems we need to pick what people are going to use. 21:12
ruoso but the True role re-defines .true
as well as the False role
the "if" statement_control calls .true
and anyone can override .true
jnthn Yes.
So maybe we'll be better off saying True and False are roles that override .true, and there is no Bool enum? 21:13
And no .Bool?
ruoso well... maybe Bool is a subset
jnthn subset Bool where True|False; # ? 21:14
21:14 rindolf left
ruoso yeah... something like that 21:14
moritz_ well, Bool is specced as an enum ;)
masak am I right in thinking that the .fmt method should be added under the headings Scalar, Array and Hash in S29? (and not, say, all three variants under Any)
jnthn moritz_: Oh no, don't start the whole circle again!
masak (.fmt is defined at S02:1349) 21:15
moritz_ circles++ ;-)
ruoso home &
ruoso later &
masak in this discussion, even the circles are going in circles!
:P
21:15 ruoso left 21:17 zamolxes joined
masak should the delete and exists methods on Array, and the :delete and exists methods on Hash in S29 be removed? 21:25
moritz_ I think TimToady removed them from the spec tests and from STD.pm 21:26
masak I'll take that as a yes. 21:27
though I wouldn't want to remove them without thinking about remaking them into something else first
right now, I'm adding .fmt to S29 (see my question above)
it's going pretty well 21:28
S29 needs a lot of love(tm)
do the second arguments in the Array and Hash versions of .fmt have defaults? for that matter, do the first? 21:30
is .fmt tested somewhere?
moritz_ t/syntax/interpolation/fmt.t 21:31
t/spec/S02-names_and_variables/fmt.t
masak moritz_++ 21:32
cool! I'll check them out immediately.
hm. I would go so far as to say that the first one doesn't really exercise the full potential of fmt. it does a lot of other seemingly important things, though. 21:36
moritz_ aye 21:37
masak hm again, seems I'd be better off putting the list version of .fmt under the List heading, not Array. I don't agree that the scalar version should be under Str, though. 21:38
21:38 Aisling joined
masak anyway, the second test file pretty much rocks. 21:38
it talks about .fmt for Pair -- is there any inheritence relation between Hash and Pair in Perl 6? 21:39
jnthn I'm not aware of one. 21:40
masak so, one more method needed in S29.
21:42 rdice_ joined
masak what about Array/List? an Array isa List? 21:45
21:48 eternaleye left
jnthn masak: In Rakudo, at the moemnt, yes. 21:48
pmichaud pugs: say Array ~~ List;
21:48 rdice left
p6eval pugs: OUTPUT[1␤] 21:48
pmichaud pugs: say List ~~ Array;
p6eval pugs: OUTPUT[␤]
pmichaud pugs: say [1] ~~ List; 21:49
p6eval pugs: OUTPUT[1␤]
masak jnthn: I'm working at the S29 level right now, so that answer is only partly helpful :)
pmichaud pugs: say <a b> ~~ Array;
p6eval pugs: OUTPUT[1␤]
pmichaud pugs: say (1,2) ~~ Array;
p6eval pugs: OUTPUT[1␤]
pmichaud that looks odd.
jnthn I'd expect those to be a list, but not an Array.
pmichaud agreed. 21:50
21:51 smg joined
masak S29 doesn't even have a heading 'Pair' 21:52
creating one...
what default sigil does a Pair object have? '%'? 21:54
moritz_ $ 21:55
jnthn masak: Having the various roles like Positional and stuff in there would be good too. 21:56
masak jnthn: I'll put it on my list which I just made.
moritz_ masak: and when you are at it... many methods now actually live in Any, not in Str|List|Complex|$Whatever... 21:57
masak moritz_: yes, that's true. that goes on the list too. 21:59
the problematic thing with S29 is that it's vital, but almost no-one has the final answers.
so you'll all have to help me.
moritz_ masak.list.elems++ ;-)
masak just putting my money where my mouth is.
the 'S29 needs love(tm)' campaign is sponsored by the November 'good deed every day(tm)' drive. :) 22:00
ok, review appreciated: nopaste.snit.ch/14497 22:01
moritz_ uhm, is .fmt really a wrapper around sprintf? I thought it was somethiing different... 22:02
but I suspect you have done more in-dpeth research than me ;) 22:03
masak S02:1349
"To get a formatted representation of any scalar value, use the C<.fmt('%03d')> method to do an implicit C<sprintf> on the value."
moritz_ masak: other methods in S29 that are defined in multiple classes are listed in just one 22:04
* in just one block
masak moritz_: hence my question earlier which no-one answered :)
I can put it in one block. where?
moritz_ sorry ;)
dunno, perhaps Str 22:06
masak because that's the return value? ok.
moritz_ the common denominator
masak aye. 22:07
I'll put it after sprintf. people standing on higher shoulders can refactor later if need be. 22:09
new attempt: nopaste.snit.ch/14498 22:14
I'm not sure if C<> thingies can be line-broken like that, but I assume they can.
I hope the descriptions are not exceedingly implementation-y 22:15
no new comments? ok, good, I'll commit then. 22:17
22:18 xinming_ left
pugs_svn r22904 | masak++ | [Spec/Functions.pod] added .fmt 22:18
moritz_ masak++
masak S29++ 22:19
given enough love, S29 will start loving people back :)
that's what we want.
SamB yes, but ++ only indicates like 22:20
not love
masak SamB: aye. I meant S29.chars++, in which it only indicates size. :) 22:21
22:24 rdice_ left, zamolxes left 22:26 ilbot2 left
masak oh. the second test file actually tests for ',' as a default second arg to the array version of .fmt 22:27
I guess that actually is a good default.
adding.
22:28 pedrob left 22:37 adc_Penner left 22:42 hanekomu left 22:45 pbuetow left
pugs_svn r22905 | masak++ | [Spec/Functions.pod] various changes to .fmt commit: 23:05
r22905 | masak++ | * C<> no longer line-broken
r22905 | masak++ | * fixed some %p and %h which should be $p
r22905 | masak++ | * added defaults for the $separator param in the List and Hash versions
r22906 | masak++ | [Spec/Functions.pod] s/array/list/ in .fmt description
masak the first pancace never looks quite right :) 23:08
s/cace/cake/
any opinions on what the default $separator should be for the List .fmt? suggestions are ' ' (from the test file), ',' (what I wrote in S29) and ', ' (example from S02) 23:13
23:15 elmex left 23:17 pmurias joined
masak defaults to ' ' in the meantime, claiming p5 as prior art 23:18
although its default is '', come to think of it 23:19
:/
23:19 ab5tract left 23:23 eternaleye joined 23:29 bacek_ joined 23:31 pmurias left 23:33 xinming joined, hercynium left 23:37 dalek left
buu buubot: eval: my @x = 1,2,3,4; "@x" 23:38
buubot buu: 1
buu =[
23:38 dalek joined
buu buubot: eval: my @x = (1,2,3,4); "@x" 23:38
buubot buu: "1 2 3 4"
masak buu: ah, look at that. 23:39
masak makes the appropriate change.
buu: thanks. 23:40
23:43 d4l3k_ joined, pmichaud_ joined, pmichaud left 23:44 jnthn left
pugs_svn r22907 | masak++ | [Spec/Functions.pod] made default $separator on List::fmt ' ', with 23:44
r22907 | masak++ | Perl 5 and t/spec/S02-names_and_variables/fmt.t as prior art
23:47 Alias_ joined 23:49 PerlJam left, pmichaud joined 23:50 d4l3k_ left, pmichaud_ left 23:51 wolverian left 23:52 pedrob joined 23:53 d4l3k_ joined 23:55 dalek left, pmichaud left 23:57 bacek_ left, Exodist left, bacek left, nothingmuch left, yahooooo3 left, Maddingue left, lambdabot left, d4l3k_ left 23:58 bacek_ joined, Exodist joined, bacek joined, nothingmuch joined, lambdabot joined, yahooooo3 joined, Maddingue joined, jnthn joined 23:59 dalek joined