svn switch --relocate svn.openfoundry.org/pugs svn.pugscode.org/pugs/ | run.pugscode.org | spec.pugscode.org | paste: sial.org/pbot/perl6 | pugs.blogs.com Set by avar on 16 November 2006. |
|||
00:16
marmic joined
00:18
Khisanth joined
00:35
Khisanth joined
00:56
neonse left
01:07
riffraff joined
|
|||
riffraff | hi | 01:07 | |
Tene | hi | 01:08 | |
Patterner | hi | 01:09 | |
01:10
riffraff left,
riffraff joined
01:19
lyokato joined
01:40
buubot joined
01:56
QwestDawG joined
02:07
hexmode left
02:39
riffraff joined
|
|||
riffraff | hi | 02:39 | |
02:44
bucky joined
|
|||
riffraff | help please: what is the perl6ish way of putting unit tests in the same file of the code? I was going to use something like "if $?FILE eq $*PROGRAM { use Test; plan 4; ok...}" but it seems to much work | 02:45 | |
02:49
drbean joined
|
|||
avar | riffraff: Pod probably, nobody has implemented that so far afaik | 03:10 | |
riffraff | I see | 03:15 | |
thak you | |||
03:40
audreyt_ joined
03:46
diakopter joined
|
|||
diakopter | wb audreyt | 03:46 | |
TimToady | oohie! | 03:48 | |
diakopter | spoke too soon, I guess. | 03:51 | |
TimToady | maybe we scared her away... | 03:53 | |
more likely the last remaining fiber to Taiwan melted... | |||
diakopter | irssi auto-reconnect perhaps | 03:54 | |
TimToady | historically she usually attaches from feather | ||
so I'm assuming she's trying to get out on a business-prioritized line | |||
or is that her new DSL line? | 03:55 | ||
hinet.net is definitely a chinese site... | 03:56 | ||
diakopter | TimToady: sorry for brashly bantering with Titus and 1Co the other day. | 03:59 | |
TimToady | he's been dead for 1900 years, I don't think Paul is the least offended. :) | 04:00 | |
allbery_b | suppose that depends on your theology :) | ||
TimToady | I don't think he's offended wherever he is... :) | 04:02 | |
hinet.net is definitely audreyt's ISP, I think. | 04:07 | ||
04:08
LeeD joined
|
|||
diakopter | in Titus he's referring to believers vs. unbelievers; in 1Co he's referring to confident believers among less... liberal ... believers. A misconflation. i'll be back in 13 hours. | 04:10 | |
allbery_b is not really the right person to be discussing Christian theology anyway :> | 04:15 | ||
04:17
audreyt joined
04:20
b00t joined
|
|||
bucky | what does pugscc do? perlcabal.org/~audreyt/darcs/pugs/script/pugscc | 04:21 | |
TimToady | never tried it. it has a pod section of docs embedded though. | 04:23 | |
bucky | hmm... | 04:24 | |
The 'pugscc' script allows you to create an exectuable image from a Perl6 script | 04:25 | ||
ic | 04:26 | ||
TimToady | not heavily used, so likely subject to bitrot | 04:28 | |
bucky | i just found it in Perl6-Pugs-6.2.13 | 04:30 | |
TimToady | my dir shows it at Oct 18, so not much changed since then. | 04:32 | |
bucky | this is interesting: Perl6-Pugs-6.2.13/util/livecd/mklivecd.pl | ||
TimToady | most of us here keep an up-to-date copy from svn/svk | ||
bucky | i like this | ||
TimToady | if you'd like to hack on it, I can give you a commit bit | 04:36 | |
bucky | thank you.. but i'm a beginner | 04:37 | |
perl6 looks like something i would want to use from now on though | 04:38 | ||
04:38
demy joined
|
|||
bucky | i just didn't realize that pugscc came with the distribution | 04:40 | |
05:01
luqui joined
05:12
Eidolos joined
05:31
drbean joined
05:41
audreyt joined
|
|||
Khisanth | luqui: you could use $ENV{'REMOTE_ADDR'} if you are using CGI, if using mod_perl then you can get it from the request object | 06:13 | |
luqui | Khisanth, thanks. | ||
06:15
BooK joined
06:22
LeeD is now known as leed,
spacebat joined
06:29
audreyt joined
|
|||
beppu_ | ?eval class President { } | 07:16 | |
evalbot_r14996 | undef | ||
beppu_ | ?eval class President { }; my $president = President.new(); | 07:17 | |
evalbot_r14996 | \President.new() | ||
beppu_ | ?eval class President { }; my $president = President.new() | 07:18 | |
evalbot_r14996 | \President.new() | ||
QwestDawG | ?eval print "hello, world!\n"; | 07:22 | |
hahaha | |||
evalbot_r14996 | OUTPUT[hello, world!ā¤] Bool::True | ||
QwestDawG | was worth a shot | ||
woah | |||
beppu_ | ?eval [ 0 .. 31 ] >>~<< [ "text" xx 32 ] | 07:28 | |
evalbot_r14996 | ("0text", "1text", "2text", "3text", "4text", "5text", "6text", "7text", "8text", "9text", "10text", "11text", "12text", "13text", "14text", "15text", "16text", "17text", "18text", "19text", "20text", "21text", "22text", "23text", "24text", "25text", "26text", "27text", "28text", "29text", "30text", "31text") | ||
Tene | [ 0 .. 31 ] >>~>> "text" | 07:29 | |
?eval [ 0 .. 31 ] >>~>> "text" | |||
evalbot_r14996 | Error: ā¤Unexpected ">>~>>"ā¤expecting operator | ||
beppu_ | There must be some way to not have to repeat "text" 32 times. | 07:30 | |
?eval [ 0 .. 31 ] >>~<< "text" | |||
evalbot_r14996 | ("0text", "1text", "2text", "3text", "4text", "5text", "6text", "7text", "8text", "9text", "10text", "11text", "12text", "13text", "14text", "15text", "16text", "17text", "18text", "19text", "20text", "21text", "22text", "23text", "24text", "25text", "26text", "27text", "28text", "29text", "30text", "31text") | ||
luqui | beppu_, you are correct | ||
it's just not implemented | |||
(and that behavior is incorrect) | |||
beppu_ | really... hmmm.. | ||
what's the correct way gonna look like? | 07:31 | ||
luqui | [0..31] >>~>> "text" | ||
beppu_ | I've heard that perl 6 would allow people to define operators in unicode. Is anyone here familiar with how that is going to work? | 07:33 | |
luqui | beppu_, yeah | 07:34 | |
what do you want to know? | |||
beppu_ | the basic syntax for defining an operator. | ||
Tene | sub prefix:<operator> { do some stuff } | 07:36 | |
beppu_ | Oh, that's simple enough. | ||
Tene | ?eval sub prefix:<double> -> $a { $a * 2}; double 2 | 07:37 | |
evalbot_r14996 | Error: ā¤Unexpected "->"ā¤expecting "handles", "is", bare trait, subroutine parameters, trait or block | ||
Tene | ?eval sub prefix:<double> { $_ * 2}; double 2 | ||
evalbot_r14996 | 4 | ||
beppu_ | cool | ||
Tene | same for infix and postfix | 07:38 | |
beppu_ | is a similar mechanism used for operator overloading? | ||
like if you had a date and timerange object and wanted to add them together... | |||
luqui | ?eval multi *infix:<*> (Str $x, Str $y) { "$x--$y" } [3*4, "x"*"y"] | ||
evalbot_r14996 | [12, "x--y"] | ||
luqui | (short answer, yes) | 07:39 | |
beppu_ | I see. you declare types and rely on multimethod dispatch, right? | ||
luqui | ya | ||
beppu_ | very interesting. thanks for teaching me. | ||
?eval sub prefix:<ā > { kill(9, $_) }; ā 9999999; | 07:45 | ||
evalbot_r14996 | Error: Unsafe function 'kill' called under safe mode | ||
beppu_ | hehe | ||
Someone's going to have to come up with a good unicode input mechanism. | |||
Tene | ?eval sub prefix:<ā¢> { say "$_ curies" }; ā¢ 1234 | 07:47 | |
evalbot_r14996 | OUTPUT[1234 curiesā¤] Bool::True | ||
beppu_ | this will be an obfuscators wonderland ;-) | 07:48 | |
07:51
DHGE joined
07:59
ayrnieu joined
|
|||
masak | beppu_: true, but I must confess that I'm even more looking forward to what one will be able to do with p6 when one's intents are to be as clear as possible :) | 08:02 | |
beppu_ | of course. :) | 08:03 | |
we're gonna have to be creative | |||
there will be a perl renaissance | |||
08:05
frankg joined
08:30
devogon joined
|
|||
masak | beppu_: maybe. right now I'm not sure what the status is really of the pugs project | 08:36 | |
it's so much easier when audreyt is present | 08:37 | ||
then the status is "steadily progressing" :) | |||
beppu_ | ?eval [+] (1 .. 8, 6) | 08:39 | |
evalbot_r14996 | 42 | ||
beppu_ | good night | 08:40 | |
08:45
iblechbot joined
|
|||
masak | ?eval multi *infix:<*> (Str $x, Str $y) { "$x--$y" } (3, "x") >>*<< (4, "y") | 09:04 | |
evalbot_r14996 | ("3--4", "x--y") | ||
masak | hm | ||
09:04
buetow joined
09:13
kanru joined
|
|||
QwestDawG | ?eval [-] (1..3) | 09:22 | |
evalbot_r14996 | -4 | ||
QwestDawG | lisp influenced | 09:23 | |
? | |||
TimToady | not really | 09:28 | |
09:41
drrho joined
09:43
elmex joined
|
|||
svnbot6 | r14997 | audreyt++ | * Pugs.Prim: Fix t/xx-uncategorized/say-crash.t by printing | 10:02 | |
r14997 | audreyt++ | in 4096-byte chunks instead of running the strict encodeUTF8 | |||
r14997 | audreyt++ | on the entire string. This commit fixed the bug, but the | |||
r14997 | audreyt++ | next one should generalize this fix to make encode/decode | |||
r14997 | audreyt++ | sufficiently chunk-lazy... | |||
r14997 | audreyt++ | Reported by gaal++. | |||
pasteling | "evalbot_r14996" at 194.145.200.126 pasted "Pugs build failure" (429 lines, 24.1K) at sial.org/pbot/22131 | 10:04 | |
gaal | there seems to be some binary junk in your src/Pugs/Help.hs ? | 10:07 | |
oh, "your"==evalbot. hahah | |||
audreyt | spj++ # fix ghc-trunk in time so it builds pugs _and_ so the watch/break/step debugger feature in ghci would work | 10:08 | |
gaal | audreyt: need 'make prof' for that, right? | ||
gaal considers a 'make professor' alias | 10:09 | ||
audreyt | no, "make ghci" | 10:10 | |
it's builtin ghci | |||
gaal | wow. that's... outstanding | ||
spj++ indeed | |||
audreyt | there's also :sprint | ||
which prints a value without forcing computation | |||
gaal | but this is not in 6.6? | 10:11 | |
audreyt | no | ||
it just landed in usable form last week | |||
Options for ':breakpoint': | |||
list list the current breakpoints | |||
add Module line [col] add a new breakpoint | |||
del (breakpoint# | Module line [col]) delete a breakpoint | |||
stop Stop a computation and return to the top level | |||
it's somebody's SoC | |||
delayed delivery | |||
but damn useful | |||
gaal d/ls bleadghc | |||
audreyt | like, real debugger. | ||
10:11
fglock joined
|
|||
gaal | somebody++ | 10:11 | |
audreyt | ?eval $?PUGS_VERSION | 10:12 | |
evalbot_r14997 | \"Perl6 User\'s Golfing System, version 6.2.13, October 17, 2006 (r14997)" | ||
audreyt | generalized fix done (make encode/decode sufficiently semilazy) | 10:13 | |
benchmarking to see if we lost any perf that way | |||
10:15
miyagawa joined
|
|||
fglock | audreyt: happy new year! | 10:15 | |
I'm speccing post-mp6 | 10:16 | ||
please review if you have time | 10:17 | ||
audreyt | happy new year | 10:19 | |
cool | |||
pathname? | |||
fglock | v6/KindaPerl6 :) | 10:20 | |
v6/v6-KindaPerl6 | 10:21 | ||
audreyt | heh ok :) | ||
fglock | the idea is to have a compiler workflow framework first, | ||
ad then start the module devel | |||
reuse as much as possible from existing compilers | |||
by writing adaptors | |||
audreyt | nod | 10:22 | |
fglock | so that new impls can be done inide this workflow engine | ||
audreyt | that sounds most sane | ||
fglock | and start writing the optimiers | ||
optimizers | |||
audreyt | seems to help perf, amazingly | 10:23 | |
resmoking to make sure it didn't help perf by silently doing something wrong ;) | 10:24 | ||
MP6 -> KP6 | 10:25 | ||
asciibetically the next one in the sequence should be IPv6 | |||
fglock | re mp6, the spec is now frozen, with a bootstrapped p5 impl, and half-implemented parrot | ||
ipv6 sounds good - what would it expand to? | |||
audreyt | wow. nice! | ||
Internet Protocol Version 6 | |||
I think | |||
gaal | haha | 10:26 | |
fglock | the parrot impl compiles tokens already, and has a Match class | ||
it has problems with blocks and class variables | |||
blocks need to be compiled as subroutines, requires some work | 10:27 | ||
and class vars does not seem to be supported natively | |||
audreyt | yeah, /me am aware of those places :) | ||
clkao | .kasjo6 | 10:28 | |
audreyt | so in KP6 we'd have something that assumes all the subset of perl6 that's required for writing a reasonable fullp6 impl is there | ||
sure. excellent plan | 10:29 | ||
fglock | thanks :) | 10:30 | |
btw, mp6-MO worked, but it's too slow to use as a compiler tool | 10:31 | ||
but it's fine to make experiments wit | 10:32 | ||
with | |||
audreyt | cool! | ||
which part was slow? | |||
fglock | the profiles show a lot of calls to Class::MOP::Class::compute_all_applicable_attributes, Class::MOP::Class::get_attribute - possibly fixable with memoization | 10:35 | |
audreyt | those two are prime memocands | ||
esp get_a | |||
or inlinecands even | 10:36 | ||
so it's still using oldland C::MOP | |||
not nothingmuch's new MO? | |||
or has it became C::MOP? | |||
audreyt has lots of catching up to do | |||
fglock | I guess MO uses C::MOP | ||
audreyt | internally, I see | 10:37 | |
fglock | anyway, I was planning to write a wrapper to p5 native oo, in order to have a common pluggable API | ||
audreyt | right | ||
fglock | so we can have .HOW on native p5 objects (maybe reuse v6.pm) | 10:38 | |
does p6 allows to use different metamodels in the same program? | 10:39 | ||
this could be a problem | |||
audreyt | gaal: if you go about build trhunkghc yourself you need this in mk/build.mk | 10:43 | |
GhciWithDebugger = YES | |||
fglock: it allows different HOW | |||
but the protocol is same | 10:44 | ||
fglock | ok | ||
gaal | audreyt: thanks, no, i used a binary | 10:46 | |
svnbot6 | r14998 | audreyt++ | * Pugs.Internals.String: encodeUTF8 and decodeUTF8 is now | ||
r14998 | audreyt++ | lazy in 4k-chunk units, instead of completely strict. | |||
r14998 | audreyt++ | This allows reading/writing of huge files. | |||
audreyt | gaal: ok, then you don't get debugger cmds | ||
I think. may be wrong | |||
gaal | oh! that's... too bad | 10:47 | |
audreyt | try ":debugger" in ghci and see if it groks it | ||
but! ghc now compiles itself much faster | |||
:) | |||
gaal | doesn't, but :? does show breakpoint options | ||
svnbot6 | r14999 | audreyt++ | * Pugs.Prim.List: Remove an unneccessary toInteger. | ||
audreyt | yeah, but that's meaningless | ||
gaal | why's it off by default? :-(( | 10:48 | |
ghc will take up the rest of the weekend to build here... | |||
audreyt | still being worked on I guess | 10:49 | |
oy. sorry then :/ | |||
is your ghc bincompat with feather perchance? | |||
gaal | dunno, how do i check? | ||
i just finished building '97 i think | 10:50 | ||
(x86/32bit here) | |||
(debian unstable) | 10:51 | ||
audreyt | dunno either | ||
you can cp from feather and try... | |||
masak | welcome back, audreyt! | ||
audreyt | thank you :) | ||
gaal | yeah, will. but need to figure out lunch first | ||
audreyt | still in backlog mode | ||
masak | apparently a backlog mode that does commits along the way, however | 10:52 | |
10:52
chris2 joined
|
|||
audreyt | yeah, well, that's a bonus | 10:53 | |
svnbot6 | r15000 | audreyt++ | * Pugs.Prim: Now encodeUTF8 autochunks, remove hardcoding in op2Print. | ||
fglock | is 'class Dog {...}' the same as 'our class Dog {...}' ? | 10:54 | |
svnbot6 | r15001 | audreyt++ | * Pugs.Types: Compare TMVar with their addresses, not bind Eqs. | ||
r15001 | audreyt++ | This is important for well-orderedness of Thread objects. | |||
gaal | does bsl expose that 4069b constant somewhere? | 10:55 | |
gaal needs more ram, keeps getting evacuate errors | 10:56 | ||
src/Pugs/AST/Internals.hs:637:16: | 10:57 | ||
Not in scope: type constructor or class `VThread' | |||
forgotten svk add? | |||
audreyt | no, a sec | 10:58 | |
10:58
ruoso joined
|
|||
svnbot6 | r15002 | audreyt++ | * Pugs.AST.Internals - Change "VThread Val" to "VThread" | 11:00 | |
r15002 | audreyt++ | since Val is all one thread can conceivably return. | |||
audreyt | try again? | ||
(r15003) | |||
gaal | pulling | ||
audreyt | gaal: no it's not bsl. it's P.Internals.String | 11:01 | |
we're not using bsl yet | |||
bsl means all ops on it are 4klz | |||
not only en/de | |||
svnbot6 | r15003 | audreyt++ | * Regen instance. | ||
gaal | ok looks better on the compilation moose, but ghci is hanging when i do "main", probably just a system problem on my machine | 11:05 | |
gotta go now though | |||
see you later :) | |||
(why does ghci not cache the results of compilation somewhere? eg every time i enter make ghci I need to recompile lots of code.) | 11:06 | ||
nothingmuch | gaal: do you have trail map #1? | ||
audreyt | bytecode is not yet saved | ||
nothingmuch | (hermon) | ||
gaal | (yes i realize it's not a compiler mode -- but it could have serialized asts or whatever) | ||
nothingmuch: maybe one from ~10 years ago, but i won't be able to moose it till next weekend | 11:07 | ||
anyway, i gotta go. <3s to y'all | |||
*waves* & | 11:08 | ||
y after linking all the libs it just sits there | |||
fglock | I've been in hermon - it makes 20yrs :) | 11:10 | |
they had 1m snow | 11:11 | ||
audreyt | ?eval 42 | 11:17 | |
evalbot_r14997 | 42 | ||
gaal | ooh i got a pugs shell eventually, just took a while | 11:25 | |
fglock: you must have hit a cold year! :) | |||
fglock | I still have the dubon :) | 11:27 | |
11:27
ozo joined
11:28
mj41 joined
|
|||
fglock | is there a drawing somewhere showing when to execute BEGIN blocks, 'use' statements, etc | 11:28 | |
avar | where's the code that does perl5 embedding in pugs? | ||
fglock: aside from the synopsis, not a drawing though | 11:29 | ||
? | |||
audreyt | avar: src/perl5/ and src/Pugs/*/Perl5 | 11:30 | |
fglock | I'm trying to sketch a detailed compilation workflow - I wonder if there is something done I could reuse | ||
audreyt | fglock: the closest is docs/perl6_compilation | 11:32 | |
nothingmuch | @tell gaal thanks anymoose, i'm going to buy one now | 11:44 | |
lambdabot | Consider it noted. | ||
12:05
Grrrr joined
12:21
marmic joined
12:22
buetow joined
|
|||
fglock | if I have separate parse, analyze and emit, when is it the right time to run BEGIN blocks? | 12:22 | |
is the answer "you can't split it like that" | 12:24 | ||
12:43
SCalimlim joined
13:21
ruoso_ joined
13:23
luqui joined
13:27
marmic joined
14:01
gnuvince joined
14:08
fglock joined
14:13
[particle] joined
14:23
baest joined
14:35
neonse joined
14:45
nipra joined
14:59
ozo left
15:02
hexmode joined
15:05
vel joined
|
|||
fglock | is there some kind of OUTER relation between modules like ::A and ::A::B which are declared separately? | 15:19 | |
to what extent is ::A::B 'inside' ::A ? | 15:20 | ||
nothingmuch | fglock: that slowness is due to MO objects being constructed | 15:25 | |
Class::MOP::compute_all_applicable_attributes is used in Moose constructors | |||
and all the MO meta objects use Moose now | |||
my next step is to bootstrap MO using itself | |||
and then I can finish functionality | 15:26 | ||
15:35
spoop joined
|
|||
fglock | nothingmuch: ok | 15:38 | |
luqui | fglock, was your question about perl 6? | 15:39 | |
fglock | luqui: yes | ||
luqui | there is hardly any semantic relationship | 15:40 | |
fglock | just like p5 | ||
luqui | right | ||
I'm not actually that well-versed in p5 territory here | 15:41 | ||
fglock | what should I read to know more about 'BEGIN' and 'use' during compilation? | ||
in p6 | |||
luqui | as far as I know, it's pretty much the same | 15:42 | |
modulo new stuff like "is export" | |||
fglock | what should I read to know more about it in p5 :) | 15:43 | |
is 'use' executed at BEGIN time? | |||
15:43
turrepurre joined
|
|||
luqui | yeah | 15:43 | |
fglock | so it needs to be compiled recursively | 15:44 | |
luqui | in p5, use X is equivalent to BEGIN { require X; X->import } | ||
fglock | ok | ||
luqui | you're asking about circular dependencies? | ||
or... | |||
fglock | I'm wondering where to execute BEGIN | 15:45 | |
luqui | ? | ||
fglock | probably inside the return-blocks in the parser | ||
luqui | oh. right after } is parsed... | ||
fglock | like this: | ||
luqui | (rather, statement ::= 'BEGIN' <block> *here*) I imagine... | 15:46 | |
fglock | token BEGIN { BEGIN <block> { execute_begin; return ... } } | ||
luqui | that's what I'd guess, too | ||
fglock | another point is, how much of the program is actually supposed to 'exist' when BEGIN is executed | 15:48 | |
my and our were not executed yet, right? | |||
15:48
thepler joined
|
|||
luqui | I know we talked about this a lot some months ago | 15:49 | |
fglock | only 'sub' definitions | ||
luqui | but I think it would be pretty hard to find the conversation | ||
anyway, like perl 5 | |||
so my's *do* exist | |||
and that's screwed up, and we understand that | |||
let me see if I can find the p6l thread | 15:50 | ||
15:51
lumi_ joined
|
|||
luqui | okay, 2006-08-14 is the timestamp of a thread asking about this sort of thing | 15:54 | |
gaal | it's X->import if UNIVERSALL::can('X', 'import'), which nobody seems to remember -- plus the parser hint for indirect object syntax, which nobody seems to forget :) | ||
lambdabot | gaal: You have 1 new message. '/msg lambdabot @messages' to read it. | ||
luqui | looking at IRC logs nearby | ||
gaal | @moosages | ||
lambdabot | nothingmuch said 4h 9m 52s ago: thanks anymoose, i'm going to buy one now | ||
gaal | s/ALL/AL/ | ||
the "readmore" on the latest entry in the pugs blog is broken | 15:59 | ||
fglock | gaal: what's the 'parser hint for indirect object syntax' | 16:00 | |
gaal | fglock: man perlobj/"Indirect Object Syntax"/'For example, a call to a method "new" in indirect notation' | 16:02 | |
luqui | fglock, if you are ready for your head to explode thinking about scoping and compile phases together, look at colabti.de/irclogger/irclogger_log/...=771#l1375 | 16:03 | |
lambdabot | Title: #perl6 2006-08-14,Mon, tinyurl.com/ubbbl | ||
fglock | luqui: do I have a choice :) | ||
thanks1 | 16:04 | ||
thanks! | |||
luqui | oh | ||
I pointed you to the end of that conversation | |||
I guess it never got resolved | |||
we just asked all the questions :-) | |||
fglock | heh | ||
luqui can't remember if TimToady was on IRC back then | 16:05 | ||
fglock | gaal: I guess my misunderstanding is - do you mean a hint to the parser, or a hint to everybody | 16:06 | |
luqui | probably: import { X } LIST | 16:07 | |
so that a definition of import in that package wouldn't interfere with parsing... | 16:08 | ||
er, in the calling package | |||
gaal | oh, there's not problem in import -- not THAT problem anyway -- because it really is invoked correctly | 16:09 | |
the problem is that C<meth $obj> might mean __PACKAGE__::meth($obj) or $obj->meth | 16:10 | ||
this problem does not exist in Perl 6 | |||
avar | gaal: there's more to it than that, see the mess that is toke.c | 16:12 | |
iirc at least, there were all sorts of nasty exceptions:) | |||
it's the part of the parser which perldoc calls "not strictly predictable":) | |||
16:15
jrockway_ joined
|
|||
avar | well of course it means one or the other, but the parsing rules are explained in S_intuit_method(pTHX_ char *start, GV *gv, CV *cv) | 16:18 | |
luqui | ?eval sub foo (&infix:<+>) { 2 + 3 } foo &infix:<*> | 16:19 | |
evalbot_r15003 | 6 | ||
luqui | ?eval sub foo (&infix:<@@>) { 2 @@ 3 } foo &infix:<*> | 16:20 | |
evalbot_r15003 | Error: ā¤Unexpected "@@ 3"ā¤expecting operator or "}" | ||
luqui | aww | ||
?eval sub infix:<!!> ($x, $y) { $x + $y } 3 ?? 4 !! 5 !! 6; | 16:21 | ||
evalbot_r15003 | Error: ā¤Unexpected ";"ā¤expecting "_", fraction, exponent, term postfix, operator or "!!" | ||
luqui | ?eval sub infix:<!!> ($x, $y) { $x + $y } 5 !! 6; | ||
evalbot_r15003 | 11 | ||
luqui | ?eval sub infix:<!!> ($x, $y) { $x + $y } 3 ?? 5 !! 6; | ||
evalbot_r15003 | Error: ā¤Unexpected ";"ā¤expecting "_", fraction, exponent, term postfix, operator or "!!" | ||
luqui | ?eval 3 ?? 5 !! 6; | ||
evalbot_r15003 | 5 | ||
luqui | ?eval sub infix:<!!> ($x, $y) { $x + $y } 3 ?? (5 !! 6) !! 7; | 16:22 | |
evalbot_r15003 | Error: ā¤Unexpected ";"ā¤expecting "_", fraction, exponent, term postfix, operator or "!!" | ||
luqui | ?eval my $x; BEGIN { $x = '@@' }; sub infix:{$x} ($a,$b) { $a + $b }; 3 @@ 4; | 16:23 | |
evalbot_r15003 | 7 | ||
luqui | perl is going to be far too powerful at compile-time | 16:24 | |
:-) | |||
?eval my &infix:<@@> ::= &infix:<+>; 3 @@ 4 | 16:25 | ||
evalbot_r15003 | Error: ā¤Unexpected "@@ 4"ā¤expecting operator | ||
luqui | ?eval &infix:<@@> := &infix:<+>; 3 @@ 4 | ||
evalbot_r15003 | Error: ā¤Unexpected "@@ 4"ā¤expecting operator | ||
luqui | ?eval &infix:<@@> = &infix:<+>; 3 @@ 4 | ||
evalbot_r15003 | Error: ā¤Unexpected "@@ 4"ā¤expecting operator | ||
luqui | ?eval &infix:<@@> = &infix:<+>; | ||
evalbot_r15003 | Error: Can't modify constant item: VStr "MkCode {isMulti = True, subName = \"&\", subType = SubPrim, subEnv = Nothing, subAssoc = ANil, subParams = [], subBindings = [], subSlurpLimit = [], subReturns = (mkType \"Any\"), subLValue = False, subBody = Prim ([Pugs.AST.Internals.Val] -> () Pugs.AST.Internals.Val), subCont = Nothing, subPreBlocks = [], subPostBlocks = [], subFirstBlocks = [], subLastBlocks = [], subNextBlocks = [], subKeepBlocks = [], | ||
luqui | ?eval &infix:<@@> := &infix:<+>; | 16:26 | |
evalbot_r15003 | Error: Bind to undeclared variable: "&infix:@@" | ||
16:26
kanru joined
|
|||
luqui | ?eval { my sub infix:<@@> ($x, $y) { 3 @@ 4 } } | 16:26 | |
16:26
silug joined
|
|||
evalbot_r15003 | Error: ā¤Unexpected "@@ 4"ā¤expecting operator or "}" | 16:27 | |
luqui | ?eval { my sub infix:<@@> ($x, $y) { $x + $y } 3 @@ 4 } | ||
evalbot_r15003 | 7 | ||
luqui | ?eval { my sub infix:<@@> ($x, $y) { $x + $y } } 3 @@ | ||
evalbot_r15003 | Error: ā¤Unexpected "3"ā¤expecting operator | ||
luqui | ?eval { my sub infix:<@@> ($x, $y) { $x + $y } } 3 @@ 4 | ||
evalbot_r15003 | Error: ā¤Unexpected "3"ā¤expecting operator | ||
luqui | okay, so remaining problems: | ||
?eval sub infix:<@@> ($x, $y) { $y @@ $x } # no parse | 16:28 | ||
evalbot_r15003 | Error: ā¤Unexpected "@@ $x"ā¤expecting operator or "}" | ||
luqui | sub foo(&infix:<@@>) { 3 @@ 4 } # no parse | ||
?eval sub foo(&infix:<@@>) { 3 @@ 4 } # no parse | |||
evalbot_r15003 | Error: ā¤Unexpected "@@ 4"ā¤expecting operator or "}" | ||
fglock | try adding ; after eval | ||
because it doesn't have a line break | |||
luqui | wait, where? | ||
fglock | oh sorry - I was misreading ?eval | 16:29 | |
luqui: the reason I'm asking is because I'm adding 'BEGIN' to the mp6 implementation, and I'm trying to define the compiler workflow at a higher level | 16:31 | ||
luqui | cool. | 16:32 | |
I think the strange interplay between compile-time and run-time variables is going to prevent the maximally elegant design | 16:33 | ||
but do ask if you have any questions, and I'll *try* to answerthem | |||
fglock | I'll need some clean way to have the compile-time env, too | 16:34 | |
luqui | you mean after a program compiles, you need to save the state | 16:35 | |
? | |||
so that it can be run (perhaps later, multiple times) | 16:36 | ||
fglock | I mean, where does it store the pad structure | 16:37 | |
the state would be preserved as AST nodes, I presume | 16:38 | ||
luqui | I recall coming up with a nice design for this at the hackathon | ||
ask audreyt when she awakes | |||
(hopefully she will remember better than I) | 16:39 | ||
but can't it just store it alongside everything else | 16:40 | ||
storing references to pads (so that more than one thing can refer to the same pad) | |||
16:40
jrockway_ is now known as jrockway
|
|||
luqui | i.e., all lexical scopes exist at compile time | 16:40 | |
and they are cloned at runtime as needed | |||
to create pads... | |||
it seems a little asymmetrical, but it makes sense | 16:41 | ||
I am just dumping words as they come into my head | |||
fglock | let's see - mp6 pads are native, while compile-time pads are object or hash | 16:42 | |
luqui | oh, ouch | ||
fglock | after parsing, the compile-time pads are not needed, because all info is stored in the AST | 16:43 | |
luqui | hm... food for thought: my $x; BEGIN { $x = 42; } say $x; | ||
where does 42 go? | |||
fglock | dumping the env actually means this is compiled to: my $x; INIT { $x = 42; } say $x; | 16:46 | |
? | |||
luqui | that is conceivable | 16:47 | |
luqui tries to think of a case where that doesn't work... | 16:48 | ||
fglock | it would work for 'use', I think | ||
luqui | you mean to call import? | 16:49 | |
of course this: BEGIN { say "Hello, World!" } doesn't turn into INIT { say "Hello, World!" } | |||
but that's obvious | |||
fglock | maybe it would turn into INIT { 1 } because that's what BEGIN returned | 16:50 | |
s/returned/dumped/ | |||
luqui | my $x; BEGIN { $x = { $x } } # just brainstorming | 16:51 | |
fglock | is import compile-time only? | ||
luqui | yeah | ||
fglock | it could just be implemented as a run-time no-op | 16:52 | |
luqui | import is just a sub call | 16:53 | |
there is nothing special about it | 16:54 | ||
fglock | you could tell 'use' to only call 'import' at compile-time | 16:56 | |
luqui | supposing that use X; is shorthand for BEGIN { require X; X.import if X.can('import') }, wouldn't that happen anyway? | 16:58 | |
I think the contents of the {...} in the BEGIN case and in the INIT case being the same was only a coincidence | |||
(above) | |||
you have your compile-time pads | 16:59 | ||
evaluate everything | |||
then during code generation, output INIT blocks to bring the runtime-pads to what they were at compile-time | |||
it's very strange, because in the following: | 17:00 | ||
my $x = { my $y; BEGIN { $y = 42 } } | |||
the pad containing $y exists *before* the closure does! | 17:01 | ||
indeed, in the following, I'm not even sure what the behavior is: | 17:03 | ||
fglock | I guess that from the env point of view, it's not a closure | ||
luqui | ?eval for 1,2 { my $x = { my $y; BEGIN { $y = 42 }; say $y }; $x() } | ||
evalbot_r15003 | OUTPUT[ā¤ā¤] undef | ||
luqui | perhaps not | ||
I would like to have a nice, pretty, consistent picture of all of this in my head | 17:04 | ||
fglock | yes - I was reading about this case right now - aspn.activestate.com/ASPN/Mail/Mess...rs/2132427 | ||
lambdabot | Title: Re: perl6 style BEGIN {} anyone? :: ASPN Mail Archive :: perl5-porters, tinyurl.com/yh2anv | ||
luqui | except this is much more subtle than that problem | 17:05 | |
it's assigning to a variable which certainly doesn't exist until runtime at compile time | |||
constant folding is just replacing an ast node | 17:06 | ||
hmm | |||
I think there is room for specification here | |||
and I am inclined to outlaw the above case | |||
so, how about this: it is illegal to assign to non-existant varaibles at compile-time | 17:07 | ||
we just need to define 'exists' appropriately | |||
a variable exists if... it is in a closure that cannot be cloned? | 17:08 | ||
that is, if $x can only ever refer to one thing, then it exists at compile-time | |||
I like that... | |||
so crap like this: for 1,2 { my $x; BEGIN { $x = 10 }; say $x } | 17:09 | ||
is illegal | |||
but: { my $x; BEGIN { $x = 10 }; sub foo() { $x } } | |||
is not | |||
(assuming that closure was in void context...) | |||
then, in the pad structure, you can store existent variables and reasonably initialize them at the beginning of runtime | 17:10 | ||
inside their scope... | 17:11 | ||
17:11
nipra joined
|
|||
luqui mulls over this a bit more before trying to write it up for p6l | 17:12 | ||
fglock | I'm ok with that - it seems to avoid the problem | 17:13 | |
how is INIT {} different from {} in this context? | 17:20 | ||
luqui | not terribly different... | 17:21 | |
I'm not actually sure in which context... | 17:22 | ||
:-) | |||
fglock | I mean, can BEGIN blocks be compiled to plain blocks | 17:25 | |
containing the local env dump | |||
luqui | you mean INIT? | 17:26 | |
oh | |||
no | |||
you do mean BEGIN :-) | |||
no, I think init is necessary | 17:27 | ||
my $x; say $x; BEGIN { $x = 42 } | |||
fglock | I think my confusion is, how do you run INIT blocks in a closure | ||
luqui | that is what the proposal solves | 17:28 | |
this closure is unique, so you can create it at the beginning of the program if you have to | |||
then just change the environment to it | |||
fglock | that would be compiled to { $x=42; my $x; say $x } | 17:29 | |
luqui | (I am making many assumptions about your architecture) | ||
ahh | |||
I think that would work | |||
fglock | or { my $x; { $x = 42; say $x } } | ||
luqui | now I see what you're saying | ||
given the new restrictions, I think that would work out | |||
the new, hypothetical, restrictions | |||
let's hope they make canon :-) | 17:30 | ||
fglock | it could work like this - each 'my' decl creates a new pad, at compile-time | 17:31 | |
and BEGIN blocks are moved to the start of the pad code | |||
luqui | where by "moved to " you mean "executed and then the pad's environment is dumped at" ? | 17:33 | |
fglock | yes | ||
luqui | it is a little scary because it seems too simple | 17:34 | |
but I do think that it works... | 17:35 | ||
I am in no position to prove it though | |||
fglock | if you 'execute' the begin block repeatedly, it's not a big problem | 17:37 | |
luqui | ? | 17:38 | |
17:38
_bernhard joined
|
|||
fglock | a BEGIN block inside a for-statement is not a big problem | 17:40 | |
it will only execute once | |||
luqui | true | ||
but if it refers to variables whose scope is the for block, then you get into trouble | |||
fglock | example? | 17:42 | |
luqui | for 1,2 { my $x; BEGIN { $x = 3 } } | 17:43 | |
which $x is BEGIN referring to? | |||
[particle] | for 1..3 -> $x { BEGIN { $x = 3; } say $x } | ||
heh, very similar examples :) | |||
17:43
kanru_ joined
|
|||
[particle] | how many times does the loop run? | 17:44 | |
luqui | oh, careful with that | ||
for isn't shorthand for while... | |||
I'd say it runs three times no matter what | 17:45 | ||
but that is not the point at the moment :-) | |||
[particle] | good. | ||
fglock | this would compile the same as if without BEGIN | ||
luqui | so the $x = 3 is completely ignored | ||
? | |||
fglock | because $x=3 dumps to $x=3 | ||
luqui | oh | ||
I think that is special to this simplistic example | 17:46 | ||
fglock | I guess it dumps an env diff | ||
luqui | for 1..3 { my $x; BEGIN { $x++ } } | ||
fglock | at the end of BEGIN, $x=1 | ||
so it would compile to | 17:47 | ||
for 1..3 { my $x=1 } | |||
luqui tries to come up with an example that drives home that there are three different $x's | |||
17:48
justatheory joined
|
|||
luqui | my $y; for 1..3 { my $x; BEGIN { $y = { $x++ } } } $y() | 17:48 | |
17:49
justatheory joined
|
|||
[particle] | better example | 17:49 | |
but why {} around $x++ ? | |||
just for scoping? | |||
luqui | it is a closure, closing over the $x inside the for | ||
except there are three different $x's to close over... which one is it? | 17:50 | ||
[particle] | ah, yes. very good example | ||
luqui | I suppose the semantics are unambiguous there. To make them ambiguous: | 17:51 | |
my $y; for 1..3 { my $x = $_; BEGIN { $y = { $x } } } $y() | 17:52 | ||
fglock | let's see - that de-BEGINs to: my $y; for 1..3 { my $x; { $y = sub{ $x++ } } } $y() | ||
luqui | there, that is sufficiently f'ed up | ||
fglock, so you assign to $y three times? | |||
what if $y is tied? | |||
fglock | you can use a FIRST block, I guess | 17:53 | |
luqui | so I guess my point is that in at least this situation, it isn't meaningful to say { $x } | 17:56 | |
(as a closure creation) | |||
oh, here we go: | |||
my $y; if rand() < 0.5 { my $x = 4; BEGIN { $y = { $x } } } $y() | 17:57 | ||
throw in a BEGIN { say $y } before $y() if you please | |||
[particle] | or after | 17:58 | |
18:01
weinig|bbl is now known as weinig
18:02
buetow joined
18:06
kanru joined
|
|||
fglock | does placing a 'ran' flag in the block helps? such that it is only run once | 18:15 | |
[particle] | so, all closures get a loop counter? | 18:16 | |
18:17
ofer0 joined
|
|||
fglock | only for desugared BEGIN-blocks | 18:17 | |
BEGIN { $x=1+1 } desugars to { $x = 2 } unless $__global1234++ | 18:18 | ||
oops - something like that | 18:19 | ||
luqui | see rand() example | 18:20 | |
[particle] | after BEGIN is executed, it returns a closure with a reset loop counter | ||
luqui: isn't $x undefined at BEGIN time in that example? | 18:22 | ||
luqui | okay... | ||
but what happens if the random number is less that 0.5? | 18:23 | ||
does $y() return 4? | |||
and if not, $y() returns undef? | |||
then modify to this: | |||
my $y; for 1..rand(10) { my $x = $_; BEGIN { $y = { $x } } } $y() | 18:24 | ||
now what? | |||
I assume it will be 1 if the body ever gets executed | 18:25 | ||
and undef otherwise | |||
okay | |||
hmm | |||
so the question is, does such a transformation always work | |||
oh... | 18:26 | ||
so even if the block is never executed.. $y is not undef | |||
so how do you handle that? | |||
(this was the problem in the rand() case too) | |||
I just distracted myself... :-) | 18:27 | ||
fglock | how does p5 handles this? | ||
luqui | so to clarify, $y() can return undef, but regardless $y is a code object, and has to refer to something | ||
fglock | is the 'for' pad pre-allocated? | 18:28 | |
luqui | the first time you execute a block, you don't clone the pad | ||
it's already there | |||
it can get away from that because it doesn't separate compile time and runtime | |||
s/from/with | 18:29 | ||
[particle] | what about C< BEGIN { $x } say $x >: does this complain that $x is undeclared? (no C<my>) | 18:30 | |
or is there a pad entry because it's used in begin | |||
TimToady | no, the BEGIN would fail with "undeclared". | 18:31 | |
in fact, the *compilation* of the BEGIN would fail. | |||
luqui | TimToady, did you see my proposal above? | ||
TimToady | it seems sane to the first approx | 18:32 | |
fglock | does this means that the rand example is forbidden? | ||
TimToady | whether we can get the "first time through" uses compiler's pad thing to work is the real issue, I expect | ||
[particle] | and C<my $x; BEGIN { $x = 3 }> compiles? | ||
TimToady | not forbidden, just nonsensical | ||
GIGO | 18:33 | ||
I don't think we have to go to extraordinary lengths to make non-determinstic code deterministic | |||
at some point you say, we don't penalize the innocent with the guilty | |||
luqui | well my proposal would like the rand example to be forbidden | ||
TimToady | and it's just erroneous | ||
fglock | do you think it's possible to desugar BEGIN blocks out after parsing? | 18:34 | |
TimToady | no | ||
er, yes | |||
not sure what you're asking exactly | 18:35 | ||
BEGIN blocks are executed and turned into a value, side effects have to have something at compile time to effect | |||
the question in my mind | |||
is whether a lexical that will be cloned | |||
has an initial value at compile time | 18:36 | ||
in the absence of an explicit = | |||
so you could make a lexical spring into existence with a value when cloned rather than undef. | |||
but generally, | |||
I think the approved way to do that is not with an assignment in a BEGIN | |||
but to say | |||
my $x = BEGIN {...} | |||
so I don't think we need to go to pains to try to make | 18:37 | ||
for 1..3 { my $x; BEGIN { $x = ... }} | |||
do anything special | |||
if a decent error message can be produced | 18:38 | ||
then that's better than merely declaring it erroneous | |||
fglock | I'm asking if you can substitute BEGIN {} with some run-time code, possibly derived from the env difference before and after the BEGIN was executed... | ||
TimToady | maybe something a little better than "variable will not stay shared" | ||
luqui | like: "error, example.pl line 6: you must be out of your mind" | ||
TimToady | :) | 18:39 | |
[particle] | error: BEGIN inside loop construct, RETARDO!!! | ||
luqui | fglock, I've been trying to prove that you can't in general, for the last four examples | ||
I may be mistaken, but I think the rand() example gets at the heart of it | 18:40 | ||
fglock | luqui: I mean, considering that you have disallowed some constructs | ||
TimToady | I agree with luqui on the general principle--a BEGIN can only influence structures that exist at compile time by side effect. Other than that, all it can do is return a value. | ||
luqui | fglock, oh, then I think you can | 18:41 | |
TimToady | the "extra" question is whether there are extraordinary structures we can have at compile time that do things at run time | ||
and I think the answer is, don't sweat it for now. | |||
18:41
weinig_ joined
|
|||
TimToady | I suppose one could view the value returned by BEGIN as somehow lazy till run time, if the need arises, but I don't really see much need. | 18:43 | |
the point of BEGIN is to make something happen Right Now as far as the compiler is concerned. | |||
fglock | I'm wondering how to implement separate compile/run in p5, without executing BEGIN blocks at both | 18:44 | |
p6-on-p5 | |||
TimToady | in that sense the BEGIN blocks are gone by run time | ||
all you see is their results | |||
fglock | hmm - that's what I was meaning with 'desugaring' | 18:45 | |
luqui | right. I think you can generate code to initialize all "compile-time existing" variables at the beginning of their scopes, and the semantics will be correct | ||
(though it is indeed a bit tricky if they refer to each other) | 18:46 | ||
fglock | but in the case of the 'random' example, I need to do this with a BEGIN block, right? | ||
in p5 land | 18:47 | ||
luqui | you mean it is impossible to factor that out into a program with no BEGIN? | ||
I think so. | |||
fglock | think so == impossible ? | 18:48 | |
luqui | yeah | 18:49 | |
TimToady | are you asking if BEGIN is a primitive? | ||
BEGIN is purposeful installation of the halting problem within the compiler. :) | |||
18:49
rindolf joined
|
|||
rindolf | Hi all! | 18:49 | |
I saved a perlbug bug report to a file. Now how do I submit it using perlbug? | |||
TimToady | around here you just fix the bug yourself and check it into svn. :) | 18:50 | |
rindolf | TimToady: heh. | ||
fglock | man perlbug ..? | ||
rindolf | fglock: I searched it for "save" and could not find a single occurence of the word. | 18:51 | |
integral | you email it to [email@hidden.address] (iirc) | ||
rindolf | integral: OK. | ||
18:52
kanru joined
|
|||
fglock | how about this: you execute the BEGIN block, and then generate code that has an INIT block in that place - the INIT block redoes the side-effects | 18:53 | |
at run time | |||
[particle] | how does it interact with INIT blocks in the source? | 18:54 | |
svnbot6 | r15004 | luqui++ | Parsing of a sub definition now goes into effect before seeing | ||
r15004 | luqui++ | the definition block. I.e. this parses: | |||
r15004 | luqui++ | sub infix:<@@> ($x, $y) { $y @@ $x } | |||
r15004 | luqui++ | It doesn't work with postfix operators for some reason! | |||
rindolf | integral: will /usr/sbin/sendmail [email@hidden.address] < perlbug-segfault-in-compilation.rep work? | 18:55 | |
luqui | fglock, sure | ||
so long as the side-effects are just the env differences | 18:56 | ||
but [particle] has a good point | |||
fglock | if you wanted other run-time side-effects, you were supposed to put then in an INIT block, right? | 18:57 | |
rindolf | Hmmm... I cannot compile perl5. | ||
rgs: ping. | |||
luqui | my $x; INIT { $x = 1 } BEGIN { $x = 2 }; say $x; | ||
or even: | 18:58 | ||
fglock | that's a problem | ||
luqui | n/m | ||
oh dear | |||
I was going to say that you have to move side-effects to the beginning of the scope where the affected variables were | 18:59 | ||
however: | |||
18:59
koye joined
|
|||
luqui | my $x; ...stuff { my $y; BEGIN { $x = { $y }; $y = { $x } } ...stuff } | 18:59 | |
ahh, pathological examples, my favorite | |||
it is impossible to initialize $x at the beginning of its scope | 19:00 | ||
ok... so, BEGIN blocks can only work on "compile-time existing variables" (this assumption is getting more and more useful) | |||
so you don't scope them | 19:01 | ||
they are all global | |||
then you can rig them to refer to each other | |||
(are you compiling to perl 5? I guess I don't fully understand what your target is) | |||
but of course, that has GC problems... | |||
fglock | I'm compiling to "desugared p6", which compiles either to p5 or parrot | 19:02 | |
19:02
theorbtwo joined
|
|||
[particle] | you'll need weak references | 19:02 | |
fglock | see mp6 | ||
luqui | okay, that was enough information | ||
hmm, so we need something where the creation of an object can claim a reference instead of creating it | 19:05 | ||
this is not a standard language feature :-( | 19:06 | ||
let's see here (brainstorming commencing) | |||
all compile-time existing variables (CEVs) are globals with an extra level of indirection | 19:07 | ||
fglock | what's a non-CEV example? | 19:08 | |
luqui | so: "my $x; BEGIN { $x = 4 };" turns into "my $__CEV_x1 = \do { my $x }; $$__CEV_x1 = 4;" | 19:09 | |
non-CEVs are things like $x in for 1..3 { my $x } | |||
fglock | k | ||
luqui | then you undef the reference at the end of its scope | 19:10 | |
so: "{ my $x; say $x }" turns into "my $__CEV_x1 ... ...; { say $$__CEV_x1; LEAVE { undefine $__CEV_x1 } } | 19:11 | ||
the initialization of all CEVs happens first thing in the the program | 19:12 | ||
before any other INIT blocks | |||
I think that actually does solve the circular-dependency pathology | |||
and the GC problem | 19:13 | ||
it's just... ugly | |||
19:13
awwaiid joined
|
|||
luqui | detecting the circular references could be really tricky | 19:14 | |
luqui ponders... | |||
another pathological example | |||
my $x; { my $y; BEGIN { $x = { $y } } }; { my $z; BEGIN { $x = { $x() + $z } } } | 19:15 | ||
I know how to convert that | 19:17 | ||
but coming up with an algorithm to do it, which can stand turing-completeness.... | |||
luqui wonders if it is possible just to "trace your path" in some sense | 19:19 | ||
it's easy for numbers and strings and things like that which have an easy lexical interchange | 19:20 | ||
but maybe you thunk closures and references | |||
and just remember what you did to them | 19:21 | ||
then do that again at the beginning of the program | |||
I wonder if it's possible to do that without re-implementing the entire core to handle it | |||
fglock | you can save $obj.perl and eval it back | 19:22 | |
luqui | if you could do it, I have to say, it would be a freaking sweet architecture | ||
fglock, you can't do that with closures tho, right? | |||
fglock | not now, but you should be able to do it | 19:23 | |
luqui | it's not a feasible problem in general, because of the inter-referentiality closures can have | ||
oh! | |||
but all the variables we are working with here have to be CEVs | |||
wait... no | 19:24 | ||
19:24
polettix joined
|
|||
luqui | my $y; my $z; BEGIN { my $x; $y = { $x }; $z = { $x } } | 19:24 | |
$x is not CEV, but you have to express that the variable that $y and $z are referencing are the same one | |||
which is the unsolvable problem of serializing closures | 19:25 | ||
fglock | yes, but both belong to env, which is a single struct | ||
you are doing a snapshot | |||
luqui | okay... how are you going to convince .perl to do that? | 19:26 | |
fglock | let's see... | 19:27 | |
trying with Data::Dump::Streamer | 19:28 | ||
this works: perl -MData::Dump::Streamer -e ' my $x = sub { 3 }; my $y = { a => $x, b => $x }; print Dump $y; ' | 19:31 | ||
luqui | the more pertinent example is: my $x; my $y = sub { $x++ }; my $z = sub { $x++ }; my $a = { y => $y, z => $z }; print Dump($a) | 19:33 | |
which, incredibly, works | |||
fglock | :) | ||
luqui | okay, DDS kicks butt | ||
diotalevi | dmq++ | 19:35 | |
luqui ponders compile-time continuations invoked at runtime | |||
luqui ponders committing suicide, but then stops | |||
I think it would be okay if we didn't support that... ever | |||
fglock | parrot might support that, with proper .perl | 19:36 | |
luqui | uh... I'm not sure that's possible | ||
I mean, if so, that'd be cool | 19:37 | ||
but how do you start running, and then go back to compile-time? | |||
oh | |||
I see | |||
well you wouldn't be doing separate compilation anymore | |||
[particle] | yep | ||
it's all deferred to runtime | |||
TimToady | It's lazy turtles all the way down... | 19:38 | |
luqui | oh, btw however, that it *is* impossible to .perl a continuation | ||
you can serialize | 19:39 | ||
them | |||
but you can't in pure perl | |||
(btw however, that ...; what the hell does that grammatical construct mean? :-) | 19:40 | ||
TimToady | It's a pessimistic Whatever. :) | ||
hmm, then there's the optimistic sub stub: | 19:42 | ||
sub foo { * } | |||
[particle] | it's good to see the optimistic case is properly huffmanized :) | 19:43 | |
TimToady | say 1..foo() | ||
luqui | real question: will that make foo behave exactly like * in all cases? | ||
TimToady | should | ||
luqui | so * is not syntactic... | ||
TimToady | it's the Whatever object | ||
luqui | okay. | 19:44 | |
TimToady | which we match in sigs with the Whatever type. | ||
we had to do way with prefix:<*> to get it. | |||
Juerd | *.foo(); | ||
TimToady | though you can still say *.() if you can persuade * to respond | ||
19:45
rindolf joined
|
|||
TimToady | "just call something, I don't care..." | 19:45 | |
Juerd | 5 + * + 5 | ||
rindolf | Hi all. | ||
TimToady | "I feel lucky..." | ||
luqui | randomly generate a program and execute it | ||
Juerd | kill *, $$; | ||
luqui | you could use it to check your solution to the halting problem | ||
TimToady | kill -INT, *; | ||
Juerd | luqui++ | ||
TimToady: In typing, can Whatever be abbrev'ed to *? | 19:46 | ||
TimToady | generally not | ||
Juerd | sub foo (*|Int $bar) { ... } | ||
TimToady | no, * is slurpy in that context | ||
Juerd | Of course | ||
TimToady | and Whatever needs dehuffmanization | ||
when you're writing multis | 19:47 | ||
rindolf | rgs: I'm unable to compile bleadperl on Mandriva Linux 2007. | ||
luqui | shouldn't | be slurpy? | ||
Juerd | So $* variables are whatever-scoped, right? :) | ||
TimToady | indeed | ||
wherever you go, there they are. | |||
Juerd | TimToady: Can * in void context please say "Hello, World!"? | 19:48 | |
TimToady | you mean |@rest instead of *@rest? | ||
I think it wants to spit out 99 bottles of beer on the wall... | 19:49 | ||
19:49
weinig_ is now known as weinig
|
|||
Juerd | TimToady: any(hello, bottles, quine) :P | 19:49 | |
luqui | Aleph-0 bottles of beer on the wall, aleph-0 bottles of beer. Take one down, pass it around, aleph-0 bottles of beer on the wall! | ||
TimToady | a bottle of quininety-nine... | 19:50 | |
rindolf | luqui: heh. | ||
rgs | rindolf: I'm not, what's the problem? | ||
rindolf | rgs: you mean, you *are* able to compile bleadperl? | 19:51 | |
rgs | yes | ||
rindolf | rgs: ah OK. | ||
rgs: let me try again. | |||
rgs | and tell me the error(s) | 19:52 | |
rindolf | rgs: OK. | ||
19:52
milan joined
|
|||
[particle] | * in void context is an entire language implementation (hq9+)? wow! | 19:52 | |
good april fool's idea | 19:53 | ||
diotalevi | Is there a concept of "stashes" in Perl 6? I tried doing a thing in perl 5 where I took a sub ref, localized the stash it came from, gave it an AUTOLOAD, then called the function to have it trigger the AUTOLOAD except it didn't work because the function didn't notice the localized stash. I want to know if I can make such a thing work in Perl 6. | ||
Juerd | [particle]: I don't see why not. | 19:54 | |
And why it would be an april fool's thing :) | |||
luqui | diotalevi, I'm not reaally sure what you're asking | ||
Juerd | If anything should be huffmanized, it's Hello, World :) | 19:55 | |
TimToady | I think the compiler has to be able to optimize based on what it thinks is the symbol table. | ||
luqui | oh that, yeah I tried that too | 19:56 | |
so, what if you said at compile time that "this isn't a regular symbol table, don't optimize!" | |||
for some tree of the symbol table | |||
s/tree/subtree/ | |||
TimToady | all things are possible, but I'd like to get Perl 6 out the door by Christmas... | 19:57 | |
diotalevi | luqui: I'm asking if I can substitute the symbol table for something else at runtime. You already know it can be modified at runtime but I wanted to do the moral equivalent of local %Foo::. Perl 5 has taken a pointer to it so it loses immediately. | ||
luqui | ahh, I wanted to tie it | 19:58 | |
TimToady | you need a declarative tie, which P6 presumably gives you better | ||
luqui | no, I meant in perl 7 | ||
allbery_b | isn't there some discussion of this in one of the synopses already? | ||
diotalevi | Oh yeah, I think schwern said that stashes in p5 can't take tie magic. That'd solve my problem too if it worked. | ||
TimToady | not if the tie happens too late for the compiler to notice. | 19:59 | |
in p5 tie is run-time only. | |||
you need something compile time, like "is XXX" | |||
fglock | decommute & | ||
diotalevi | Hmm. ok. | ||
diotalevi figures he can accomplish this in Perl 5 with B::Generate's as yet unwritten B::CV::STASH( cv, new stash ) mutator method. | 20:00 | ||
TimToady | package Foo is Pessimized; | 20:02 | |
20:07
rhizo joined
20:24
lisppaste3 joined
|
|||
rindolf | rgs: I got to the test stage now. | 20:29 | |
rgs: I guess it was a one-time-bug. | |||
rgs | arf | 20:31 | |
rindolf | rgs: what do you mean by "arf"? | 20:34 | |
rgs | the usual onomatopea emitted by programmers confronting an heisenbug | ||
rindolf | rgs: I see. | 20:39 | |
rgs: <<< All tests successful. >>> | 20:45 | ||
21:52
Aankhen`` joined
21:54
frankg joined
21:56
Schwern joined
22:06
justatheory joined
22:07
justatheory joined
22:20
koye joined
22:33
lisppaste3 joined
22:45
ashleyb joined
22:47
dduncan joined
22:58
gene9 joined
23:18
Psyche^ joined
23:34
Psyche^ is now known as Patterner
23:48
py1hon joined
|