BenGoldberg Save your intermediate results to a file after every successfully processed page; when you get to the end, read the file in and exit(0). Write a wrapper program which restarts the program when it crashes. 00:00
AlexDaniel yeah, that's I'm pissed off 00:02
took 30 minutes to write the scraper, and several hours trying to work around all of the issues
70 lines of code, and now I'll double or trible that number trying to do what you've just said 00:03
that said, as long as I'm not fixing memory leaks or segfaults, I think I have no right to complain… 00:04
00:05 cyphase joined 00:10 Cabanossi left 00:11 Cabanossi joined 00:13 cyphase left, gdonald left 00:14 gdonald joined 00:18 cyphase joined 00:21 dj_goku left
AlexDaniel AW YEAH, much better! 00:21
BenGoldberg :) 00:24
00:24 cyphase left 00:26 andrei9999 left
AlexDaniel fwiw: github.com/sergot/http-useragent/issues/169 00:27
00:28 cyphase joined 00:29 BenGoldberg left
AlexDaniel hm… OK, it's better. Now with only ≈5 MB leaking per page, I'd be able to parse 2000 pages using 10GB RAM. That might work 00:32
00:32 bjz left 00:34 dj_goku joined 00:37 cyphase left 00:39 wamba left 00:41 cyphase joined 00:47 thowe_work left 00:49 cyphase left 00:54 cyphase joined 00:57 bjz joined 00:58 bjz left 01:00 labster left 01:02 cyphase left 01:03 BenGoldberg joined 01:07 cyphase joined 01:11 cyphase left 01:18 LeCamarade left 01:26 nbrown joined 01:38 Cabanossi left, bjz joined 01:41 Cabanossi joined 01:43 sufrostico left 01:44 sufrostico joined 01:45 ilbot3 left 01:47 ilbot3 joined, ChanServ sets mode: +v ilbot3 01:50 sufrostico left 02:01 raschipi joined 02:09 Cabanossi left 02:11 Cabanossi joined 02:27 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 02:31 raschipi left 02:36 noganex joined 02:39 noganex_ left 02:40 kurahaupo__ left 02:48 labster joined, kurahaupo left 02:57 BenGoldberg left 03:01 rpburkholder left 03:04 Luna521 joined 03:11 skids left
ugexe gfldex: you might look at github.com/ugexe/Perl6-Distribution--Common - specifically ::Git 03:11
03:12 Luna521 left 03:13 BenGoldberg joined 03:14 Luna521 joined
ugexe that would even respect .gitignore, because it uses `git ls-files` to get its file list 03:14
03:17 Luna521 left, Luna521 joined 03:21 Luna521 left
ugexe eventually zef will be backed by those, but they don't work on earlier version of 6.c 03:22
infact Distribution::Common's whole purpose was to see how an additional required method, `ls-files`, would work with the current Distribution interface to solve the "which files to use if i dont have a manifest?" problem 03:38
03:44 bjz left 03:53 Cabanossi left, Luna521 joined 03:55 Cabanossi joined 03:58 Luna521 left 04:00 Luna521 joined 04:02 bjz joined 04:03 gdonald left, gdonald joined 04:10 Luna521 left 04:16 ryan_ joined
ryan_ newby question... anybody here using atom's vim-mode-plus for perl 6 editing? 04:19
04:21 nbrown left 04:22 skaji_ is now known as skaji
MasterDuke ryan_: i don't use atom, but i know a couple people here do, there's a wiki somewhere about using it for perl 6 04:29
huggable: atom
huggable MasterDuke, nothing found
MasterDuke huggable: Atom
huggable MasterDuke, nothing found
MasterDuke huggable: Perl 6 IDE 04:30
huggable MasterDuke, nothing found
MasterDuke huggable: Perl6 IDE
huggable MasterDuke, nothing found
MasterDuke ryan_: oops, not a wiki. github.com/perl6/Atom-as-a-Perl6-IDE
.seen sergot 04:32
yoleaux I saw sergot 11 Mar 2017 15:51Z in #perl6: <sergot> sjn: have you solved the http::useragent issue somehow? :)
04:35 Todd__ joined
MasterDuke .tell sergot fyi, i just created a PR in github.com/sergot/openssl that gave me a measurable speedup using HTTP::UserAgent to get an HTTPS url 04:35
yoleaux MasterDuke: I'll pass your message to sergot.
Todd__ Hi All, something weird just happened to my perl6:
$ perl6 -v Unhandled exception: While looking for 'ModuleLoader.moarvm': no such file or directory
same message when running "zef" 04:36
MasterDuke Todd__: how did you get/built your perl6? 04:38
Todd__ rakudo-star-0.0.2016.11-1.el7.x86_64
from the rpm
And I did not do anything to since
MasterDuke you're on centos7? 04:40
or rhel7?
Todd__ close. Scieltific Linux 7.3, which rebases centos 04:41
scientific
MasterDuke did you use yum to install from a repo or did you download from the rakudo page?
Todd__ yum --enablerepo=epel* install rakudo-star 04:42
that was about two months ago. it has been working since. Would a reinstall screw it up?
MasterDuke well, there's a 2017.01 star, so that repo is out of date
reinstalling should be fine 04:43
Todd__ When I try to reinstall, I get : Installed package rakudo-star-0.0.2016.11-1.el7.x86_64 (from epel-testing) not available 04:44
I wonder if it has been pulled? "whatprovides" still shows it 04:45
MasterDuke if you don't mind installing an rpm directly (and just regular rakudo, not star), El_Che has packages here github.com/nxadm/rakudo-pkg/releases 04:46
Todd__ what is non-star?
EPEL now has: dl.fedoraproject.org/pub/epel/7/x8...x86_64.rpm 04:47
MasterDuke same perl6, just without all the additional modules bundled
Todd__ star had almost no modules anyway that I could tell. I had to zef them all
MasterDuke i.e., you'll probably have to use zef to install the modules yourself
Todd__ do I need to do an uninsall on rakudo-star first 04:48
MasterDuke i don't really know the redhat distros enough to say, but that seems like a good idea 04:49
Todd__ interesting rakudo-start was an 18M package to unbinsall; regular is also 18M 04:51
# perl6 -v This is Rakudo version 2017.02 built on MoarVM version 2017.02 implementing Perl 6.c. 04:52
MasterDuke Todd__: huh, maybe they didn't actually have star in the first place. would explain why you had to zef everything 04:53
buggable: eco sum 04:54
buggable MasterDuke, Found 5 results: String::CRC32, Sum, Business::CreditCard, Concurrent::Iterator, MetaCPAN::Favorite. See modules.perl6.org/#q=sum
Todd__ makes sense. zef is now broken
rebuilding zef 04:56
can't win: # perl6 -Ilib bin/zef install . ===> Testing: zef:ver('0.1.5'):auth('github:ugexe') ===SORRY!=== Could not find Test at line 2 in: /home/linuxutil/zef/lib /root/.perl6 /usr/share/perl6/site /usr/share/perl6/vendor /usr/share/perl6 CompUnit::Repository::AbsolutePath<71479552> CompUnit::Repository::NQP<54652192> CompUnit::Repository::Perl5<54652232> 04:59
MasterDuke might need to ask ugexe, i don't really know zef 05:01
Todd__ not finding how to uninstall zef 05:07
I uninstalled again and deleted /usr/share/perl6; I am updating updatedb; then I will install the one from rakudo-pkg 05:16
ugexe well you could just run it with --/test to disable testing, but rakudo isnt finding your perl6 libs anyway (or it would have found Test.pm) 05:25
05:25 Luna521 joined
Todd__ I am fighting with pathmunge to get the path to perl6 correct. The two rpm used different install location. AAHHHH !!! 05:26
05:27 ryan_ left
Todd__ I have to log off and log back in, so I will get back if it doesn't work 05:27
05:28 Todd__ left
ugexe you can use an uninstalled zef to uninstall and install modules too 05:28
05:28 ryan_ joined
ugexe from anywhere 05:28
05:32 Luna521 left 05:33 llfourn left 05:37 vendethiel left 05:39 Cabanossi left, todd__ joined 05:40 Cabanossi joined
todd__ hi, I am back. I uninstalled and erased everything I could find. Then reinstalled nsadm's epel centos release. Had to update my paths in /etc/profile to 05:41
pathmunge /opt/rakudo/bin after
Voldenet eh, whenever I recompile perl I tend to just remove ~/.perl and reinstall zef
todd__ and make a link # ln -s /opt/rakudo/bin/perl6 /usr/bin/perl6
Voldenet faster
todd__ I am back and running. zef too. Thank you for all the help.
My guess is that epel screwed up something royalls. SO I think I will stay on nxadm for now 05:42
question. I have #!/usr/bin/perl6 as my first line. so, or course, the rpm and nxadm use different paths. The link cured that. Sounld I not use that as a first line? is there a way to look at both paths in the first line? 05:43
ugexe #!/usr/bin/env perl6 ? 05:46
samcv hello todd__ Voldenet and all
todd__ Hi Sam! I have been in panic mode, but I think I am on the right path now 05:48
ugexe openssl bumped to 0.1.8 with MasterDuke's leak fix
AlexDaniel MasterDuke: oh wait, so is it still leaking or is it 268Mb of some other cruft?
05:49 ryan_ left 05:50 ryan_ joined 05:52 ryan_ left 05:53 ryan_ joined
todd__ I am probably going to get the figure shaken at me for this, but I reported it anyway: 05:56
github.com/nxadm/rakudo-pkg/issues/9
05:56 ryan_ left 05:57 ryan_ joined
todd__ need best practice: if various releases of rakudo are going to install in different places (in Linux), is it best to leave the `#!/usr/bin/perl6`off and run everything the hard way with `perl6 xxx.pl6` and remove the bash first line path? I am trying to make things univeral across Liux machines 06:00
I am about to post this on the mailing list, whre other can take their time answer it. 06:12
Thank you all for the help. I am runnign again. And I did not even utter one cuss word! Man EPEL screwed things up! Bye bye 06:13
06:14 todd__ left
Voldenet samcv: hello there, apostle of perl6 ;) 06:15
06:15 domidumont joined 06:16 BenGoldberg left
Voldenet I was going to respond todd__ to use the "env" version, because he can in fact control PATHs 06:16
06:17 domidumont left
samcv is the mailing list any good? i'm not on it 06:17
not sure if i should be. maybe good idea?
get enough mail as is, but no excuse not to get more mail
Voldenet hmmmm, maybe, I don't set up any new ones because of the emails flood 06:18
06:19 domidumont joined, bjz left 06:22 Cabanossi left 06:25 Cabanossi joined
samcv i've started to set up filtering 06:26
but i think i've lost some email cause idk where they are 06:27
and should have more email than i do. pretty sure i wuold have gotten an email about the rakudo project in the last 15 days by now
though it's working fine for the other filters so idk. maybe github changed my setting. 06:28
and need to fix it because although it's filtering into folder some of the unicode maillinglist i still am getting floods of email threads. 06:29
much email. very wow
06:31 ryan_ left, ryan_ joined
samcv lots of silly discussion with the emoji release, people uselessly arguing over what 'recommends' in the technical report means 06:32
Voldenet when I was younger I thought getting many emails is good, because I'm important, heh :D 06:34
samcv usually a mix of script based questions and sometimes technical questions and such
though there is some thread in the huge like tree shape the unicode emoji 5.0 characters now being final thing 06:35
about stability of country codes and such which idk. i guess maybe sounds boring but it's at least important. not arguing about what 'recommends' means. and then peolpe finally settle on that recommendhs means... drumroll. "recommends" 06:36
which i could have told you but. whatever
06:37 RabidGravy joined
Voldenet heh, I'd advise against using such fuzzy terms, I'd use "suggests" instead ;-) 06:37
samcv that's different though 06:38
i mean recommends means that it is recommended but not required
Voldenet and suggest means it's a good practice but not required
pretty much
samcv and is not needed to be Unicode compliant and other systems should not assume conformance with said recommendation
but they use recommended in many documents. which is loose and not really a strong technical thing 06:39
06:39 wamba joined
samcv well. it's recommended. idk how else to say it. lol 06:39
and people arguing about flags 06:40
Voldenet actually, RFC is pretty clear on what "RECOMMENDED" means
samcv angry because england and wales got flags because of sports
This word, or the adjective "RECOMMENDED", mean that there 06:41
may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course.
yeah. exactly
Voldenet meaning "implement it unless you're working on 10kb ram"
samcv and people not understanding how unicode chooses things 06:42
"i am mad because these symbols are used more in practice than mine, and they were included. becuase i don't care about sports"
"but i care about XYZ"
Voldenet unicode could just set up a code for inline bitmaps just for them :-) 06:45
that'd be a great april fools joke
samcv well that is their recommendation
in the technical reports even now. for a long time
to implement images 06:46
Voldenet uhh, hmm I can imagine hardware being fast enough for this, but it adds a layer of complexity nobody really needs
samcv also there is no reason why a vender can't allow use of a flog not on their list. if it follows unicode's rules
for how they should be laid out
that is the best way for it to be officially included in the next revision 06:47
dlike it says california is not a standard sequence, but gives an example of how that would be laid out, and for some other non country things 06:48
Voldenet hmm, there are also political things at play, some people would see Basque or ISIS with separate flags for instance 06:49
samcv lol
TEttinger hehe unicode emoji is a silly thing to argue about because it's a silly thing in general
samcv depending on what it is yeah
Voldenet TEttinger: well, I can't imagine any font fully implementing unicode
some fonts try, but I doubt they're complete 06:50
samcv just becuase it's not on the list doesn't mean unicode hasn' already defined how to properly construct it
but it's touchy for some people
TEttinger U+1D00D DEPICTION OF THE PROPHET MUHAMMAD, BLESSED BE HIS NAME 06:51
samcv they basically just made it have certain 'standard' onnes to support emoji 5 or whatever, which was some more popular flags. which will get people to integrate support for those encodings of those flags
which will then... make it easier to add flags for less popular things
TEttinger and then with joiners...
samcv so they should not be unhappy
Voldenet TEttinger: actually U+1D00D is "Byzantine Musical Symbol Apeso Ekfonitikon" 06:52
TEttinger you could have genderbent muhammad emoji, not controversial at all
ha
Voldenet I don't know how it actually looks like, because none of my fonts support it
samcv Indeed, why isn't the flag of Texas there already so as to terminate
the abuse of <U+1F1E8, U+1F1F1>. Technically, at least, it has the
justification of being a formerly independent country, though I don't
know that they have any national teams.
Is anyone working on the issue of flags for the whole of Ireland?
Different sports have their own 'national' flags.
ok gotta stop reading this particular thread
TEttinger haha
samcv they showed an example for how one would construct a california flag. and then next to it said it was not official but conformant with construction. idk 06:53
people don't understand that i guess. that they basically handed them the way to make texas
06:53 Cabanossi left
TEttinger I mean... what we need is some kind of turing-complete way to describe Unicode encodings 06:53
samcv don't we already
TEttinger procedural unicode version generator
samcv also define describe
Voldenet TEttinger: 0xBITMAP
TEttinger hehe
samcv what do you mean by describe 06:54
TEttinger declarative language that can define an arbitrary sub/superset of unicode graphemes and use it in some cross-compatible way
including, for example, defining a texas flag as they do
but assigning it to its own codepoint in the subset 06:55
06:55 Cabanossi joined
Voldenet I think only regular letters (or symbols, in any language) should be a part of the official UTF standard, bitmap should work for the rest 06:55
TEttinger yes.
dingbats and emoji are really sketchy
Voldenet fonts can't think of other ways to display flags, so it's just a bit silly to include them
TEttinger but it kinda needs better vector support than a bitmap, since most fonts aren't bitmap fonts 06:56
Voldenet Okay, some emoticons can be included, but ehm... flags?
I can imagine having "asian people" font for emotes or "monkeys"
TEttinger since those originated on japanese phones?
but everyone uses them
Voldenet I try not to, it makes me look silly. 06:57
TEttinger every cultural group has people who use them
u-ou how do you reference a method like &foo for sub foo?
TEttinger (not the Amish, though)
Voldenet u-ou: you mean as an argument? 06:58
m: sub x(&my-sub) { my-sub() }; x({ say "I work!" }) 06:59
camelia I work!
u-ou you can reference the subroutine 'foo' without calling it like &foo. but how do you do that with a method?
Voldenet ah
u-ou actually. maybe I don't need to. but I'm interested now. 07:00
I might just use an anonymous function
samcv well. people use emoji and flags to communicate. and that's unicode's job. to enable the interoperability of the display of graphics with semantical meaning
TEttinger but each carrier displays them differently 07:01
and each font!
samcv they are used by people to communicate. so therefore they are important. same with many different scripts, and they added dingbats to allow conversion between encodings which already were encoded that way
that is not unicode's fault 07:02
like apple changing pistol to a ray gun. that's not what it is. it's the symbol for a pistol
you can't just change what the meaning of the codepoint is because reasons 07:03
that goes against the whole spirit of unicode and interoperability
07:03 ufobat joined, bjz joined
Voldenet m: class a { method m() { say "m"} }; sub b(&m) { say "b"; m(); }; my $x = a.new; say b(&{$a.m}) 07:06
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3say "b"; m(); }; my $x = a.new; say b(&{7⏏5$a.m})
Voldenet m: class a { method m() { say "m"} }; sub b(&m) { say "b"; m(); }; my $a = a.new; say b(&{$a.m})
camelia b
m
True
Voldenet u-ou: ^
in fact 07:07
m: class a { method m() { say "m"} }; sub b(&m) { say "b"; m(); say "/b"; }; my $a = a.new; b(&{$a.m()}) 07:08
camelia b
m
/b
Voldenet samcv: but the emoticons can have bigger or smaller eyes, "pistol" doesn't have to be any special model/color 07:09
u-ou didn't you just make an anonymous function that calls a.m
Voldenet u-ou: but look at the output, /it works/ ;D 07:10
samcv well it has to be a pistol
not something that is a fictional toy weapon
u-ou well, that's probably all I need
Voldenet u-ou: actually, just {$a.m()} would suffice
samcv also. they should maintain consistent color
u-ou yeah 07:11
I wonder if you can ref. methods though
Voldenet samcv: too late, on my system it's silver pistol, but on reference graphic it's black 07:13
u-ou oh well. I'll just use an anon. func. 07:14
RabidGravy boom! 07:15
TEttinger I mean, there's more than one color of pistol. you could use the skin color selectors on it if they were open-minded enough to allow more arbitrary colors. maybe I identify as green man 07:16
07:16 rindolf joined
TEttinger maybe flag color selectors? not sure how it works 07:16
samcv lol TEttinger 07:17
TEttinger maybe my pistol is made of stitched together human flesh 07:18
pretty sure that's a zombie attack in the Disgaea series
Voldenet some flags actually have colors described in CIELUV
TEttinger oh wow
nepal is a weird one 07:19
the two triangles
07:20 mr-foobar joined 07:22 Cabanossi left 07:25 Cabanossi joined
Voldenet TEttinger: unicode.org/reports/tr51/#Diversity 07:25
You actually can be green
TEttinger hooray 07:26
now can I be a color that is brighter than white light
I am actually pretty pale!
or could I be vantablack, the blackest shade of black currently prodicible... 07:27
Voldenet: that restricts it to 5 skin colors, it seems 07:30
Voldenet Whoa, that's totally racist. My green people will hear of this
TEttinger greengos 07:31
Voldenet ;D
rindolf Hi all 07:33
Voldenet welcome 07:34
rindolf Voldenet: sup? 07:35
Voldenet nothing much, hating on modern communication standards ;)
u-ou my brain is so tired 07:36
07:41 ryan_ left 07:49 nadim_ joined 07:51 Tonik joined 07:56 RabidGravy left 08:01 espadrine_ joined 08:03 Wanderer68 joined 08:04 RabidGravy joined, dct joined, domidumont left
RabidGravy have they changed the font on github recently or are my eyes worse than they usually are on a Saturday morning? 08:16
lizmat I think they use a special font for pirates 08:50
08:51 titsuki left 08:53 Cabanossi left 08:55 Cabanossi joined
RabidGravy sounds about right :) 08:59
I don't suppose anyone can remember off the top of their head where in the code parameter coercion is implemented? 09:01
lizmat FROGGS would know, perhaps timotimo
RabidGravy presumably in the parameter binding bit somewhere, but I am struggling to find it 09:03
09:04 rpburkholder joined
RabidGravy not being obviously able to implement Foo(Str) without augmenting Str finally bugged me enough to think about it 09:08
09:11 rindolf left 09:16 cog_ joined 09:17 labster left 09:19 rindolf joined 09:20 rpburkholder left
RabidGravy Oh it looks like it's in Ops.nqp - not that easy to fix from user code then 09:21
09:23 cog_ left
Woodi hi #perl6 :) 09:31
so what is minimal bitmap resolution for all Unicode chars ? in 8bit computers 8x8 was enough :) 09:33
09:42 setty1 joined 09:43 Peter_R left 09:44 mr-foobar left, Peter_R joined, mr-foobar joined 09:53 Peter_R left, Cabanossi left, Peter_R joined 09:55 Cabanossi joined, pmurias joined
Voldenet m: class x { submethod BUILD { say "i live" }; submethod DESTROY { say "i die" }}; { my $x = x.new(); undefine $x; }; 10:06
camelia i live
Voldenet Hm, am I doing something wrong? 10:07
lizmat Voldenet: Perl 6 doesn't have predictable destruction 10:13
if you want to make sure something gets destroyed when leaving a block, you will have to do it yourself
m: class x { submethod BUILD { say "i live" }; submethod DESTROY { say "i die" }}; { my $x = x.new(); LEAVE $x.DESTROY }; 10:14
camelia i live
i die
Voldenet hmm, that's quite golang-ish
does perl have some cool feature for that, like C++? 10:15
lizmat in a bigger program, .DESTROY *will* be called as soon as $x is kicked in a GC run
but if you have a small program, rakudo perl 6 just lets the OS take care of cleanup
Voldenet m: use nqp; class x { submethod BUILD { say "i live" }; submethod DESTROY { say "i die" }}; { my $x = x.new(); undefine $x; }; nqp::force_gc()
camelia i live
lizmat m: use nqp; class x { submethod BUILD { say "i live" }; submethod DESTROY { say "i die" }}; { my $x = x.new(); undefine $x; }; nqp::force_gc; nqp::force_gc 10:16
camelia i live
i die
10:16 llfourn joined
Voldenet ah, wonders of GC 10:16
10:16 Peter_R left
lizmat actually, a GC run will mark the object first 10:16
a subsequent run will actually call the .DESTROY 10:17
Voldenet oh, moar's GC doesn't do generations?
lizmat Voldenet: moar uses a nursery approach
Voldenet hm
nothing too wrong with that I suppose 10:18
lizmat www.amazon.com/Garbage-Collection-...1420082795 # the theory implemented in Moar
10:18 Peter_R joined
Voldenet hm, sorry, I don't have that book 10:20
but it's mark and sweep, right?
lizmat that's the idea, afaik 10:21
and a nursery for short-lived objects
moarvm.org/features.html # Garbage collection section
Voldenet well, but I can be sure that DESTROY works, that's the most important 10:22
I would admire having some solid method that'd force a "full gc run that destroys inaccessible objects"
lizmat indeed... if you want predictable destruction, you will have to take care of it yourself
Voldenet to ensure my destructors are working fine
lizmat I think doing the force_gc twice, is fairly sure way of testing that 10:23
especially in single threaded programs :-)
Voldenet hm, C# has the using and IDisposable block for that, perl could use something similar
lizmat but, what do you want to test? 10:25
that the .DESTROY method is called, or that it does the right thing?
if you want to test it's doing the right thing, why not just call it ?
Voldenet some simple stuff like calling closing some connections
heh, fair point :) 10:26
still, perl has much syntax, one "new and destroy on leave" wouldn't hurt
lizmat well 10:27
one syntax is:
my $handle will leave .close = open("file")
my $handle will leave { .close } = open("file") 10:28
which will create a LEAVE block for you
Voldenet That's actually pretty nice, but don't we have any nice role for that? Explicitly calling destructor feels very Cish ;P 10:29
s/destructor/dispose/
I might be a bit intoxicated by C# here though, I like how they solved it.
lizmat well, it's one of the consequences of not doing reference counting
so how did C# solve it ?
(reference counting in a threaded world is a recipe for either slowness or disaster) 10:30
Voldenet they have normal classes with constructor and destructor
and additionally
IDisposable interface having method { void Dispose(); }
and when a class implements IDisposable, it can be used in such way
using(var sth = new MyClass()){ sth.Test(); } 10:31
and Dispose is called automatically upon exiting the "using" clause
and real Destructor is usually just keeping eye on IDisposable (hand-written "if it wasn't disposed then dispose") 10:32
lizmat hmmm... feels like we should be able to do something like that
10:35 domidumont joined
lizmat m: sub using(\a) { class { method AT-KEY(\b) { a.DESTROY; b } }.new }; class A { method DESTROY() { say "died" } }; using(A.new){ say "foo" } 10:36
camelia foo
died
lizmat not sure I like the syntax though 10:37
10:37 robertle joined, setty1 left
lizmat Voldenet: ^^^ 10:38
10:39 setty1 joined, Cabanossi left 10:40 Cabanossi joined 10:41 domidumont left
Voldenet lizmat: whoa, that's quite nice 10:41
but it doesn't preserve all the features - how do you actually use this object created? ;) 10:44
10:44 domidumont joined
Voldenet ah 10:44
hm, okay, I figured it out and it's very similar to what C# does 10:46
10:46 notbenh joined, domidumont left
lizmat m: sub using(\a) { class { method AT-KEY(\b) { a.DESTROY; b } }.new }; class A { method DESTROY() { say "died" } }; using(my $a = A.new){ say $a } 10:46
camelia A.new
died
lizmat so yes, basically the same way that C# does it 10:47
Voldenet C# can also do this: > using(my $a = A.new) using(my $b = A.new) using(my $c = A.new) { say $a, $b, $c; }
But well, the syntax doesn't fit perl anyway. 10:49
> my $handle will leave .DESTROY = A.new; 10:51
lizmat you still need a block there for now
my $handle will leave { .DESTROY } = A.new
but yeah
Voldenet except "will leave { .DESTROY }" could be something simpler 10:52
my $handle transient = A.new;
a lot more concise 10:53
jnthn would quite like something akin to C#'s "using" in Perl 6, though .close is probably the right method to use given we've used it on file handles, taps, etc.
otoh, supplies are often consumed with whenever blocks which already do the .close calls for you :) 10:54
lizmat m: sub using(**@a) { sub (&b) { LEAVE .DESTROY for @a; b() } }; class A { method DESTROY() { say "died" } }; using(my $a = A.new, my $b = A.new)( { say $a.WHICH; say $b.WHICH } ) # more Perl6ish using() with multiple values 10:56
camelia A|65335024
A|65335088
died
died
jnthn I don't think re-purposing DESTROY is wise
Because the GC will still call it
Voldenet Hmm, are you sure?
jnthn Yes, because I wrote the GC. :P 10:57
In C# finalizers and disposers are separate methods
Voldenet :D 10:58
Okay.
jnthn There's often some arrangement made to have the finalizer call the dispose method, and a boolean to trackthat
*track that
Voldenet yeah, and finalizer doesn't have to track anything
jnthn It would be rather nice if we could save ourselves that boilerplate.
Voldenet the convention is that it should though
jnthn Yeah, that's the "problem", people either forget to implement that, or they do but then it's the same stuff copy-pasted everywhere 10:59
Since we have roles in Perl 6, we can perhaps factor it out in some way
10:59 _28_ria joined
Voldenet Well, C# has tons of problems related to 'using' blocks 11:00
11:00 darutoko joined
jnthn Using blocks themselves, or people's (mis)use of them? :) 11:01
Voldenet nah, more like the convention of "Disposable being callable more than once"
jnthn Ah
Yeah, that's exactly the kind of boilerplate it'd be nice to factor out
Voldenet and inability to use non-disposable objects in using() even if the subtype is implementing the interface
jnthn Hm, why'd it implement the interface but not declare it? 11:02
Voldenet I meant something like this: using(Parent p = new Sub())
basically, you can't decorate a parent with IDisposable after its compiled
jnthn Oh, right
Voldenet which creates monstrosities like autogenerated wrappers 11:03
are we java yet? :)
jnthn I think Perl 6 is late-bound enough to not have that particular problem :)
Voldenet Yeah, it's one of the good parts
11:04 pmurias left
Voldenet also, should be reversed 11:04
erm, usage of it should be reversed
regular way: { my $x = open("File"); use $x somehow } 11:05
the way that doesn't close file: { my $x = do-not-close-until-i-say-so open("File") } 11:06
11:06 Sound joined
Voldenet both way lead to errors, but the absence of latter is easier to test and more obvious 11:07
11:07 Sound is now known as Guest13818
Voldenet "the file was closed already" vs "massproducing descriptors in the background" 11:07