Pugs 6.2.8 released! | pugscode.org | pugs.kwiki.org | paste: sial.org/pbot/perl6 | www.geeksunite.net Set by autrijus on 13 July 2005. |
|||
ayrnieu | Are you sure? | 00:07 | |
brentdax | Pretty sure. There's supposedly a deadline and stuff. | 00:14 | |
milna | hello | 00:30 | |
Does anyone know of a good tutorial on haskell | |||
I have tried reading Pugs, but I dont understand it | |||
meppl | i think there are many links on the haskell-website itself | 00:44 | |
www.haskell.org/learning.html | 00:45 | ||
dudley | milna: If you want to shell out the money, Haskell: The Craft of Functional Programming is worth it | 00:49 | |
ayrnieu | milna - #Haskell also knows. | 00:51 | |
^conner_ | There's been a request on #perl for Signatures::Readable::English | 01:51 | |
02:16
brentdax_ is now known as brentdax
|
|||
autrijus | greetings, Λcamels | 04:38 | |
Darren_Duncan | howdy | 04:40 | |
autrijus | :) | 04:41 | |
Khisanth | that is suppose to be an uppercase lambda? | 04:46 | |
gaal | morning | 07:18 | |
08:02
coral_ is now known as coral
|
|||
nothingmuch | hola | 09:01 | |
Aankhen`` | ?eval role Foo { method bar () { "bar" } }; class Bar { does Foo; }; my $bar = Bar.new(); $bar.bar() | 10:07 | |
evalbot6 | 'bar' | ||
Aankhen`` | ?eval $?PUGS_VERSION | 11:01 | |
evalbot6 | \'Perl6 User\'s Golfing System, version 6.2.8, July 13, 2005 (r5904)' | ||
gaal | ?eval ({a=>1,b=>2}).perl | 11:18 | |
evalbot6 | '{(\'a\' => 1), (\'b\' => 2)}' | ||
gaal | ?eval {a=>1,b=>2}.perl | ||
evalbot6 | '{(\'a\' => 1), (\'b\' => 2)}' | ||
gaal | on the command line, this: | ||
./pugs -e 'say {a=>1,b=>2}.perl' | |||
gives this: | |||
a 1 b 2\undef | 11:19 | ||
Aankhen`` | Same Pugs version? | ||
gaal | r5904 | ||
?eval $PUGS_VERSION | |||
evalbot6 | Error: Undeclared variable: "$PUGS_VERSION" | ||
Aankhen`` | ?eval $?PUGS_VERSION | ||
evalbot6 | \'Perl6 User\'s Golfing System, version 6.2.8, July 13, 2005 (r5904)' | ||
Aankhen`` | I can't confirm, unfortunately; going through `make test`. | 11:20 | |
gaal | then you already have a pugs :) | ||
Aankhen`` | Oh yeah. | ||
Silly me. | |||
iblech | ?eval say {a=>1,b=>2}.perl | ||
evalbot6 | a 1b 2\'perl6' bool::true | ||
iblech | ?eval say ({a=>1,b=>2}.perl) | ||
evalbot6 | {('a' => 1), ('b' => 2)} bool::true | ||
gaal | hey, say's back. cool.. | ||
Aankhen`` | Same behaviour here, yeh. | 11:21 | |
Hiya iblech. :-) | |||
gaal | where'd that "perl6" come in from? | ||
Aankhen`` | o_O | ||
gaal | i have "\undef", which is wrong but less surprising. | ||
iblech | It seems it's parsed as (say {a => 1, b => 2}).perl -- the stringification of the hashref is "a\t1\nb\t2", and the result of the say is undef... | 11:22 | |
Hi :) | |||
That's probably from evalhelper.p5's implementation of &say | |||
gaal | hmm. what's say's return value specced to be? | 11:23 | |
Aankhen`` | wolverian: Ping. | ||
gaal | i'd assume p5 semantics? | ||
iblech | Yep, 1 if the print worked, 0 (or false) otherwise | ||
putter: pong | |||
gaal | fail would be nice... | ||
how useful is a 1 anyway? | 11:24 | ||
the string printed might be nice. | 11:25 | ||
s/nice/more useful/ | |||
iblech | Hm, I like fail... Probably it is fail, as I remember reading that &open fail()s too | 11:26 | |
Aankhen`` | Why does `make install` trigger re-compilation of Pugs.Run and the pre-compiled modules? | ||
gaal | weird, why did that say originally return undef? i'm looking at the code and it looks correct | 11:27 | |
return $ VBool True | |||
Aankhen``: make smoke does, too :( i don't know how to fix this dependency business | |||
Aankhen`` | :-\ | 11:28 | |
gaal, got a minute? | 11:38 | ||
gaal | sure | ||
Aankhen`` | Could you see whether test 55 of t/builtins/io/io.t fails for you? | 11:39 | |
gaal | perlcabal.org/gaal/smoke_xp.html will be up in a sec :-) | 11:40 | |
Aankhen`` | Ah, great! | ||
I just want to make sure I didn't break the Prelude. :-) | 11:41 | ||
gaal | up. | ||
Aankhen`` | Yay. | ||
gaal++ | |||
Not Found | |||
The requested URL /gaal/smoke_xp.html was not found on this server. | |||
gaal | missed a ~ there. | 11:42 | |
perlcabal.org/~gaal/smoke_xp.html | |||
Aankhen`` | Ah. | ||
gaal | oops :) | ||
Aankhen`` | Hehe. | ||
gaal | so, yeah, it fails. | ||
Aankhen`` nods. | 11:43 | ||
gaal has a temperature and a sore throat :( | |||
Aankhen`` | Awww. :-( | ||
gaal | does any string evaluate as false in perl 6? | 11:48 | |
?eval ?"" | |||
evalbot6 | bool::false | ||
gaal | ?eval ?"0" | ||
evalbot6 | bool::false | ||
gaal | ?eval ?"1" | ||
evalbot6 | bool::true | ||
gaal | ah. :) | ||
?eval ?"0 but weird" | 11:49 | ||
evalbot6 | bool::true | ||
gaal | ?eval ?"00" | ||
evalbot6 | bool::true | ||
Aankhen`` | I've created a `role Iter` in the Prelude, and modified `IO` and `Str` to `does Iter`. | ||
`Iter` defines &prefix:<=> like so: multi sub prefix:<=> (Iterator $self: ) { $self.shift() } | |||
Um, that's Iter $self:. | |||
gaal | cool | 11:50 | |
Aankhen`` | And method shift () { ... } | ||
gaal | ?eval ?"0\n" | 11:52 | |
evalbot6 | bool::true | ||
gaal | ?eval "" ~~ bool::false | 11:53 | |
evalbot6 | bool::true | ||
Aankhen`` | Hmmmmmmm. | 11:58 | |
Any objections to my implementing a mutating `map` and `grep` in Prelude.pm? | |||
gaal | i know i want them... but this looks like a Q for the language list | 12:00 | |
Aankhen`` | Well, it's there in S29. | ||
gaal looks | |||
Aankhen`` | Rather, they are already specified in S29. | ||
?eval sub foo () { }; sub bar ($foo) { }; sub baz ($foo, *@bar) { }; (&foo.arity, &bar.arity, &baz.arity) | 12:01 | ||
evalbot6 | (0, 1, 2) | ||
Aankhen`` | ?eval sub foo () { }; sub bar ($foo) { }; sub baz ($foo, *@bar, +$baz) { }; (&foo.arity, &bar.arity, &baz.arity) | ||
evalbot6 | (0, 1, 3) | ||
nothingmuch | is destructive map MMD? | ||
Aankhen`` | nothingmuch: Wha? | ||
nothingmuch | e.g. class array { method map (@input is rw) returns Void { ... } } | 12:02 | |
that is - it cannot be used in non void context | |||
and it must be matched against mutable types | |||
Aankhen`` | I don't understand. | ||
gaal | A: what makes the s29 map mutating? | 12:04 | |
Aankhen`` | gaal: S29 map isn't mutating. | ||
gaal | ah | ||
Aankhen`` | But there's a t/builtins/lists/mutating_listops.t which appears to require mutating `map`. | ||
And `grep`. | 12:05 | ||
gaal | for a while didn't is rw work in map? i seem to remember | ||
anyway | |||
i need to lie down a bit | |||
later :) | |||
Aankhen`` | See ya. | ||
iblech | re. m19s28.vlinux.de/iblech/stuff/not_p...moke.html, 43.75% ok :) | 12:17 | |
svnbot6 | r5905 | Aankhen++ | * Prelude.pm: made formatting more consistent; fixed typo. | ||
r5906 | Aankhen++ | * Prelude.pm: added Iter role, and modified IO and Str accordingly. | |||
iblech | (Spidermonkey's /bin/js)++ # Approximately as fast as normal Pugs | ||
Firefox-- # sloow | |||
Most tests fail because a. feature not yet implemented, b. they use eval, or c. a scalar container ($foo) holds an aggregate, not a scalar (fixing this currently) | 12:19 | ||
Aankhen`` | ?eval $?PUGS_VERSION | 12:21 | |
evalbot6 | \'Perl6 User\'s Golfing System, version 6.2.8, July 13, 2005 (r5906)' | ||
Aankhen`` | How come my Pugs doesn't show the revision? | ||
integral | Aankhen``: checked out by svn, svk or other? | 12:22 | |
Aankhen`` | SVK. | 12:23 | |
integral | and you're using a local branch? | ||
Aankhen`` | Yes. | ||
integral | the script for getting the revision number (util/version_h.pl) when working with svk tries to look for the revision number of the upstream repository, not the local revision number. I think it's so there's no confusion | ||
Aankhen`` | Ah. | 12:24 | |
integral | hmm, I think I wrote this, so it is to avoid confusion :) | 12:25 | |
nothingmuch | seen ingy | ||
jabbot | nothingmuch: ingy was seen 1 days 15 hours 32 minutes 55 seconds ago | ||
nothingmuch | rats | ||
QtPlatypus | Is anyone else having trouble connecting to news.perl.org ? | 12:26 | |
I guess everyone isn't having any problem with it, all there all idle. | 12:34 | ||
autrijus | PIL2JS 43.75% OK? holy lambda. | 12:57 | |
clkao | crazy | ||
Aankhen`` | QtPlatypus: news.perl.org redirects use.perl.org, which is working... | ||
Redirects to, even. | 13:01 | ||
Aankhen`` steps away from the computer. | |||
nothingmuch makes large cat sounds | 13:14 | ||
has anyone here got any Test::Base fu? | 13:15 | ||
autrijus | me. | 13:20 | |
not terribly fluent, but passable. | |||
nothingmuch | autrijus: i am trying to fudge some stuff | 13:27 | |
with skip | |||
you know my p5orth test suite? | |||
i just did mutual recursion this morning (3 minutes - a small change in the forth prelude... isn't that amazing?) | |||
and now i defined a convenience word: ":deferred" | |||
so you can say: | |||
defer even | 13:28 | ||
: odd ?dup if 1 - even else false then ; | |||
:deferred even ?dup if 1 - odd else false then ; | |||
but gforth doesn't have :deferredc | |||
so in my test spec i want to say: | |||
=== :deferred | |||
--- skip: gforth | |||
--- forth | 13:29 | ||
... | |||
and I just did that, it's not that bad a hack either | |||
and I would like ingy to apply it, or judge it | |||
and since ingy isn't here i'd like a Test::Base moose to judge it | |||
autrijus | rehi | 13:32 | |
(was rebooting) | |||
ok. let me look at the patch? | 13:33 | ||
nothingmuch | sure | 13:37 | |
pasteling | "nothingmuch" at 212.143.91.217 pasted "Test::Base patch" (188 lines, 5.1K) at sial.org/pbot/12084 | 13:39 | |
nothingmuch | oops | ||
that's a dumb patch | |||
pasteling | "nothingmuch" at 212.143.91.217 pasted "Test::Base patch" (144 lines, 3.9K) at sial.org/pbot/12085 | 13:40 | |
nothingmuch | okay, that makes more sense | ||
it does two things: | |||
makes --- SKIP in to a test builder skip | |||
autrijus | looks pretty good | 13:41 | |
also you force a plan number | |||
nothingmuch | and --- skip into the same thing, only after eval | ||
and yes, it forces a plan number | |||
autrijus | so three things in all | ||
nothingmuch | true | ||
autrijus | it looks good to me. send to ingy? | ||
nothingmuch | will do | 13:42 | |
i think this is a nice example of how functional programming can be more flexible than OOp | |||
autrijus | well nowadays most OOP languages admit first class functions anyway. | 13:43 | |
other than cobol, I mean java | |||
nothingmuch | true | ||
but most people I know don't use them | |||
except for things like callbacks | 13:44 | ||
autrijus | the main tension is pro-data or pro-operation | ||
termed the "expression problem" | |||
nothingmuch | i think they are not really in a tension | ||
autrijus | I highly recommend you look into the original wadler link and Scala's solution | ||
(both linked from my journal of yesterday) | |||
nothingmuch | you can usually slice each sub apart | ||
line by line | |||
and determine which line is either this or that | |||
autrijus | nothingmuch: the main problem is that it takes a lot of effort in Haskell if you add new construcor variants to a "data" declaration | 13:45 | |
while it takes a lot of effort in (say) Java to add a new method to a bunch of classes. | |||
nothingmuch goes to read | |||
how would you say perl 6 is in this respect? | |||
autrijus | generics + MMD solves this nicely | 13:46 | |
just as the Scala paper had it | |||
nothingmuch | hmm | ||
what is the date on your side of the world? | |||
autrijus | (MMD let you define methods outside class; generics lets you pass type parameters around) | ||
2005年 7月30日 周六 21時46分49秒 CST | |||
jabbot | autrijus: 2005年 7月30日是星期六 | ||
autrijus | er | ||
sorry, 2005-07-30 | 13:47 | ||
nothingmuch | and did you wake up today, or yesterday? | ||
autrijus | I woke up 6 hours ago. | ||
nothingmuch is trying to determine if "yesterday" really means yesterday, and then sees that there is only one journal entry that can be either | |||
autrijus | right. | ||
nothingmuch | anyway, should i just follow the Scalar link? | 13:48 | |
and will you please join the cabal temporarily so that we can have proper type support? | |||
autrijus | the "solution" link | ||
tho the "expression problem" is fun too | |||
eh, what does that has to do with this? | |||
nothingmuch | i'm just not getting the impression that anybody that in @Larry but luke really cares what will happen to the type system | 13:49 | |
autrijus | oh Damian cares too | ||
he's the one that brought intersection types and generics up originally | |||
nothingmuch | ah | ||
but we still don't have a definition of parametrized and relational types, right? | 13:50 | ||
autrijus | actually we do, S06 has them, it's just the semantics are very unclear | ||
I already identified the problem spots as I can see them and posted to p6l | 13:51 | ||
nothingmuch remembered it as a very thin example | |||
so can we say "this method takes an object that does Moose and returns a subroutine that returns (an object that contains an object of type Moose)"? | |||
sub moose_container (Moose $x) { [ $x ] }; | 13:52 | ||
sub moose_container (Moose $x) { { the_key => $x } }; | |||
s/sub/multi/; | |||
autrijus | multi foo (Moose $x) returns Any of Moose { ... } | 13:53 | |
multi foo (Moose $x) returns Source of Moose { ... } | |||
(hypothetically adopting the Source/Sink behaviour) | |||
but really, you want | |||
nothingmuch | err, i meant | ||
autrijus | foo (Moose $x) returns (Array|Hash) of Moose { ... } | 13:54 | |
nothingmuch | sub moose_container (Moose $x) { -> { [ $x ] } } | ||
autrijus | oh | ||
nothingmuch | i think there is too much orthogonality in the perl 6 type system to allow 'Moose of Elk' to capture it well | ||
autrijus | returns (Code returns Moose) | ||
nothingmuch | right | ||
autrijus | returns (Code of () returns Moose) | ||
nothingmuch | can we manipulate types as first class objects? | 13:55 | |
autrijus | sure | 13:56 | |
at runtime | |||
nothingmuch | what is the type of a type? | ||
autrijus | Type, supposedly | ||
nothingmuch | an object of type Type? | ||
that is both liberating and limiting | |||
because i would like a Type to be parametrized on it's value | |||
autrijus | that's called dependent types. | 13:57 | |
nothingmuch | well, yes, and no | ||
autrijus | speak in code please :) | ||
nothingmuch | yes, i'm trying | ||
my Moose $x; | |||
$x.container.meta.type is Type of Moose; | |||
it's also just a Type | 13:58 | ||
damnit! someone resubscribed me to the most bullshitting list in the world | |||
what is the type signature of 'ref'? | 13:59 | ||
autrijus | &ref? | ||
nothingmuch | i would say 'sub ref ((:a) $x) { Type of :a }; | ||
yes | |||
autrijus | sub ref (Any $x) returns Type; | 14:00 | |
nothingmuch | see, that sort of sucks | ||
i really meant: | |||
autrijus | my p6l proposal has this: | ||
nothingmuch | sub ref ((:a) $x) returns Type of :a { Type of :a }; | ||
autrijus | sub ref (Any $x) returns Type of ref($x); | ||
essentially having ref() as a type form | 14:01 | ||
nothingmuch | hmm | ||
fair enough | |||
autrijus | sub one_of ($x, $y of ref($x)) returns ref($x) { rand(2) ?? $x :: $y } | ||
this has the good property in that we avoid type variables. | |||
which never felt perlish to me anyway | |||
nothingmuch | i think i want both this and type variables | 14:02 | |
side tracking: | |||
autrijus | but the only place the spec has tyvar is on generic roles | ||
nothingmuch | can you define a variable in the parameter list that isn't a parameter? | ||
autrijus | and I'm not even sure we what it there. | ||
nothingmuch: huh? | |||
nothingmuch | sub moose ($x, ... # somehow define $y here #) { $y available } | 14:03 | |
$y is based on $x | |||
but is not an optional parameter with a default expression that is based on $x | |||
autrijus | sub moose ($x) { my $y := $x; } | ||
what's wrong with this? | |||
nothingmuch | because i'd like to reuse $y in the prototype | 14:04 | |
e.g. $y = ref($x); manipilate $y a bit; ... returns $y; | |||
autrijus | sub moose ($x) returns ref($x).of.blah.bleh {...} | ||
if you want to much with types, use type operators | 14:05 | ||
nothingmuch | type operators? | ||
autrijus | for example, | & ^ of | ||
selectors even | |||
nothingmuch | that's not turing complete | ||
autrijus | ah, you want the compiler to go into infinite loops | ||
how very unkind of you. | |||
nothingmuch | =)/. | 14:06 | |
seriously though | 14:07 | ||
in a language that is not completely compiled in one go | |||
but is optionally compilable at runtime | |||
we need two things: | |||
to be able to give the compile time enough info to be fast | |||
and to give the runtime enough access so it loses no features | |||
and i think there's a bunch of deltas in the type system | 14:08 | ||
autrijus | and I completely agree ;) | ||
nothingmuch | that is - they cannot express everything the runtime can make up | ||
or using them is a compile time only feature | |||
autrijus | the important thing to bear in mind is that perl6 observes the separate compilation doctrine | 14:09 | |
a module provides, to the external world, "link sets" | |||
nothingmuch | right | ||
autrijus | and as such _cannot_ trigger recompilation every time a consumer uses it | ||
that is in direct contrast to perl5 | |||
nothingmuch | but on the other hand if the module defines an import sub | 14:10 | |
which eval's some code | |||
you get something like perl 5 | |||
autrijus | nope. | ||
nothingmuch | nope? | ||
autrijus | let me try to explain | ||
nothingmuch | nono! i will never let you! | ||
autrijus | alright. | ||
I won't explain then | |||
nothingmuch | you have to pay a fee | ||
nothingmuch charges autrijus for one cookie | 14:11 | ||
will you accept the charges? | |||
autrijus | ;) | ||
cookie | 14:12 | ||
nothingmuch | i'll take that as a yes | ||
you may continue | |||
no, i mean an IRL one, the next time we meet | |||
strings are just a representation | |||
autrijus | whatever. | ||
the important thing is | |||
nothingmuch jumps up triumphantly: I GOT A FREE COOKIE! | 14:13 | ||
(rocky soundtrack in the background) | |||
autrijus | in p5, the consumer is allowed to set compilation hints that affects the compilation of the use'd module. | ||
nothingmuch | like? | ||
autrijus | use strict::with::pride; | ||
(bad example) | |||
a better one is | 14:14 | ||
foo.pm: | 14:15 | ||
say 123; | |||
main.pl: | |||
sub foo::say { die }; use foo; | |||
or, more explicitly | 14:16 | ||
foo.pm: | |||
our &boo ::= \&say; | 14:17 | ||
and main.pl being the same. | |||
in p5, &boo always binds to "die" | |||
in p6, it cannot be so. | |||
(actually, ::= &say), but you got the idea. | |||
nothingmuch | yes | 14:19 | |
so how do you change the module's say in perl 6? | 14:20 | ||
no way what so ever? | |||
autrijus | oh, easy | ||
you load its textual content and eval it. | |||
;) | |||
nothingmuch | okay: a distinction is in order | 14:21 | |
in perl 6 compilation is a caching strategy | |||
err 5, not 6 | |||
that is - it's only purpose is to gain speed | |||
it doesn't have any functional effect whatsoever | |||
if it does, that's a bug | |||
in perl 6, on the other hand, a compiled module and the source to compile it are not necessarily parts of the same equasion | 14:22 | ||
autrijus | er, no | ||
p5 has two phases | |||
two runtimes | |||
or rather three | |||
BEGIN, main, eval | |||
eval may contain its own BEGIN main and eval | |||
and so on | |||
to use a module is to eval its textual content in BEGIN time. | |||
nothingmuch | yes | ||
autrijus | in p6, each module is separately compiled from scratch | 14:23 | |
nothingmuch | and eventually you wind up with a tree of compiled stuff in memory | ||
autrijus | as a fresh environment | ||
nothingmuch | okay, rephrasing question: | ||
is the object CompiledModule | |||
a complete blackbox? | |||
does it only have the "exported_symbols" method? | |||
or is it a nested structure | 14:24 | ||
so that $some_module->linked_modules contains Prelude and Guts | |||
and their instances are provided by the runtime | |||
and are the same as the consuming modules | 14:25 | ||
and then the symbols can also be overridden: | |||
Prelude can have it's 'say' replaced | |||
or rather, say, that comes from prelude can be replaced | |||
thus not affecting externally compiled code, just what externally compiled code links to | 14:26 | ||
autrijus | if Prelude has its "say" replaced | ||
it needs to be swapped in with something of equivalent type | |||
otherwise all typecheck was in vain. | |||
nothingmuch | right | 14:27 | |
when rebinding say if you replace it with something typed otherwise it's an error | |||
if you use ::= it's a compile time error | |||
if the types are coerciable | 14:28 | ||
for example sub { die } | |||
the return type of 'die' can be coerced into a string but error or string | |||
and the parameters can be coerced into a the same thing say uses | |||
except the parameters are thrown away | 14:29 | ||
(if there are things like 'where' or defaults which are more than just bindings then this cannot be done automatically) | |||
in a sense, this can be type sound | |||
unless it isn't | |||
in the many cases it is, there shouldn't be a reason for it not to | |||
autrijus | yeah. I'm fine with you hacking in the environment | 14:30 | |
as long as the linkset interface is immutable | |||
sacred, holy, etc | |||
nothingmuch | right | ||
and the only situation that really happens is if everything is unboxed | |||
because you can just pass mock objects around instead | |||
uh, s/un// | 14:31 | ||
nothingmuch ponders the 'faux' operatore | |||
$thing faux Type of ....; | |||
let's say something can't numify | 14:32 | ||
autrijus | Faux pax Americana; | ||
nothingmuch | "Moose" faux Num; | ||
+$faux; # 0 | |||
or can't stringify: | |||
~(Something.new faux String); # "DUMMY" | 14:33 | ||
nothingmuch sidetracks again: | 14:36 | ||
can unboxing be generalized? | |||
autrijus | I'm of the opinion that value types is a myth, so don't ask me | 14:37 | |
nothingmuch | especially WRT accessors for objects of closed classes | ||
autrijus | I think value types is valid | 14:38 | |
and value types should handle (un)boxing automagically | |||
nothingmuch | hmm | ||
autrijus | and that's all. | ||
nothingmuch | please accurately define value types | ||
Int et al? | |||
autrijus | right, base types that has no notion of identity | 14:39 | |
nothingmuch | why? | ||
autrijus | 1 =:= 1 | 14:40 | |
1 =:= 2 | |||
also, it makes little sense to derive from value types. | |||
nothingmuch | right | ||
but why stop at that? | |||
class Foo { has $moose }; | |||
if Foo is closed and not basal, | 14:41 | ||
is there any reason to make 'my Foo $x; $x.moose' a method call? | |||
it should be an O(1) lookup | |||
since we have all the required knowlege at compile time: | |||
what is the definition of Foo | |||
what is in a moose | |||
what is the type of the method moose | 14:42 | ||
whether or not Foo can change | |||
autrijus | really. what is the type? | ||
nothingmuch | and what concrete types can be a Foo | ||
in this example Any or whatever the default type of is | |||
and scalar | |||
autrijus | &moose:(Foo) returns Any? | ||
nothingmuch | yup | 14:43 | |
autrijus | thing is Foo can't be guaranteed as closed :-/ | ||
nothingmuch | $moose can contain anything | ||
no it isn't | |||
autrijus | which calls for two compilations, but we covered that in hackathon | ||
nothingmuch | i'm talking just about the accessor | ||
you don't need to do something along the lines of $x.meta.class.find_method("moose"). | |||
autrijus | and I agree :) | ||
nothingmuch | since you can assume that lookup will be constant, given your knowlege now that you are compiling it | 14:44 | |
autrijus | now, consider this | ||
nothingmuch | this is just static dispatch | ||
no for the unboxing: | 14:45 | ||
autrijus | class Foo { has Foo $moose }; my Foo $x; $x.moose.moose; | ||
can the second .moose call be done in O(1) as well? | |||
nothingmuch | given $x.meta.class.find_method("moose") { when Accessor { # compile unboxed } default { # compile a call } } | ||
no | |||
autrijus | why? | ||
nothingmuch | wait | ||
does method chaining in perl 6 behave differently? | |||
autrijus | it's same as p5. | 14:46 | |
nothingmuch | ($x.moose) can be compiled to an access directly into $x's structure | ||
autrijus | $x->moose->moose; | ||
nothingmuch | that can be of type any | ||
okay | |||
autrijus | but I declared | ||
has Foo $.moose; | |||
nothingmuch | oh, i didn't notice | ||
yes it can | |||
autrijus | but why? | ||
because we have a type inferencer? ;) | |||
nothingmuch | yes =) | ||
autrijus | a local type inferencing propagation engine? | ||
that's what I'm arguing for :) | 14:47 | ||
nothingmuch | but at this level it's just an optimization | ||
which we already have | |||
autrijus | no, it can also reject programs. | ||
nothingmuch | oh, right | ||
autrijus | $x.moose.goose; # instant death under closed/final | ||
nothingmuch | okay, in that case it's what i've been arguing for all along =D | ||
huraah! | |||
nothingmuch does the Sound Type dance | 14:48 | ||
autrijus | and severe warning -- i.e. has to be turned off specifically -- by default. | ||
nothingmuch | i don't see why | ||
autrijus | why warning? | ||
nothingmuch | there is absolutely no scenario where this will not croak at runtime if Foo was closed | ||
autrijus | nope. | ||
nothingmuch | or am I missing something? | ||
autrijus | multi goose (Foo $x) {1} | ||
nothingmuch | foo is closed | 14:49 | |
it can't be extended | |||
autrijus | class Bar { method goose }; Foo is reopened does Bar; | ||
nothingmuch | reopened?! | ||
autrijus | (also MMD doesn't mean extension usually.) | ||
nothingmuch | you don't gain anything from closed if you have reopen | ||
well, it might not "mean" extension in the logical sense | 14:50 | ||
but in effect by declaring a multimethod you're modifying the types of all the involved parameters | |||
autrijus | ...which is why they are much better than visitor patterns... | ||
nothingmuch | since they have added functionality when they are combined | ||
autrijus | because they don't require anything on the behalf of original author of Foo | 14:51 | |
nothingmuch | right | ||
autrijus | even inder closed + final | ||
nothingmuch | except that you have an unclosed version of the module | ||
eep | |||
multi sub &infix:<+> (Int, MyType); | |||
autrijus | although I'm also arguing that if you "close" current scope | 14:52 | |
nothingmuch | that breaks all unboxing whatsoever | ||
autrijus | i.e. not only :classes<close> but also :packages | ||
then the only way to introduce multi goose is by "my sub" or "my multi" | |||
which is fine, because that'd be lexical. | |||
nothingmuch | hmm | ||
autrijus | and an "eval" won't be able to propagate out. | ||
nothingmuch | i think the following closing semantics are sane: | ||
closedness of a class is lexically scoped to it's consumers | 14:53 | ||
that is Foo is closed to our $x.moose.moose call | |||
but unclosed bytecode is retained | |||
autrijus | (I agree totally :)) | ||
nothingmuch | and a block that declares 'my goose (Foo $x) { 1 }' will have to use the open one | ||
autrijus | (yes. we've discussed this in hackathon.) :) | ||
nothingmuch | ah =) | ||
really? i must have zoned out | |||
autrijus | you were drunk. | ||
nothingmuch | i was not drunk | 14:54 | |
autrijus | okay, then something worse | ||
nothingmuch | i was sleep deprived | ||
autrijus | ah. | ||
nothingmuch | during the hackathon i slept about 4-5 hours a night | ||
went to bed late for Canada | |||
autrijus | well the behaviour interface is isomorphic | ||
nothingmuch | woke up late for Israel | ||
(which is 5-6 am canada) | |||
except on the last days | |||
stevan remembers nothingmuch being drunk quite often | |||
autrijus | nodnod | ||
nothingmuch | stevan: i drank a lot of beer | 14:55 | |
and i'm clumsy when sober | |||
stevan | burning pizzas and such | ||
nothingmuch | so i think you got the wrong impression | ||
that was a type coercion problem | |||
i explicitly said "Baking paper" | |||
and then john said "you mean wax paper?" | |||
and I made a bad optimization assuming "wax" means "baking" in canadian | |||
autrijus: do @Larry agree with us? | 14:57 | ||
because I was really traumatized when on the last or second day of YAPC when we were up in your room, and you mentioned that our type inferrencer is just optimizing, not type checking | |||
autrijus | nothingmuch: I have no idea. we'll see how @Larry replies to my mails in the previous two days. | 14:58 | |
nothingmuch | okay | 14:59 | |
autrijus | TSa is very supportive, but he argues from a far more static position, so I'm not surprised. | ||
nothingmuch | i have to reread them | ||
admittedly i only skimmed | |||
anyway, i feel like forthing a bit more | 15:00 | ||
autrijus | that's fine, the main proposal is www.nntp.perl.org/group/perl.perl6.compiler/1000 | ||
sure, go ahead. have fun :) | |||
nothingmuch | i want to port most of p5orth to forth | ||
so that I don't have to code that much haskell ;-) | |||
autrijus wonders if nothingmuch will enjoy Joy | |||
nothingmuch | that's not very googleable | 15:01 | |
autrijus | nothingmuch: well if you like the lack of parens as much as schemers like parens, then forth is very deep and fun indeed :) | ||
www.latrobe.edu.au/philosophy/phimvt/joy.html | |||
nothingmuch | parens ini lisp are just syntax | ||
autrijus | lisp interpreter in joy: www.latrobe.edu.au/philosophy/phimv...lsplib.joy | 15:02 | |
nothingmuch | scheme is just a tree | ||
forth is just an array | |||
autrijus | yes. | ||
nothingmuch | but when you create the array you get to pretend it's a tree | ||
so hence forth has higher order macros, not functions =) | |||
autrijus | and Joy to Forth is a bit like Perl5 to Perl4, if I may :) | 15:03 | |
nothingmuch | wow, that's sounds pretty | 15:04 | |
wowowowww, that's so cool | |||
en.wikipedia.org/wiki/Joy_programming_language | |||
the SQUARE | |||
if i got it right | 15:05 | ||
wait, is it pushing '*' on the stack or not? | |||
autrijus | yes. | 15:06 | |
nothingmuch | *phew* | ||
that explanation is not very good | |||
autrijus | I prefer www.latrobe.edu.au/philosophy/phimv...y/faq.html | ||
nothingmuch | okay, where is the distinction? | ||
why isn't '.' applied to 'dup'? | 15:07 | ||
how do i get a higher order dup? just quasi quote it? | |||
autrijus | the . is not there | ||
the . is ending DEFINE | 15:08 | ||
nothingmuch | oh | ||
autrijus | yes, quasiquoting is happy | ||
[1 2 3 4] [dup *] map | |||
===> evaluates to [1 4 9 16] | |||
fun eh. | |||
nothingmuch | so basically the only place where you can evaluate is top level? | ||
autrijus | right. that's what a pure functional language means. | 15:09 | |
see haskell :) | |||
nothingmuch | because if I said DEFINE moose = [1 2 3 4] [dup *] map . | ||
and then I said moose | |||
it's like i said [[1 2 3 ...] map ], right? | |||
didn't say pure on the top of that page | |||
wikipedia, that is | |||
autrijus | I think so, yes, it's referentially transparent | ||
oh. www.latrobe.edu.au/philosophy/phimv...h-joy.html | |||
it's the first sentence. | |||
"The language Joy is a purely functional programming language." | 15:10 | ||
nothingmuch | "The Joy programming language is a simple functional programming language" | ||
damn wikipedia | |||
since when are "purely" and "simple" intgerchangiable?! | |||
autrijus | changed wikipedia. | ||
it now says "purely". | |||
nothingmuch | =) | 15:11 | |
autrijus praises the writable web | |||
brentdax | My little project is nearly at the same level of external sophistication as a basic wiki. | ||
nothingmuch | brentdax: @{ } | 15:12 | |
autrijus | brentdax: ooh | ||
nothingmuch: so, Joy's style is utterly pointless | |||
I mean point-free | |||
nothingmuch | =) | ||
autrijus | and because of this, it agrees with the Forth structure perfectly | 15:13 | |
I think it's a wonderful language to play with :) | |||
nothingmuch wonders what you can do with it | |||
brentdax | You can edit now with a preview mode. I need to refactor to allow page creation, though. After that, all it needs is a markup language for formatting and a little tweaking to the link-resolving code. | ||
autrijus | larry is still thinking about my posts, I hope... he just fielded the simple ones | ||
brentdax: demo demo | 15:14 | ||
nothingmuch | brentdax: by @{ } i meant: please dereference the reference to your little project, i don | ||
't know what it is =) | |||
brentdax | Ah--WWW::Kontent, my Summer of Code project. | ||
autrijus | oh, it's Kombat, his Winter of Microsoft project | ||
brentdax | autrijus: takes about ten seconds to run a request on my laptop--I'd be insane to put it on a web server. | 15:15 | |
nothingmuch | ah | ||
autrijus | brentdax: url to code? | ||
nothingmuch | brentdax: perl6.nl | ||
feather.perl6.nl | |||
brentdax | svn.brentdax.com/kontent/trunk | 15:17 | |
nothingmuch wonders how implementing Joy in Forth might be | 15:18 | ||
oh my, refactoring is indeed in order | 15:22 | ||
i reimplemented ' as a word | |||
when I had it implemented as a primitive ;-) | 15:23 | ||
nothingmuch is very very evil | 15:38 | ||
svnbot6 | r5907 | Stevan++ | Perl6::MetaModel - (p5) | ||
r5907 | Stevan++ | * moved all the magic in AUTOLOAD into ::dispatch | |||
r5907 | Stevan++ | - first step in refactoring out Perl 5 sugar | |||
autrijus | oooh. | ||
stevan++ | |||
nothingmuch thinks of adding forth code which will take listed data stack ops | |||
copy them | |||
relocate | |||
and then replace all the stack primitives in use by traversing the tree | |||
to generate RDUP from DUP, etc | |||
and to do this in the forth prelude | 15:39 | ||
stevan++ | |||
will i be bitchslapped for this? | |||
autrijus | iblech: you there? | 15:42 | |
iblech | autrijus: Yep | 15:43 | |
autrijus | care to lay out your preferred container semantics? | 15:44 | |
I'm working on formalism now | |||
so I think I should start with the PIL2JS treatments | 15:45 | ||
iblech | Sure :) | ||
autrijus | so the bulk of code is in lib6/Prelude/JS/ContainerName.pm? | ||
iblech | No, that file doesn't exist :) Most of it is in libjs/PIL2JS.js, the .GET, .STORE, and .BINDTO methods of PIL2JS.Box | 15:46 | |
autrijus | ok. | 15:47 | |
iblech | The general idea is that a variable name points to a container, and containers have the .GET method (returns the unboxed value), .STORE, and .BINDTO (basically this.GET = other.GET, this.STORE = other.STORE, etc.) | ||
Every container has a .uid attribute which is used for =:= | |||
autrijus | the STORE case is just for lvalue positions? | 15:48 | |
iblech | Right. | 15:49 | |
autrijus | and if BINDTO preserves uid, don't we need a clone? | ||
i.e. just like BINDTO but with different uid | |||
iblech | PIL2JS.Box is the only real container class, PIL2JS.Box.Constant's .STORE only die()s. | ||
autrijus | or, alternatively, a "copy" primitve operation on containers | ||
oh nvm, you already have it. | 15:50 | ||
just not spelled as CLONE | |||
iblech | Yep, .STORE is used for that: my $a = $b is container_of_a.STORE(b), and .STORE sets this.value = b.GET() | ||
autrijus | // Needed for "is copy". | ||
clone: function () { | |||
return new PIL2JS.Box(this.GET()); | |||
}, | |||
I'm referring to this | 15:51 | ||
that implementation looks suspicious | 15:52 | ||
iblech | .clone is only a convenience function. For is copy support, I could emit $a = $a (container_of_a.STORE(container_of_a)), too | 15:53 | |
How so? It returns a new variable container, initialized with the current contents | |||
autrijus | nvm, I was confused by the relation to perl6's .clone. | 15:54 | |
(which is deep) | |||
never mind me :) | |||
iblech | Right. This is why I've renamed it to .copy here :) | 15:55 | |
autrijus | good. | ||
so, why is BINDTO a prim? | 15:56 | ||
why is it not modifying the symbol table? | |||
i.e. why should a box be able to bind to another box of different shape? | 15:57 | ||
I can see NEW, FETCH, STORE, but I still don't quite grok BINDTO. | |||
iblech | "We can't just use C<dest = source>, because C<dest> might be the result of some | ||
function, e.g. C<@array[$idx] := $foo>." | |||
(from README) | |||
autrijus | I see. | ||
so this calls to yet another underlying level in the host environment | 15:59 | ||
that can maintain reallocation | |||
in Hs we used writeTVar for BINDTO, essentially, without naming it | |||
so, is this the shape for all containers, or just scalar containers? | |||
iblech | For all. | 16:00 | |
autrijus | so if I implement "tiescalar", I'm implementing something on a higher level. | ||
or "tiehash" etc. | |||
iblech | "Why isn't there a array_fetchElem?" -- Simply because I didn't need it -- i.e. some_array_container.GET().push(...) works fine | ||
(or some_array_container.GET()[...], for that matter) | 16:01 | ||
autrijus | still thinking | 16:02 | |
iblech | I think so. There's PIL2JS.Box.Proxy, too, but that's one the same level as PIL2JS.Box. It's used in &postcircumfix:<[ ]> and &postcircumfix:<{ }> | ||
autrijus | ok. | 16:03 | |
so when I run BINDTO, I basically overwrite both my uid and my content | 16:04 | ||
iblech | Yep. | ||
Which is effectively the same as container_a = container_b, but works with function return values, too | |||
autrijus | in haskell: | 16:05 | |
data Container = TVar (Box a) | |||
data Box a = MkBox { uid :: Unique , content :: a } | |||
does that look correct? | |||
"a container is a mutable reference to a Box that carries its type" | |||
"a Box is a uid, with a content of some type" | 16:06 | ||
iblech | Yep. | ||
autrijus | now the hard question! | ||
in general you can't replace one content with another unless they are of the same type "a". | |||
is the type "a" essentially "Dynamic"? | |||
i.e. you can bind anything to anything. | |||
(I've read your posts, so I'm intentionally applying the socrates method) :) | 16:07 | ||
my Int $x; my Num $y; $x := $y; | 16:08 | ||
is essentially what I'm asking. | |||
assuming that the "Int" is 'a' here, i.e. we actually allocate different storage for different types. | |||
iblech | Hm... I'd say that works, as the type is associated with the .value. But you can't %a := @b | 16:09 | |
Err | |||
It should not typecheck, of course. | 16:10 | ||
But my $x = 3; my $y = [...]; $x := $y should work | |||
autrijus | how about | ||
my Int $x = 3; my $y = [...]; $x := $y; | |||
? | 16:11 | ||
this is really a hard question, because as you observed | |||
%a := @b; # should be runtime error even passed typechecker | |||
but currently nothing in p6 explicitly forbids this. | 16:12 | ||
iblech | Should not work, as [...] is not an Int. The type declarations are attached to the varname, I think -- if you see a "my Int $x" you should be able to be sure that $x is always a Int, even if some code rebinds $a somewhere | ||
autrijus | ?eval my %a := [1..10]; %a[0] | ||
evalbot6 | [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | ||
autrijus | ?eval my %a := (1..10); %a[0] | ||
evalbot6 | \1 | ||
autrijus | okay. so | 16:13 | |
my %a | |||
means | |||
my Hash %a; | |||
essentially. | |||
(disregarding the fact that it means 'hash of hash' in external language) | |||
(I mean in internal language) | |||
iblech: so. try this | |||
my $x; $x := 3; $x := "Hello"; | 16:14 | ||
iblech | I think the reason %h := @a should not work is not of the types of the values in the containers, but because of incompatible container types (HASH vs. ARRAY) | ||
autrijus | valid? | ||
I expect you to say valid. :) | |||
iblech | Yep, as $x is of type Any, and both 3 and "Hello" are Anys | ||
:) | |||
autrijus | ok. so our definition is wrong | ||
data Container = TVar (Box a) | |||
data Box a = MkBox | |||
{ uid :: Unique | |||
, value :: forall b. b < a | 16:15 | ||
} | |||
is the desired semantics | |||
now, who decides the '<' relationship. | |||
if I had said | 16:16 | ||
iblech | Probably, but as I don't know what forall b. b < a means, I can't say for sure :) | ||
autrijus | oh, it means "all values that instantiates this type needs to be a subtype of a" | ||
< is the subtype notation | |||
iblech | Ok | ||
autrijus | so Int < Any | ||
but not the other way around | |||
so, now | 16:17 | ||
my Int $x; $x := &say; | |||
is obviously bogus | |||
iblech | Right. | ||
autrijus | but can I say | ||
role Code is reopened does Int {...} | |||
? | |||
and expect that to work | 16:18 | ||
iblech | I think so. | ||
autrijus | good. we are in agreement then :) | ||
iblech | :) | ||
autrijus | ok, now let's look at the scalar type. | 16:19 | |
integral | iblech++ autrijus++ | ||
autrijus | formalization++ :) | ||
what does scalar provide beyond a simple container? | |||
iblech | Nothing, I think. | 16:20 | |
autrijus | I can think of one thing | 16:21 | |
namely the TIE and UNTIE primitives. | |||
my $x; tie($x => OtherClass); untie($x); | |||
for the duration of the program, OtherClass is supposed to provide STORE and FETCH | 16:22 | ||
until untie() | |||
iblech | Oh, right. | ||
integral | does tie like that exist? (or need to?) | 16:23 | |
autrijus | integral: yes and yes | ||
iblech | But OtherClass doesn't have, of course, any influence on BINDTO. | ||
autrijus | yes. | ||
autrijus wonders when will we start to disagree | |||
autrijus is thinking | 16:24 | ||
so, a scalar augments a container's interface | 16:25 | ||
making it a subtype of a container | |||
still thinking | |||
we can adopt an open-world view or a closed-world view. | 16:26 | ||
a closed-world view says there are limited forms of container types | |||
and &tie can deduce them base on simple casing | |||
wolverian | Aankhen``, pong | 16:27 | |
Aankhen`` | wolverian: Hola. | ||
autrijus | under that view, the language provides several mutually incompatible tie interfaces, and that's all | ||
wolverian | hello. I've been away a bit. :) | ||
Aankhen`` | I was wondering: are you planning to port URI? | ||
s/port/refactor/ as appropriate. | |||
wolverian | Aankhen``, yes, but I've been really tired now; my medication hasn't kicked in yet. | 16:28 | |
autrijus | see the definition of IVar for an example of closed world | ||
do you think it makes sense? | |||
Aankhen`` | wolverian: What happened? | ||
wolverian | I sleep 16 hours a day and I'm tired the rest. | ||
Aankhen``, hypothyroidism. | |||
autrijus | (this is about tieability, not about container allocation per se) | 16:29 | |
Aankhen`` | Ah. | ||
iblech | autrijus: I think that'll work. | 16:30 | |
autrijus | an open-world view will mean that you can selectively tie anything. | ||
i.e. only tie FETCH but not STORE | |||
wolverian | Aankhen``, I guess I'm out of it for a month still, or so. :\ | ||
iblech | But one can emulate not tieing STORE by simple relaying STORE requests to the original container | 16:31 | |
Aankhen`` | wolverian: S'okay. Take your time. | ||
autrijus | or tie both PRINTLINE _and_ KEYS. | ||
wolverian | thanks. I will. :) | ||
Aankhen`` | wolverian: Is it curable? | ||
autrijus | although with the ability of MMD'ing &{} %{} @{}, there's little gain in doing that. | 16:32 | |
wolverian | Aankhen``, yes, simply by administering thyroxine, the hormone the thyroid gland is supposed to produce. | ||
Aankhen`` | wolverian: I see. | ||
wolverian | Aankhen``, it however takes a long time for the hormone levels to rise back to normal. it is also tricky to find the right amount to take daily. | 16:33 | |
autrijus | okay, closed world then. next question. who inhabits this closed world? | ||
Scalar, Handle, Array, Hash, obviously. | |||
Aankhen`` | wolverian: OK. Anyway, don't mind me, it was nothing important. Go rest. | ||
iblech | Right. I think many of Perl 5's SPECIALTIESUBS aren't needed in P6, as they're simple method/mmd calls | ||
autrijus | yup. | ||
but still tie acts on container and mmd on value | 16:34 | ||
so mmd can be open but it makes sense for tie to be closed. | |||
wolverian | Aankhen``, nah, I have a few hours now of being semiawake. :) or an hour. that goes pretty much to checking the mailing lists and planets. and you guys here. :) | ||
Aankhen`` | wolverian: Ahh. | ||
iblech | Hm, do we need Handle? As $fh is a simple scalar (which happens to contain an IO object) | ||
Right. | |||
Aankhen`` | AFK for a bit. & | 16:35 | |
autrijus | iblech: you mean | ||
$*ERR := MyInterceptedThing.new | |||
? | |||
iblech | Right. | ||
autrijus | oh, btw. | 16:36 | |
my $x = 123; my Int $y; $y := $x; | |||
valid? | |||
iblech | Hm, unsure. What if somebody does $x = "hi" later... | 16:37 | |
autrijus | (it's a very tricky question.) | ||
my $x = 123; sub f (Int $y is rw) { $x = "hello!" }; f($x); | 16:38 | ||
what really happens? :) | |||
iblech | Type error. | 16:39 | |
autrijus | at which stage? | ||
function application or assignment? | |||
iblech | $y = "hello!" | ||
autrijus | I didn't say $y. | ||
$x = "Hello" | |||
iblech | Oh, I assumed you typoed $x | 16:40 | |
autrijus | I didn't. :) | ||
iblech | Ok, then no error at all, as $x isa Int | ||
autrijus | not after the assignment tho. | 16:41 | |
my $x = 123; sub f (Int $y is rw) returns Int { $x = "hello!"; $y }; f($x); | |||
iblech | Oh! | ||
autrijus | according to my treatment of Box above | 16:42 | |
the function application should fail. | |||
but that's weird. | |||
iblech | Ok, that's a type error then, and the appl shouldn't typecheck. | ||
But it's correct, I think... | |||
autrijus | nod. the problem does happen even if you had used normal $y | 16:43 | |
i.e. read only | |||
only by "is copy" you avoid this. | |||
this just in from larry! | |||
$x = @array; | |||
$x := @array; | |||
Hey, who said anything about consistency? :-) | |||
(he thinks those two forms should be identical) | 16:44 | ||
iblech | He's wrong I think: If you re-assign the first $x, @array is unchanged, but if you change the second $x, @array is changed, too | 16:45 | |
my $x = [1,2,3]; my $y = $x; $x = [4,5,6]; say $y # 1 2 3 | 16:46 | ||
my $x = [1,2,3]; my $y := $x; $x = [4,5,6]; say $y # 4 5 6 | |||
autrijus | my @array = (1,2,3); $x := @array; $x = 10; | 16:47 | |
this is a STORE call to an array container. | |||
should it work by pun? | 16:48 | ||
or should it be rejected? | |||
I don't like punning, so I'd say rejected. | |||
iblech | Hm, I'd say it should be rejected, too. | 16:49 | |
But $-variables may never point to an array container, I think. | |||
autrijus | why so? | ||
ah. because you are also a close worldist and think $ stands for Container::Scalar. | 16:50 | ||
iblech | Yep, $ is always scalar, @ always array, % always hash. | ||
autrijus | so the := fails due to container type mismatch. | ||
but larry says we vivify @array to a new anonymous scalar container that contains a ref to it. | 16:51 | ||
iblech | Or, alternatively, should that reall be $x := \@array, which would work? | ||
autrijus | and then BINDTO $x to that. | ||
and discard the anon scalar container | |||
iblech | s/reall/really/ | ||
autrijus | this does have the net effect of having := to be same with = | ||
again, all this logic needs to be hard coded in the BINDTO. | 16:52 | ||
so, amazingly, we three are in agreement this time :) | 16:53 | ||
iblech | Ah, right, I see it now :) | ||
autrijus | ok. so we agree that we ditch TIEHANDLE. | 16:54 | |
that plays well with the removal of the * sigil. | |||
we still have two sigils left, though. | |||
& and :: | |||
let's tackle & first | |||
tie(&say => SomeOtherClass) | 16:55 | ||
iblech | I'd say & is really $, but with its type fixed to Code, so one can't say &foo = 3 | ||
autrijus | no. | ||
unless you want &foo = &say; | |||
iblech | I want that :) | ||
autrijus | oh, you want that. :) | ||
the idea of a separately tieable &foo is that we can intercept calls. | 16:56 | ||
or lie about parameters | |||
and .assuming. | |||
but all these can be done with function wrapping | |||
iblech | Right. | 16:57 | |
autrijus | under &say; | ||
er | |||
undefine &say; | |||
what does that mean? | |||
iblech | FWIW, TSa would probably say &foo(...) is really &postcirumfix:<( )>(&foo, ...), but this has got the problem of calling &postcirumfix:<( )>... | 16:58 | |
autrijus | TSa's view is essentially a tieable &foo with APPLY. | ||
which has its merits | |||
(APPLY, like FETCH, would be tieable) | |||
and &foo won't have FETCH and STORE; whenever you want FETCH, it yields a ref to it. | 16:59 | ||
iblech | I think that's ok, but of course calling say won't work afterwards. Consider $x = &say; undefine $x; $x(...) | ||
autrijus | ok. | 17:00 | |
hm, we don't distinguish between an undefined array and a zero-length array. | 17:01 | ||
nvm. | |||
hm. | 17:02 | ||
internalls perl5 always saw CV as something other than SV | |||
svnbot6 | r5908 | chromatic++ | Make Test::Builder::Tester test pass (ignore tested module's test header). | ||
autrijus | hm. | 17:03 | |
ok. if we say &foo is merely like Foo $foo | 17:04 | ||
er | |||
Code $foo | |||
then it follows that tie(&foo => ...) would work | |||
with only FETCH and STORE | |||
since it's tiescalar as usual. | |||
iblech | Yep. | ||
autrijus | i.e. it's a constrained scalar container. | ||
I'm actually fine with that. | 17:05 | ||
iblech | :) | ||
autrijus | okay. finally, :: | ||
which is the package type | |||
that implements exciting things such as nested namespaces, type inhabitation, dispatch, etc. | 17:06 | ||
allow tying on :: is akin to tying the symbol table, plus type checking and dispatch. | |||
perl5 never let you do that. | |||
iblech | But we certainly want that in P6. | 17:07 | |
autrijus | ::CGI = ::Main; | ||
what does _that_ mean anyway. | |||
iblech | our $foo = 42; ::CGI == ::Main; say $CGI::foo # 42 | ||
autrijus | aha, but there's more! | 17:08 | |
iblech | err, s/==/=/ | ||
autrijus | CGI.new.does(Main); # true | ||
iblech | Right. | ||
Everywhere you can say CGI you can say Main now. | 17:09 | ||
autrijus | BEGIN { tie(::CGI => FakeCGI) }; package CGI; sub foo {...} | ||
gaal | ?eval my IO $x; say ($x.say("should not print")).perl | ||
evalbot6 | should not print bool::true bool::true | ||
autrijus | FakeCGI gets to handle registration of new symbol! | 17:10 | |
and reopend! | |||
and other things! | |||
gaal | ?eval undef.say("hmm") | ||
evalbot6 | hmm bool::true | ||
autrijus | do you enjoy this level of madness? :) | ||
iblech | Of course! :) | ||
autrijus | now, hard question time | 17:11 | |
::CGI = (::Main | ::DBI); | |||
::PPI = :(Int, Int); | |||
if your intuition is the first is okay and the second is not | 17:12 | ||
then that means packages and types are really orthogonal. | |||
gaal | hey, a new planet was discovered. | 17:14 | |
iblech | Hm, I'd say both work... ::Foo can either be the same as Foo (i.e. class object), or it's a "real" type like :(Int, Int) | ||
brentdax | & #Touring an unconsecrated Mormon temple | 17:15 | |
(of all the random things to be doing.) | |||
iblech | BBIAB, food | 17:16 | |
autrijus | iblech: but, it makes sense to tie packages | ||
but less sense to tie types | |||
and if you are saying Type is the top level container and it just happens Package is Type | |||
then the tie interface on non-package types would be bogus. | 17:17 | ||
on the other hand, the tie interface fo scalar is also bogus for read-only things. | 17:18 | ||
so that's not a big problem. | |||
gaal | autrijus: can you give me a hint on implementing 'use fatal'? | ||
autrijus | gaal: see Fatal.pm | 17:19 | |
gaal | what, on p5? | ||
autrijus | yup | ||
gaal | there's already a fail_; should use fatal "just" set the caller's $?FATAL_SHOULD_DIE? | 17:20 | |
autrijus | oh, you mean _that_ fatal | ||
not Fatal | |||
sorry. | |||
you want it to be lexical, so you need to get lexical export to work | 17:21 | ||
other than that it's fine | |||
gaal | %CALLER::<%MY::FATAL_SHOULD_DIE> modulo syntax etc? | 17:22 | |
autrijus | that works too. | ||
yes. | |||
gaal | we don't have 'no' yet, do we? | ||
autrijus | nope. | ||
iblech: ok. so, provisional recap | |||
gaal | thanks. | ||
autrijus | in Perl 6, container is a box with a type, an ID and a content. | 17:23 | |
but users won't see containers directly. | |||
there are scalar, hash, array and type containers. | |||
those four can refer to a primitive container | 17:24 | ||
or be overriden with tie. | |||
if that sounds okay with you, I'll get a prototype going tomorrow :) | 17:25 | ||
meanwhile I need to nap a bit... bbiab. | |||
(or bbl, depends) | |||
iblech | autrijus: re. Yep, that's exactly what I had in mind, I think :) | 17:32 | |
nothingmuch | shit! someone put my pants in the laundry before I took my wallet out | 17:44 | |
my thumb drive is now cleaner | 17:45 | ||
but probably not functional | |||
gaal | so much money laundering takes place in this country | ||
autrijus | rehi. | 18:16 | |
nothingmuch | hola | 18:19 | |
autrijus | I'll start prototyping in PIL.hs | ||
and see how far it goes. | |||
nothingmuch | the haskell PIL evaluator? | 18:20 | |
autrijus | yes, starting with the container primitives | ||
unlike certain other languages which only have "ref" | |||
as the sole container | |||
nothingmuch | btw, do we have a perl 6 impl? | ||
autrijus | we have mutable "scalar", "array", "hash" and "type". | ||
perl 6 impl of that? | |||
nothingmuch | yes | ||
of a PIL evaluator | 18:21 | ||
autrijus | metacircular evaluator? | ||
nothingmuch | yes | ||
autrijus | what fun is that? | ||
(sure, we need to have that, but I don't think it's neccessary or fruitful for this stage) | |||
although you are certainly welcome to work on it :) | |||
nothingmuch | well, if it's too long then PIL<->Perl 6 is perhaps not a good mapping as we thought | ||
svnbot6 | r5909 | autrijus++ | * cleanup to remove obsolete IMC code. | ||
autrijus | er. | 18:22 | |
sub eval_pil (PIL $pil) { eval $pil.dump_as_perl6 } | |||
done! | |||
nothingmuch | bah | ||
i mean implementing the perl 6 types in perl 6, using perl 6 types | |||
and really walking the structure, not compiling it | 18:23 | ||
autrijus | yes, I know. | ||
and I'm saying sure, this needs to happen eventually, but it makes little sense until we can run that underlying code. | |||
nothingmuch | again, not as something of any practical use | ||
autrijus | no, eventually that will be of much use | ||
see docs/notes/plan | |||
nothingmuch | i mean right now it doesn't have a practical use | ||
except to meter how pewrl 6 and pil juxtapose | 18:24 | ||
autrijus | right. | ||
I don't think that meters anything really | |||
at this stage | |||
nothingmuch | fair enough | 18:26 | |
autrijus | iblech: hm, I think the argument against TIEHANDLE applies to TIETYPE. | 18:28 | |
iblech: i.e. container types should concern with data storage; types are always scalars in term of data storage | |||
hence any interception can be done by binding to a proxy | 18:29 | ||
iblech | Oh, yes, of course | ||
autrijus | I'm thinking about unifying Array and Hash into Keyed (or "Aggregate"). | ||
since Hash is list of pairs and lookup of strings | |||
Array is list of values and lookup of ints | 18:30 | ||
Aankhen`` | A la JavaScript? | ||
autrijus | but I'm not sure about that (the list/lookup relationship differ), so I'm keeping those two. | 18:31 | |
in certain other languages, arrays are always bounded | 18:33 | ||
but in perl6 arrays are more like doubly linked lists. | |||
Aankhen`` | Bounded? | 18:34 | |
autrijus | having a finite set of possible keys. | ||
usually ordered | |||
Aankhen`` | Ah. | 18:36 | |
autrijus | instance Arbitrary Container where arbitrary = oneof $ map return [ Scalar, Array, Hash ] coarbitrary = assert False undefined | 18:38 | |
er. | |||
instance Arbitrary Container where | |||
arbitrary = oneof $ map return [ Scalar, Array, Hash ] | |||
coarbitrary = assert False undefined | |||
autrijus praises the infinite conciseness of QuickCheck | |||
Aankhen`` | ?eval sub foo () { sub bar () { "BAR" }; bar() }; say foo(); say bar(); | 18:47 | |
evalbot6 | BAR BAR bool::true | ||
iblech | Aankhen``: re. That's correct, sub bar {...} is really BEGIN { our &bar = sub {...} }, so &bar is not installed lexically | 18:50 | |
You've to use my sub bar if you want the second bar() to fail. | |||
Aankhen`` | Ah, I see. | 18:51 | |
Is Hash::kv known to bomb in PIR? | |||
autrijus | probably. | 18:54 | |
nothingmuch | www.cpushack.net/ | 19:28 | |
specifically www.cpushack.net/CPU/cpu.html#tableofcontents | 19:29 | ||
interesting processors: | 19:31 | ||
ARM | |||
AMD 29000 | |||
intel IA-64 | |||
DEC Alpha | |||
Darren_Duncan | I'm happy to report that my OSCON Lightning Talk was accepted | 19:35 | |
darrenduncan.net/OSCON/OSCON2005Lig...ngTalk.txt | |||
I appreciate any input to chopping about a quarter of the speech length off while retaining the highest impact parts and/or say everything more tersely | |||
so who here is going to OSCON? | 19:36 | ||
svnbot6 | r5910 | iblech++ | PIL2JS: | 19:37 | |
r5910 | iblech++ | * my $a := @a, my $a := %a work correctly now (hopefully). | |||
r5910 | iblech++ | * The @foo in sub foo (@foo) {...} is guaranteed to be an Array and not a | |||
r5910 | iblech++ | Ref, even if called like foo [1,2,3]. | |||
r5910 | iblech++ | * The $foo in sub foo ($foo) {...} is guaranteed to be a Scalar (for example, | |||
r5910 | iblech++ | a Ref of Array), even if called like my @a = <a b c d>; foo @a. | |||
r5910 | iblech++ | * Removed Prelude::JS::OO as &ref and &isa need to operate not only on | |||
r5910 | iblech++ | references, but on aggregates, too. Moved the implementation of &ref and | |||
r5910 | iblech++ | &isa to libjs/PIL2JS.js. | 19:38 | ||
r5910 | iblech++ | * PIL::Nodes -- my @a is not my @a = (undef) any longer, but my @a = (). | |||
r5910 | iblech++ | Similar for %h. | |||
r5910 | iblech++ | * Probably many tests broke, will go through them and fix. | |||
coral | wow | 19:39 | |
iblech | %hash.elems and $pair.elems should not work, right? | ||
(Only @array.elems) | |||
nothingmuch | coral: don't be alarmed, iblech simply likes karma D;-) | 19:42 | |
for example "Probably many tests broke" should not be a ++ at all ;-) | |||
iblech | But on the same line there's "will go through them and fix" ;) | ||
nothingmuch | that's +=0 | ||
coral | no alarm here | 19:43 | |
i've been scaring people by talking about PIL2JS | |||
nothingmuch | okay then s/alarmed/impressed/ | ||
seriously though, iblech++ # wonderful work | |||
coral | yes | ||
iblech++ | |||
iblech | Thanks :) | ||
nothingmuch | Darren_Duncan: please expand on Rosetta::Emulator::DBI | 19:44 | |
autrijus | iblech++ # my task is reduced to documenting and formalizing your work :) | ||
nothingmuch | and give the state of current "drivers" | ||
ah, the term I was looking for is "Engines" | 19:45 | ||
"An app can easily query whether an Engine provides for its needs." <-- what does this mean? | |||
coral | jini! | ||
autrijus | :r | ||
oops. | |||
nothingmuch | does Rosetta offer support certain features on top of the engines, in a slow way? | ||
coral | nothingmuch: that phrase you asked about reminds me of an old sun idea called "jini". | 19:46 | |
Darren_Duncan | The query thing can be done by the Rosetta method features() | ||
Rosetta::Emulator::DBI has the same API as DBI but uses Rosetta as a back-end | 19:47 | ||
nothingmuch | coral: what does it do? | 19:48 | |
Darren_Duncan | given the length of the talk, I consider this module to be a tersest-priority ... important to name, but not go into much detail | ||
nothingmuch | i just read about not very old but pretty weird sun idea called "picoJava" on that cpushack page | 19:49 | |
coral | nothingmuch: imagine zeroconf crossed with api discoverability | ||
nothingmuch | Darren_Duncan: that's one sentance that makes it obvious. | ||
coral | "hm, i seem to be on a network. anyone know how to get to the internet?" | ||
nothingmuch | coral: polymorphic zeroconf? | ||
coral | "hm, i seem to be on a network. anyone want to get to the internet?" | ||
Darren_Duncan | Rosetta itself mainly just defines an API ... its added features mainly amount to doing input checking | ||
nothingmuch | that was always my fantasy about what apple's rendevouz is or will be | 19:50 | |
Darren_Duncan | I wanted to give Engines the maximum flexibility to implement how they like | ||
coral | i very like the idea of advertising web services over rendezvous | ||
nothingmuch | until i realized that it's just "i'm ._local.tcp.moose" | ||
Darren_Duncan | putting too much in the API may constrain Engine developers from using best practices | ||
nothingmuch | Darren_Duncan: what engines are available? | ||
Darren_Duncan | there's no reason one Engine can't subclass another if they want to share | 19:51 | |
only one Engine exists currently, Rosetta::Engine::Generic, and it is technically a reference implementation, not the be all and end all | |||
but until more are made, it should service many needs | |||
nothingmuch | Darren_Duncan: so basically in my Rosetta::Mapper::OO i will give a spec of "These features of the rosetta api" and anything I use under that is interchangiable? | 19:53 | |
Darren_Duncan | all Engines are interchangeable that declare support for the features() you want to use ... you can use that function to see programmatically that a user-chosen Engine will work for your Mapper::OO | 19:54 | |
coral | ooo, i like that | ||
Darren_Duncan | part of my debate is how much "how to" info I put in the talk, and how much is left for people reading the POD | 19:55 | |
I would love to say a bunch of "how to", but time is short, the talk is mainly to get people interested to find out more | 19:56 | ||
this said, I will tweak it now to account for your questions, to help aid in *understanding* | 19:57 | ||
autrijus | iblech: formalization #1 is in | 19:58 | |
svnbot6 | r5911 | autrijus++ | * container type formalism, draft #1 | ||
iblech | oooh :) /me goes to look | ||
autrijus | I need to write it down in English too, so I'll do it here | ||
if you can help integrating it into comments, all the better. I'll also post to p6c :) | |||
(or is this p6l? not sure) | 19:59 | ||
I suspect p6c | |||
the gist is that there are only three kinds of Box | |||
a symbol is only bound to one of them, and never changes the type of its binding | |||
so we essentially have three zones, so to speak | 20:00 | ||
there is no way to cross zones | |||
this is neatly signified by sigils, but in the sigiless variant one would need to use explicit annotation. | |||
now a box is a mutable cell containing two things. one is its id | 20:01 | ||
and one is a possibly-tied content. | |||
toggling tiedness does not change their IDs | |||
now, there is an open question | 20:02 | ||
what happens when you do | |||
untie(%ENV); ? | |||
is that even allowed? | 20:03 | ||
iblech | Then +%ENV is 0? | ||
I.e. %ENV is then a plain normal hash | |||
autrijus | but that means %ENV need to keep a shadow normal hash around | ||
because when you tie something, untie, manip the content, tie again, untie again | 20:04 | ||
we expect the content to be still there | |||
right? | |||
iblech | Right. | ||
autrijus | okay, then every tied variant needs to keep an untied counterpart around. | 20:05 | |
(also this is in marked contrast with perl5) | |||
where you can't untie %ENV | |||
20:06
brentdax_ is now known as brentdax
|
|||
iblech | Yep, as in P5 %ENV is simply a special variable supplied by perl, and in P6 it's an ordinary tied variable which happens to call Perl6::Internals::get_env($key) | 20:06 | |
Darren_Duncan | okay, I just updated darrenduncan.net/OSCON/OSCON2005Lig...ngTalk.txt ... | 20:08 | |
mainly at the end | |||
one sentence was edited to "An app can easily query the features() method to see whether an Engine provides | 20:09 | ||
for its needs." | |||
onother became "Use the 'Rosetta::Emulator::DBI' module, a DBI clone, and your legacy apps will | |||
gain freedom with nary a change; so no porting is necessary." | |||
the ", a DBI clone" was the added part | |||
that's how I shortened "provides the same API as DBI does" | 20:10 | ||
autrijus | iblech: ok, then I changed the model to reflect this | ||
r5912 | |||
svnbot6 | r5912 | autrijus++ | * tied stuff keeps the untied version around. | 20:11 | |
autrijus | each box now has three things: an id, a boxed value, and maybe a tied version of the value. | ||
iblech | Ok. | 20:12 | |
autrijus | I wonder if there can ever be that we have a box with scalar value | 20:13 | |
but somehow tied as array. | |||
does this make any sense? | |||
nothingmuch | tied version of the value == itype interface? | 20:14 | |
and value = representation of box? | |||
Darren_Duncan: that sounds better | 20:15 | ||
geoffb | (coming in very late to this discussion) -- autrijus, do you mean like tying a string as an array of chars? | ||
Or a blob as an array of lines? | |||
iblech | autrijus: Hm, I'd say no. $s are always scalars, no matter what. You can make $foo an arrayref, or you could $foo = Foo.new; method Foo::postcircumfix:<[ ]>($idx) {...} | 20:17 | |
svnbot6 | r5913 | autrijus++ | * not always tied. | ||
Darren_Duncan | also prepended "Engines are interchangeable, and " to one sentence | ||
nothingmuch, thanks for your input so far | |||
nothingmuch | when is OSCON? | 20:18 | |
Darren_Duncan | OSCON starts in 2 days, on Monday August 1st | ||
the Lightning Talks are on thursday the 4th | |||
I have until then to revise the speech to make it better and fit it in 5 minutes | |||
the current one takes about 6-7 minutes to read aloud at a normal pace | 20:19 | ||
nothingmuch | do you think you can make an engine for a specific database in that time? | 20:20 | |
autrijus | iblech: ok, I'll reflect that then. | ||
nothingmuch | i think Generic is not enough for most people to say "i'm trying that out as soon as I get home", but is enough to get most people to say "i'll try that out in a few months" | ||
autrijus | that makes it extremely easy to model. | ||
iblech | :) | 20:21 | |
autrijus | r5914. | ||
we're down to 6 lines! | |||
so, a Box of something is either untied, where it contains an Id and a something | 20:22 | ||
svnbot6 | r5914 | autrijus++ | * Tied box variant is not allowed to disagree with untied. | ||
autrijus | or tied, where it contains Id, something, and a tied something. | ||
during tie/untie, that something stays invariant. | 20:23 | ||
Darren_Duncan | nothingmuch; no, it would probably take longer | ||
I'm not exactly a fast worker | |||
autrijus thinks that is miles better than SvMG | |||
coral | aiee, SvMG | ||
coral chants the ritual cleansing curse | |||
and when the magic has passed through me, only perl remains | |||
autrijus | heh. | 20:24 | |
now, this treatment is different from Mg | |||
in MG, you can layer multiple tiedness on a container | |||
Darren_Duncan | its already taken me 3 years of development to get where I am now, and basic selects etc aren't fully implemented yet | ||
autrijus | and selectively pull away ones | ||
do we want that? | |||
geoffb | autrijus, can you explain what's wrong with my question earlier (Why is making a string look like an array of chars not a tie of different container types?) | ||
autrijus | geoffb: oh, sorry, missed it | ||
geoffb | np | 20:25 | |
Darren_Duncan | what does work in that regard is that you can define selects, and generate the SQL, and connect to databases ... I have to connect the dots where the SQL is actually issued | ||
autrijus | geoffb: $str ~= "hello" | ||
you want this to trigger PUSH? | |||
Darren_Duncan | brb | ||
geoffb | yes, or alternately push @str, ['h','e','l','l','o'] doing a concat | ||
autrijus | so | 20:26 | |
$str = DBI.connect(...) | |||
is typefail | |||
since it's not a string | 20:27 | ||
geoffb | nod | ||
autrijus | then this is indeed tying a scalar to an array. | 20:28 | |
svnbot6 | r5915 | iblech++ | * t/builtins/arrays_and_hashes/kv.t -- s/%hash.elems/+%hash/, as, according to | ||
r5915 | iblech++ | S29, .elems works only on arrays. s/$pair.elems/1/ for the same reason. | |||
r5915 | iblech++ | * New t/builtins/arrays/elems.t -- Tests for .elems. | |||
autrijus | I mean, as an array. | ||
geoffb | My view of tie was always "This allows me to make anything look like anything else -- I can really pretend this object is an array, or in particular this string is an array, this DB is a hash . . . " | ||
nothingmuch | the way i saw ties is polymorphism extended into N syntaxes | ||
you are no longer bound to $array.index($index) for polymorphism | |||
autrijus | geoffb: that is not perl5's tie anymore | 20:29 | |
nothingmuch | you can use a more intuitive interface: @array[$index] | ||
autrijus | that is something far more radical :) | ||
nothingmuch | autrijus: example please =) | ||
autrijus | nothingmuch: geoffb's. | ||
nothingmuch | the str push? | 20:30 | |
autrijus | this has the net effect of implementing | ||
$str := @chars; | |||
geoffb | Sure, perl 5's tie required an object (ref) underneath, but I always saw that as merely working around limitations of Perl 5's object model, not anything essential to the concept | ||
nothingmuch | tie is just 'does on containers'? | ||
geoffb | nothingmuch, if I understand you right, yes | ||
autrijus | and then all manip on @chars gets reflected to $str, and all manip to $str reflects on @chars. | ||
nothingmuch | doesn't that introduce N-ary propagation issues | 20:31 | |
autrijus | nothingmuch: yes. | ||
geoffb: you can already establish such relationship in perl5 using mutual refs | |||
nothingmuch | like if the middle of a string was slices, what happenes to the object | ||
autrijus | or one way ref and overload | ||
geoffb: but that is going to hurt performance a lot | |||
so are you asking for a more native support for this? | |||
nothingmuch | if a char is inserted between two arrays, which does it belong to? | ||
geoffb | I'm not saying perl 5 can't do that -- I was asking why you were insisting that a container has to have the same type in both tied and untied case | ||
autrijus | geoffb: oh, it's just agreeing with perl5. | 20:32 | |
geoffb | OIC | ||
autrijus | I wasn't insisting :) | ||
I was asking. | |||
nothingmuch | does uising a string as an array create a new container containing an array value tied to the string? | ||
autrijus | nothingmuch: if so, there's nothing new | ||
geoffb | I would like the bigger concept -- but I grant that it may be difficult/non-performant | ||
autrijus | nothingmuch: geoffb I believe is asking for the same container to act polymorphically. | ||
nothingmuch | okay, so how does the value behave? | 20:33 | |
autrijus | i.e. you have a Box Scalar constrained to contain Str, and then tie it to Tie::Array::Something | ||
nothingmuch: it's not about the value | |||
it's more like ~= now calls PUSH | |||
instead of FETCH+STORE | |||
geoffb shrugs. I like having expressive power, and a cheat sheet that says "this will kill performance, but it's there if you ever need it" :-) | |||
autrijus | geoffb: but you can simulate that pretty easily :) | ||
so there is expressive power | |||
geoffb | Well, fair enough. | ||
nothingmuch | i don't understand why it's so cool, frankly | 20:34 | |
autrijus | like, if you mmd over all Str methods and translate it to PUSH calls etc. | ||
that will instantly work. | |||
just not very fast. | |||
geoffb | Hmmm. | ||
Please correct my assumption here: My assumption is that containers come in two flavors, tied and untied. Untied containers allow the compiler/prelude to be as dirty as desired to be fast. Tied containers force the compiler to emit completely primitive operations. | 20:35 | ||
(er, and part of that last sentence was, "but everything still works, just slowly") | 20:36 | ||
geoffb is clearly missing something, sigh | 20:38 | ||
nothingmuch is confused | 20:56 | ||
svnbot6 | r5916 | autrijus++ | * reflect the design decision that "is Tieable" is a compile-time | ||
r5916 | autrijus++ | decision that cannot be reverted at runtime. | |||
nothingmuch | i stretched my arms up | ||
and the light flickered | |||
so i drew them back, and did it again, and it flickered again | |||
turns out it was the auto-brightness adjustment thing on the laptop | 20:57 | ||
for some reason i *still* think it's cool | |||
autrijus | geoffb: no, your understanding is sound | 20:58 | |
see PIL.hs | 20:59 | ||
r5916 | |||
nothingmuch | oh shit, i have 50 browser tabs to close again | 21:00 | |
uptime is a curse in the days of tabbed browsing | |||
autrijus | geoffb: there are some comments finally. please check if they disagree with your intuition | ||
iblech: | 21:02 | ||
Aankhen`` | G'night. | ||
autrijus | my %x; %x := %*ENV; | ||
what happens? | |||
or, try vice versa. | |||
nothingmuch | bzzt | ||
autrijus | according to my current model, it's either error bothways, _or_ %x only binds to the normal storage of %*ENV and ignore the magic | 21:03 | |
while %*ENV := %x would drop the existing magic. I think. | |||
iblech | Hm, I'd say %x := %*ENV is error, as %x is not tieable, and %*ENV := %x causes %*ENV to loose its tiedness and becomes a normal a hash then | 21:04 | |
autrijus | but. | ||
%*ENV := %x; tie(%*ENV) | |||
is sound | |||
so what really happened is just an implicit untie() | 21:05 | ||
to match the tiedness of %x. | |||
nothingmuch | holy crap! | ||
it seems my disk on key is alive! | |||
it's data got zapped | |||
but it's still functional! | |||
iblech | Yes, but where's the contradiction with my assuption? :) %*ENV := %x causes %*ENV to still be marked as potentially tieable, but, as %x is not tied, %*ENV isn't either after the binding | 21:07 | |
But you can re-tie %*ENV, while you couldn't tie %x, as %x isn't marked as tieable | |||
autrijus | in that case %x := %*ENV is a compile time error, even. | 21:11 | |
iblech | Yep. | 21:12 | |
autrijus | cool. | 21:13 | |
iblech | :) | ||
autrijus | so | 21:15 | |
untie(%*ENV); %x := %*ENV; | |||
sound? | |||
iblech | Yep. | 21:16 | |
But | |||
autrijus | but? :) | ||
iblech | then we can't generally detect %x := %*ENV as a compile-time error, consider: (&untie, &id).pick()(%*ENV); %x := %ENV | ||
nothingmuch | so how do you alias %*ENV to %x? | ||
::= ? | 21:17 | ||
iblech | (As we can't know at compile-time if %*ENV is tied or not) | ||
s/if/whether/ | |||
autrijus | why? | ||
oh, you mean at runtime. | |||
right. | |||
that's why I asked :) that means no compile time error checking in general. | 21:18 | ||
you meant "we can't know, at compile time, whether %*ENV will be tied at runtime) | |||
iblech | Right, exactly. | ||
svnbot6 | r5917 | iblech++ | * Usual svn props. | ||
r5917 | iblech++ | * t/builtins/lists/join.t -- Tests for join on one-element lists (should work), | |||
r5917 | iblech++ | and "hi".join(...), which should not work (but ("hi",).join(...) should work | |||
r5917 | iblech++ | -- that's the same as (42).kv (should not work) and (42,).kv (should work)). | |||
r5917 | iblech++ | * PIL2JS: Unbroke many tests: | |||
r5917 | iblech++ | * Prelude::JS -- Stringification of one-element arrays and hashes works now. | |||
r5917 | iblech++ | * "Fixed" the stringification of pairs with keys eq "a" -- it's the Pair | |||
r5917 | iblech++ | being used in named parameter binding as well as normal object thing. | 21:19 | ||
r5917 | iblech++ | * Prelude::JS::Array -- join on one-element lists should work. | |||
r5917 | iblech++ | * Prelude::JS::Keyed -- Unbroke delete on arrays. | |||
r5917 | iblech++ | * Prelude::JS::Hash -- Unbroke { $only_one_pair }. | |||
nothingmuch | damn, it won't even partition | 21:24 | |
nothingmuch wonders if he needs 1gb or 512mb | |||
svnbot6 | r5918 | kolibrie++ | added make_swatch.p6 for making a paint colors swatch | 21:45 | |
r5918 | kolibrie++ | autogenerates an SVG image | |||
r5919 | autrijus++ | * bind and untie | |||
r5920 | iblech++ | * Renamed t/builtins/lists/undef_in_map.t to empty_list_in_map.t and added two | |||
r5920 | iblech++ | more tests to it. | |||
r5920 | iblech++ | * PIL2JS: PIL::Nodes -- Unbroke &try -- many tests should pass again now, resmoking... | |||
Darren_Duncan | are there any plans to do another Pugs release before OSCON? | 21:49 | |
svnbot6 | r5921 | autrijus++ | * cosmetic polishing and avoid warnings | ||
autrijus | hm. | 22:04 | |
Darren_Duncan: when is that? | |||
iblech: consider | |||
$x := \@y; | |||
$x = 3; | |||
# error: 3 is not Ref ? | |||
iblech | Yep, think so. | ||
Darren_Duncan | OSCON starts in 2 days | ||
Aug 1-5 | |||
autrijus | will ($x = \@z) work in place of ($x = 3)? | ||
Darren_Duncan | the conference proper is Aug 3-5, tutorials on 1-2 | 22:05 | |
autrijus | the question is whether \@y produce an rvalue container | ||
which I think it does | |||
iblech | Yep. And @y ~~ @z will be true then, I think | ||
autrijus | otherwise you have | ||
\@y = \@z; | |||
which is highly dubious. | 22:06 | ||
Darren_Duncan | see conferences.oreillynet.com/os2005/ | ||
I'm heading off there at this time tomorrow | 22:07 | ||
autrijus | ok , then I'll try a release. | 22:08 | |
svnbot6 | r5922 | iblech++ | PIL.hs -- Hadockified comments and added a #ifndef HADDOCK around the GADT def. | 22:15 | |
autrijus | iblech: | 22:31 | |
%a =:= $b; | |||
always false or always error? | |||
I'm inclining toward false. | |||
iblech | Hm, what about: my $b := @a; @a =:= $b? | ||
Probably false, as $b is a Ref of Array and @a is a Array | 22:32 | ||
Both false then | |||
autrijus | nod. | 22:33 | |
I can argue the other way too | |||
but this way feels a bit cleaner. | |||
(I could argue that \@x always retain the Id). | 22:34 | ||
\@x =:= @x; | |||
iblech | Hm. | ||
autrijus | I don't think it's wise though :) | 22:35 | |
iblech | Consider: "How can things of different types (Ref of Array, Array) ever be identical" -- so, yes, \@x =:= @x should be false. | 22:36 | |
BTW, is there a negated =:= op (like ne or !~)? | |||
autrijus | !:! ? I don't think so | 22:37 | |
iblech | You're right, according to S03. Probably because a. it wouldn't be needed that often anyway and b. !:! is *ugly* | 22:38 | |
Darren_Duncan | I was thinking about that the other day, because I want a negative =:= | 22:40 | |
I thought perhaps calling it !=:= or !:=, to be parallel with != for == | 22:41 | ||
spinclad | =!= ? | 22:42 | |
svnbot6 | r5923 | iblech++ | PIL2JS: | ||
r5923 | iblech++ | * PIL2JS.js -- Hack, all things which .isa("Array") are .isa("List") now, too. | |||
r5923 | iblech++ | * Prelude::JS::Keyed -- Fixed &pairs, &kv, and &values on one-elem | |||
r5923 | iblech++ | lists/arrays/hashes. | |||
spinclad | like a symmetrized != | 22:44 | |
it doesn't keep the : (from :=), but preserves some of =:='s flavor. | 22:49 | ||
autrijus | sure, but I highly doubt the practical need for this construct :) | 22:50 | |
spinclad | it forwards the crusade to program solely in punctuation! | 22:53 | |
autrijus | riight. | 22:54 | |
svnbot6 | r5924 | autrijus++ | * nomenclature fixups; equivalence test. | 22:55 | |
iblech | Is stringification/numification/booleanification of real refs, i.e. refs which do not autoderef, specced somewhere? | 22:56 | |
autrijus | 3 + \$obj; ? | ||
iblech | Right. | 22:57 | |
autrijus | my impression was that reference is always true, and does not have str/numify forms. | ||
iblech | But err, \$obj will autoderef if $obj contains a "real object": www.nntp.perl.org/group/perl.perl6....uage/22532 | ||
autrijus | right | 22:58 | |
...so? | |||
iblech | so 3 + \$obj will evaluate to 3 + $obj, which in turn will eval to 3 + coerce:<as>($obj, Int) or somesuch | 22:59 | |
How about 3 + \3? | |||
autrijus | 3+\3 is instant death, as no auto deref is done | ||
I was talking about that. | |||
iblech | oh, ok. | 23:00 | |
autrijus | 3+$obj is also death if $obj has no coercion forms. | ||
iblech | Right. | ||
autrijus | good, we agree again | ||
iblech | :) | ||
svnbot6 | r5925 | iblech++ | New test: t/var/autoderef.t -- Tests for autodereferencing/non-autodereferencing. | 23:12 | |
autrijus | I need to sleep. ciao! :) | 23:13 | |
iblech | Night :) | ||
autrijus++ # "Definition of containers." | |||
wolverian | hmm. debian is stopping mozilla support in stable, apparently. | 23:16 | |
iblech | Need to sleep, too. Night all! :) | 23:55 |