6.2.11 released! | pugs.blogs.com | pugscode.org | pugs.kwiki.org | paste: sial.org/pbot/perl6
Set by audreyt on 1 February 2006.
00:48 kd joined 01:04 frederico joined 01:09 offby1 is now known as bags 01:10 bags is now known as offby1 01:36 xinming joined 02:18 Cryptic_K joined 02:30 kd left 02:34 justatheory joined
dduncan hello, anyone home? 02:43
xinming :-) 02:45
dduncan do you know if Perl 6 allows a class to define that an automatic default value is given to any variable declared of that type?
eg, I would want, if someone said "my MyNum $foo;" ...
then right then, $foo contains a new MyNum object having the value zero 02:46
rather than $foo being undefined
xinming dduncan: do you mean? my Num $o .= new?
dduncan yes, I would want that, but without someone explicitly saying .= new()
xinming is forgeting about which one is correct. .= or =. :-P
dduncan essentially, I want to override the 'my' operator in connection with that class 02:47
so it defaults to something other than undef, without the programmer specifying so
they can of course still give it an explicit value 02:48
xinming dduncan: I don't think you can do that by default. I think You might also want. class A {...}; A( a1 => 'v1', a2 => 'v2' );
dduncan essentially, I want to have a data type that is always defined
xinming dduncan: I don't think you can do that.
dduncan so I'll see if I can request this on p6l
02:52 ayrnieu joined
dduncan seen stevan 02:59
jabbot dduncan: stevan was seen 1 days 21 hours 34 minutes 52 seconds ago
stevan hey dduncan
dduncan okay, so you're one of the meta-model guys, right? 03:00
stevan i am the only one really :)
dduncan okay
I haven't looked too closely at the model yet ...
but does it have an overridable function for default values that a declared variable of a class has? 03:01
stevan best not too,.. it is still very much in flux,.. as is the spec too,..
dduncan said function would return undef by default
I'm writing to p6l now to request this, but thought I'd ask if it already existed or not
stevan can you give a code example
dduncan okay ...
my Foo $bar; # $bar automatically contains some defined value that was specified in class Foo 03:02
tjat
that's the usage case
stevan hmm
so just by declaring $bar to be a Foo,.. it is something
dduncan I know perl 6 has overloading hooks defined all over the place, so there should be one here too
stevan an instance of Foo i assume
dduncan yes 03:03
stevan what do you want to $bar to be able to do?
dduncan for example, I want to be able to declare a class where variables of that class are never undefined
so, ...
1. they get a default value on declaration
2. setting them to undef causes something else to happen, such as an exception or the default value 03:04
stevan hmmm
dduncan the latter case can be handled by overloading '=' I think, if that's possible
stevan this is exact opposite of Larry's "class but undef" thing
dduncan I'm just looking for an elegant solution
stevan I dont know if you can overload assignment
well according to Larry
dduncan though overloading assignment may not be necessary per se
stevan when you do my Foo $bar; 03:05
$bar is an instance of Foo, but a somewhat special instance of Foo
an instance which you can call methods on, but which evaluates to undef
so you can do:
my Foo $bar;
dduncan so in that case, I want to control what that special instance is
stevan $bar.isa(Foo)
and it reutnr true
but if ($bar) { "this would not be reached" } 03:06
dduncan eg, for my NumType $num; # now contains zero
stevan because $bar is "technically" no defined yet
yeah I think that might be difficult
dduncan or, my MyStr $str; # now contains ''
stevan what is the differrence with doing: my MyStr $str .= new(); 03:07
dduncan if the user leaves the ending off, the value is undefined
stevan this will ensure the instance is created.. then you can deal with the default then
yes
dduncan I want to have a defined value even if the user doesn't assign one
stevan you might be able to do this kind of trickery with the metamodel,.. but we have not figured it out yet 03:08
dduncan mind you ...
stevan this touches on the repr type issue which I have been babbling about lately
dduncan now, I'm assuming that the current Perl 6 ...
stevan suggest it on p6l
see what happens
dduncan if you define my Foo $foo = new Bar; # throws an exceptoin 03:09
stevan unless Bar.isa(Foo)
dduncan yes
or does that also work if Bar.does(Foo) ?
that case is what I'm more interested in
stevan uhm .. probably yes
actually,.. yes,.. for sure that will work 03:10
but please,.. post on p6l about possibly overriding the special "class but undef" thing
03:10 joepurl joined
stevan if nothing more,.. maybe you can get Larry to start expanding on that concept 03:10
dduncan widely speaking, I was looking for an elegant way to declare types that were more strict than normal
stevan it is somewhat still a little hand wavy 03:11
Yeah I am not sure if that will even "make sense" within the type system,... thats a question for luqui or audreyt
but I have to run,.. the movie is starting,.. and my wife is gonna kill me if I dont get off the computer :)
dduncan okay 03:12
stevan but please,.. post away,.. make sure to mention the "class but undef" idea,.. and get larry talking about it :)
stevan &
dduncan yes
03:34 diotalevi_ joined
dduncan stevan, that message is circulated 03:34
diotalevi_ Is there an equivalent to `use constant FOO => ...' in pugs? 03:38
03:49 Juerd joined
ayrnieu dio - the usual sub FOO { } ? 03:50
03:51 Alias_ joined
diotalevi_ But... that's not usual. The perl5 implementation changed recently and it got reinforced that constant subs really ought to just be declared with the long-time pragma. 03:59
Alias_ dduncan: ping?
seen dduncan
jabbot Alias_: dduncan was seen 25 minutes 19 seconds ago
diotalevi_ So... this is strange. Can I, in general, feed perl5 code to pugs? 04:02
dduncan diotalevi_, "is readonly" is what you want 04:13
Alias_ dduncan: You know we were talking about a demo project for Rosetta? 04:14
dduncan eg, "my $foo is readonly = 3;
Alias_ dduncan: I have the perfect one
dduncan go ahead
Alias_ dduncan: Can't really stay to talk but thought I'd ping you on it
dduncan: You know phpMyPgAdmin
dduncan fyi, my first demo was going to be a simple command line genealogy app ... very trivial
Alias_ or whatever that god-awful mostgres/mysql database manager thingy is?
dduncan yes, of course
Alias_ ok, so you have a SQL abstraction language 04:15
dduncan I've been planning to have a Perl replacement for that
great minds think alike and all that
Alias_ So write a half decent abstracted-backend database interface
04:15 Juerd joined
Alias_ Even if it only does the basics, the fact you can point it at many databases is a huge advantage. 04:15
It really shows off something you can't do without it
dduncan however, such a web interface from scratch will still take a fair amount of work if it'll be any good, so I'll want help with that
Alias_ (which is the most important part of a demo) 04:16
I think you'll find if your code doesn't suck, help will just turn up :)
Do it in Catalyst
dduncan sure
Alias_ volunteers to help out if so
dduncan in fact, I even proposed such an app as something that a local college can do as a "capstone project"
Alias_ Anyways, I keep find myself wanting a database interface via web that doesn't suck 04:17
04:17 joepurl joined
Alias_ And the Catalyst thing means I can even install it over CGI if needed 04:17
Anyways, just thought I'd let you know I think even a basic generalised database interface would be cool
That is all :)
Alias_ heads back to work
dduncan yes, I agree
04:17 Alias_ left 04:25 justatheory joined 04:58 KingDiamond joined 05:04 SamB joined 05:06 Khisanth joined 05:14 drrho joined 05:37 Cryptic_K joined 05:50 nothingmuch joined
gaal fr 06:12
06:17 joepurl joined
nothingmuch morning 06:27
nothingmuch goes to work
06:28 offby1 is now known as the`, the` is now known as or 06:33 or is now known as offby1 06:49 K_ joined 07:03 nothingmuch joined 07:11 Aankhen`` joined
nothingmuch audreyt: ping 07:13
07:19 GeJ joined 07:29 KingDiamond joined 07:37 iblechbot joined 08:48 kane_ joined 08:51 elmex joined 09:10 r0nny joined 09:16 Bulgarian left 09:26 rantanplan_ joined
meppl perl5:Thread::Queue does not work anymore :/ 10:08
10:16 iblechbot joined
meppl # pugs -e 'use perl5:Thread::Queue; my $queue=Thread::Queue.new; $queue.enqueue("foo"); my $thread=async { say $queue.dequeue}; $thread.join' 10:26
Segmentation fault
#
in older version of pugs it works i mean
i think 10:27
i didnt try it yet
s/in /with / 10:31
10:31 nnunley joined
azuroth you're a very confusing person, meppl 10:33
meppl :/ 10:34
aeh, so perl5:Thread::Queue; works without threads 10:36
i dont know why there is segmentation fault
im to stupid to find it out
10:43 j0sephi joined 10:53 nothingmuch joined 11:04 dada joined 11:10 nnunley_ joined 11:14 scook0 joined 11:31 joepurl joined
azuroth PHP's preg_replace doesn't let you get at the captures? 11:50
Juerd And how exactly is that something for #perl6? 11:51
And see tnx.nl/php for a table that has the answer 11:52
webmind perl6 is secretly a project make perl more into php ;)
azuroth ...sorry, I was just letting out some primitive aggression
integral pugs doesn't have a PHP frontend yet? :-P 11:53
azuroth or maybe it's motivating everyone, "we've already won" style
Juerd integral: PHP doesn't have lexical variables.
integral so it would be easy then! And might even run on parrot 11:55
Kattana azuroth: use preg_replace_callback, its ugly but you can intercept the matches 12:01
Juerd integral: ... 12:02
azuroth I guess I'd need global to store the match in too?
Juerd azuroth: Combine preg_match and preg_replace, using the same string for the regex. 12:03
azuroth hmm. I guess it's gotta be done
Juerd azuroth: Or use expressions in the RHS^Wreplacement string argument of preg_replace to assign to variables :)
azuroth oh? sounds good 12:04
Kattana azuroth: example of that www.php.net/manual/en/function.preg....php#54205 12:06
Juerd Kattana: That requires a named function. That's SO ugly. 12:08
(And don't forget, all create_function() does is return the NAME of a new NAMED (NOT ANONYMOUS) function.)
azuroth hahah. that's crazy 12:09
Juerd And because of the expected level of competence in any PHP programmer, create_function is documented as: Usually the args will be passed as a single quote delimited string, and this is also recommended for the code. The reason for using single quoted strings, is to protect the variable names from parsing, otherwise, if you use double quotes there will be a need to escape the variable names, e.g. \$avar.
Just after saying "Creates an anonymous function from the parameters passed, and returns a unique name for it."
Yeah, now I believe you.
Kattana Juerd: I said it was ugly already :P
Juerd Creates an anonymous thing and returns its name. Say what? 12:10
azuroth why would anyone want to use PHP?
Juerd azuroth: Why are you using it right now?
azuroth I think it's all that's installed on my work's server. I think it's lobby time, though
Juerd No Perl installed?!
azuroth hmm. it _could_ be, but I'll have to check later. I only just realised how bad PHP is, so I wasn't quite so perturbed by the apparent monolinguism 12:12
(using big words to cover up my mistake ;-) )
Kattana php5 is not so bad, and its actual made for web-devlopment, its regex integration is sorely lacking compared to perl tho 12:14
Juerd azuroth: 12:26
<?$w=escapeshellarg($_SERVER[SCRIPT_FILENAME]);$z=preg_split("/\n\n/",
`perl -e'<>;<>;<>;undef$/;eval<>' $w 2>&1`,2);foreach(preg_split("/\n/",$z[0])as
$y)header($y);echo$z[1];exit?>
print "Content-Type: text/plain\n\n";
print "perl++\n" for 1..10;
Sorry it took a while to make. PHP just sucks.
azuroth hahaha. excellent! that's very wizardy. 12:27
Juerd++ 12:28
szbalint heh, I did something similar for my university now-defunct website. 12:29
;) 12:30
Juerd I posted it on PM 12:39
perlmonks.org/?node_id=528203
Kattana: PHP5 is so bad, by the way. 12:40
lypie Juerd: yup. its a mess 12:46
the create_function addition made me want to cry
12:50 nnunley_ is now known as nnunley
azuroth night, all 12:55
Juerd lypie: Just that? Many thing in PHP make me cry. 12:57
tnx.nl/php lists a few.
Leave a wiki unattended for a year, and this happens: tnx.nl/wiki/ 13:01
13:03 chris2 joined
lypie hates wiki's 13:07
morning chris2 13:09
chris2 hi lypie 13:11
szbalint Are you the maintainer of tnx.nl, Juerd ? 13:13
13:21 kolibrie joined 13:24 pdcawley joined 13:27 iblechbot joined 13:32 kane-xs joined 13:38 drbean joined 14:07 Qiang joined
Juerd szbalint: Yes. 14:44
lypie: I like wikis. Why do you hate them?
lypie Juerd: because the developers in general are silly asses 14:50
chris2 developers of wikis? 14:51
lypie Juerd: i never did understand why wiki devels have such a hate for things that will affect only a single perfect of the population
Juerd: (as in, captchas)
s/perfect/percent/
webmind lypie, how many and which wikis have you tried and didn't like? 14:52
lypie webmind: i've not tried one i really liked
webmind: i've used 10-15 randomly. but never invested a lot of time in any given one
webmind I noticed that
chris2 lypie: remember i wrote nanoki, *you bastard*? :D
Kattana you hate wikis because you disagree with their devs?
webmind lypie, so what do you dislike ? 14:53
lypie webmind: i just dislike the overall interaction paradigm. lack of syntax checking and ajax based previews in most of them, and various other utter messups
webmind: main one being the insane amount of spam i always get on wiki's i'ved tried to use in the past
Kattana: yes. just like i hate perl5 because i disagree with the design of perl5? ;) 14:54
webmind spam has nothing todo with the developers
lypie Kattana: note, i'm quite binary in my tastes
webmind wikis are mainly build on trust
Kattana hate perl5 because its ugly and kludged together.
lypie webmind: if they can't code up a 50 line captcha check then sorry.. but... what good is trust?
webmind: i'm all for login only read/write access personally
webmind lypie, it gives freedom
lypie, well that's possible 14:55
lypie webmind: then you can't stop spam
webmind controlled user acounts does
Juerd lypie: I don't like wiki SYNTAX. In fact, I hate it.
Kattana if you are forced to login then all sorts of evil things can be done to you, anonymous is good, hating spam is fine, but not part of wikis
Juerd lypie: But wikis are useful. Captcha's I haven't noticed yet.
lypie webmind: i agree, and i'd love a trust metric based wiki with easy to create login accounts
webmind lypie, the klaphek wiki hardly ever gets spam since you have to register and the front page is locked
lypie webmind: but i'm still waiting...
webmind: yeah. i agree with that policy entirely 14:56
webmind well it also works
lypie webmind: but the number of people that slap you back in he face for using it is just sad
s/he/the/
webmind huh ?
I just said that works
against spam
lypie webmind: /me nods. that sounds a sane inbetween
Juerd: agreed. they are useful 14:57
webmind as for syntax checking and ajax based previews I've got no idea what you are talking about
lypie needs to try confluence at some point
webmind: i never get the wiki syntax right. it always screws up on me. i'm a n00b
Juerd webmind: "ajax" is the new hyped term for realtime interaction in otherwise normal html pages.
webmind: Generally, it assumes javascript/xml communication. But that's unnecessarily complex in many cases. 14:58
lypie Juerd: i use ajaj in all cases ;) but people love their buzzwords!
Juerd aja?
j?
webmind lypie, well I find it's with every wiki a bit of getting used to.. but no too bad in mediawiki/docuwiki seems to be ok although sometimes a bit awkward
lypie webmind: mediawiki seems one of the most sane
webmind: and the pages are pretty :P 14:59
Juerd I dislike kwiki syntax most. I just don't know how to format code in it.
Inline that is.
webmind docuwiki is kinda the same on the user end.. but a lot lighter
Kattana mediawiki is the origional isnt it.
webmind Juerd, ever tried moinmoin ?
Juerd I just want to be able to use stuff like $foo[0] without escaping anything.
webmind Kattana, original what ?
Juerd webmind: Yes, but I don't remember much of it. I think I found it terrible.
chris2 likes markdown
Kattana wiki
webmind Juerd, it lacks all useful features and uses WikiWords 15:00
webmind really really dislikes WikiWords
Juerd So do I.
chris2 WikiWords rule! :(
theorbtwo mediawiki is by no means the eldest. OTOH, the popularity of WP probably did much to push the profile of wikis in general.
lypie chris2: wikiwords as in camel case? 15:01
chris2 yeah
lypie chris2: if so, i hate them
[[blah]] is my preference
chris2 ick
but i'm special, i know 15:02
integral usemod is one of the older wikis
chris2 yeah
webmind chris2, how would you link your nick then ?
ChRis ?
chris2 usemod is based on the first wiki, no?
ChrisTwo
integral it's certainly very old and based directly on the original wiki 15:03
chris2 and a hell of a mess :)
but very easy to install
Kattana mediawiki is the wiki of wikipedia, and the wikipedia founders came up with the wiki idea, so it should be the latest version of the origional?
chris2 nooo
c2.com was the first wiki 15:04
integral it still *is* the first wiki :)
chris2 yeah ;)
integral oddmuse is meant to be a sort of better written successor to usemod
chris2 too bad it doesnt show up on google :)
integral ah, en.wikipedia.org/wiki/UseMod posits a history for usemod. 15:05
15:15 mauke joined 15:42 Eimi joined 15:50 szbalint_ joined 15:51 szbalint_ is now known as szbalint 15:55 robkinyon joined 15:56 hexmode joined
mauke why doesn't my pugs build? 16:12
integral what's your error?
mauke lots of linker errors, probably because of: 16:13
Building Pugs-6.2.11...
/usr/bin/ar: dist/build/src/Data/Yaml/Syck_stub.o: No such file or directory
/usr/bin/ar: dist/build/src/Pugs/Embed/Perl5_stub.o: No such file or directory
integral what's your PERL_EMBED?
are you building from clean?
mauke I don't have a PERL_EMBED (PUGS_EMBED=perl5), and this is from a fresh svn co ... 16:14
integral err, I mean PUGS_EMBED right
hrm
16:15 vel joined
mauke the _stub files exist, but they're in ./dist/build, not Data/Yaml|Pugs/Embed (which don't exist) 16:15
integral hmm, weird 16:17
16:17 justatheory joined
integral I have no idea what's going on 16:18
wolverian wow, tons of test errors on fbsd 16:25
t/builtins/arrays/push..................................ok 23/41pugs: internal error: EVACUATED object entered! Please report this as a bug to [email@hidden.address] or www.sourceforge.net/projects/ghc/ 16:26
integral o_O
wolverian not me compiling it so maybe he forgot something elementary
another:
t/oo/methods/instance...................................ok 2/17pugs: internal error: stg_ap_pp_ret
theorbtwo thinks a make clean all is called for. 16:27
16:31 feng123 joined 16:35 elmex joined 16:50 marmic joined 17:00 elmex_ joined 17:38 nothingmuch joined, KingDiamond joined 18:01 G2 joined 18:38 nnunley joined 18:43 beppu__ is now known as beppu, bernhard joined 19:01 larsen joined 19:02 Amnesiac joined 19:06 rantanplan_ joined 19:19 PerlJam joined 19:24 dduncan joined 19:28 Pap joined 19:32 Pap left 19:54 vel joined 19:57 vel joined
meppl so 20:06
how can i get the reference of a method
?
my $red = \$obj.foo(); doesnt work
s/red/ref/ 20:07
gaal $ref = &foo; 20:09
if you want a closure bound to a particular invocant, make a closure explicitly: 20:10
$ref = { $obj.foo() };
meppl :D 20:11
thank you very much
gaal come to think of it I'm unsure how to invoke &foo in the first case. $obj.$ref is wrong. 20:12
PerlJam wonders why anyone would want a ref to a method anyway 20:13
gaal jollymorphism!
PerlJam gaal: why is $obj.$ref wrong in that case? 20:14
gaal eh, I was unclear. maybe it is right p6. pugs doesn't parse it currently. :-) 20:15
meppl gaal, thats what i wanted --> <gaal> $ref = { $obj.foo() };
yo, in fact i tried $obj.$ref 20:16
but pugs dont want that
doesnt
gaal I lurve p6's lightweight closure syntax 20:17
PerlJam gaal: from S12 -- $obj.$methodname(1,2,3) 20:18
looks like a bug that's ripe for fixing in pugs :-)
meppl perljam, i wanted to send a reference of a method to another thread
for executing
PerlJam I suppose that $method $obj: should work too 20:21
meppl: slinging objects between threads works nicely?
meppl i used use perl5:Thread::Queue; 20:22
my $foo = Test2::Test.new(string1 => 'parrot +', string2 => 'pugs'); 20:23
$queue.enqueue({ $foo.lprint() });
my $thread = async
{
my $blubb = $queue.dequeue();
$blubb();
};
$thread.join;
so
it worked
so 20:24
a GUI could start a CPU-intensiv procedur by this way? 20:26
gaal wow 20:27
that's very cool :)
20:33 premshree_ joined 20:37 nnunley joined 21:10 DesreveR joined 21:22 DaGo joined 21:26 KingDiamond joined 21:34 DesreveR joined 21:35 DesreveR is now known as r0nny 22:03 nothingmuch joined 22:47 gaal joined, KingDiamond is now known as KingDiamond|away 22:57 drbean joined 23:36 frederico_ joined 23:37 mauke joined 23:51 elmex joined