Camelia, the Perl 6 bug

IRC log for #november-wiki, 2009-03-30

| Channels | #november-wiki index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
01:13 wayland76 joined #november-wiki
01:19 ihrd joined #november-wiki
05:18 ihrd joined #november-wiki
06:05 ihrd left #november-wiki
07:57 wayland76 joined #november-wiki
08:25 masak joined #november-wiki
10:37 wayland76 joined #november-wiki
10:52 ruoso joined #november-wiki
12:07 sri_kraih joined #november-wiki
12:29 masak I'm thinking Web.pm should have something like this:
12:29 masak http://www.ruby-doc.org/stdlib/libdoc/op​en-uri/rdoc/classes/Kernel.html#M001413
12:29 zarah masak's link is also http://tinyurl.com/8z3a5k
12:29 masak is open() a multi in Perl 6?
12:29 masak (guessing it is, since most things in the core are)
12:29 moritz_ masak: you can be sure that every builtin is a multi (or nearly every)
12:30 masak thought so.
12:30 masak no need to check, then.
12:30 moritz_ but I really wouldn't want to call it open(), for security reasons
12:30 wayland76 I checked.  It's multi
12:31 moritz_ it's a feature that you can't open() URL's in Perl
12:31 masak moritz_: if I have to import Web::URI or something, wouldn't it be OK?
12:31 moritz_ that has caused many troubles in PHP landscape
12:31 moritz_ masak: no, because if you do your assumptions will no longer hold
12:31 masak moritz_: I see what you're getting at.
12:32 masak you'd have to validate your inputs in a new way.
12:32 wayland76 Have you seen the IO.uri function?
12:32 masak I have, but I've had time to forget about them :)
12:33 masak hm, maybe URIs are part of IO nowadays...
12:34 masak OK, getting concrete: imagine the functionality is there already; how would I fetch a web page with Perl 6?
12:35 moritz_ either URI.new($uri).fetch or my $response = get($url) or something
12:36 masak get is too general, too.
12:37 masak maybe .open on URI?
12:37 masak and then it works just like a filehandle.
12:37 wayland76 uri("http://www.example.com/").lines()
12:37 masak wayland76: nice!
12:37 masak wayland76: but I can live with typing URI.new there.
12:38 wayland76 There's no URI object, I think
12:38 moritz_ not in core
12:38 masak ah.
12:38 wayland76 You'd do HTTP.uri(...)
12:39 masak worksforme.
12:39 wayland76 Where HTTP does IO::Streamable
12:39 masak ah.
12:39 wayland76 (and HTTP is not in core)
12:39 masak :)
12:39 wayland76 Actually, HTTP does IO::Socket::TCP, probably
12:40 moritz_ roles - let's summon ruoso :-)
12:40 ruoso hi
12:40 zarah saluton ruoso
12:40 wayland76 Or, IO::Socket::TCP.new(RemoteHost => 'www.example.com', RemotePort => 80).lines();
12:41 masak I'd need all this pretty soon -- where should I start hacking? :)
12:41 masak wayland76: yuck.
12:41 masak wayland76: I don't mind it being simple.
12:41 wayland76 Well, much though you may not like it, I suspect that IO::Socket::TCP is the place to start hacking
12:41 ruoso masak, IO::Socket::INET is not that bad idea
12:42 masak ruoso: sure, I just thought the syntax in the last one was superfluous.
12:42 wayland76 (ok, listen to ruoso :) )
12:42 ruoso wayland76, IO::Socket::INET, actually... there's no reason to have a different role for TCP vs UDP
12:42 masak fetching a web page should be super-easy.
12:42 masak you can be as correct as you like under the hood.
12:42 ruoso masak, let the making it easy to be done by LWP ;)
12:42 wayland76 Well, HTTP is just an IO::Socket::TCP with a few default parameters
12:43 ruoso not really
12:43 wayland76 HTTP should be about two lines when IO::Socket::TCP is done :)
12:43 masak I just want something like URI.new("http://example.com").lines()
12:43 ruoso HTTP is a protocol
12:43 wayland76 Oh, yeah, good point :)
12:43 * wayland76 slaps forehead :)
12:43 ruoso you can talk HTTP on top of whatever you like
12:43 wayland76 (own forehead, of course)
12:44 moritz_ and whatever we do, let's not call it LWP
12:44 moritz_ that name seems like an historical accident
12:44 wayland76 Agreed :)
12:44 wayland76 ruoso: Well, TCP appears in the draft spec :)
12:44 wayland76 Would INET be streamable?
12:45 * ruoso need to recall what streamable does
12:46 wayland76 auto-open, uri, and blocking, apparently
12:46 wayland76 But maybe the roles need reorganisation :)
12:46 masak if you do reorganize, please remember my use case. :)
12:47 wayland76 masak: That uri("http://www.example.com/").lines() is already specced, and I'm keen to have it stay
12:47 ruoso is it still in S16, or did it went to the setting?
12:47 wayland76 No, S32/IO
12:47 masak wayland76: oh! good.
12:47 masak how much work would it be to make it work?
12:47 masak we have sockets now.
12:47 wayland76 But ruoso the one to convince :)
12:48 masak nah, just start using it. easier to get forgiveness than permission. :P
12:48 wayland76 I'd say not too much work.
12:48 masak what'd be the first step?
12:48 masak rakudo: say +uri("http://www.example.com/").lines()
12:48 p6eval rakudo 370dd7: OUTPUT«Could not find non-existent sub uri␤current instr.: '_block14' pc 60 (EVAL_16:40)␤»
12:49 masak &uri, it seems.
12:49 ruoso hmmm... it seems that uri is a method, not a function
12:49 wayland76 masak: read S32/IO.pod
12:49 * masak reads
12:49 wayland76 uri is both a method and a function
12:49 wayland76 In particular, I still think you'll need to do IO::Socket::TCP, and the roles it composes
12:49 ruoso right right
12:50 ruoso the difference between tcp and udp are not visible to the user...
12:50 wayland76 One thing we don't have is a way for things to add new protocols to the uri table :)
12:50 ruoso in terms of API, I mean
12:51 wayland76 No?  Well, then, if we just change "TCP" to "INET" in the spec, will that still work?
12:51 masak method uri(Str $uri --> IO::Streamable);
12:51 masak that looks wrong to me.
12:51 masak no invocant colon.
12:52 moritz_ I'd expect uri() to return an URI object, not open  stuff
12:52 moritz_ remember that uri's can't be open in the general case, only URLs
12:53 masak aye.
12:53 wayland76 It only claims that file: http: and ftp: are possibilities at the moment.
12:54 ruoso I suggest to avoid trying to find the prettiest syntax now
12:55 wayland76 I think I'd be interested in seeing tcp://example.com:111/ working
12:55 ruoso tcp is not a application protocol
12:55 wayland76 I know, but my thought is that that would return an open IO::Socket to that port
12:56 ruoso I really think we should get the verbose code right
12:56 ruoso then we think how to make it short
12:56 ruoso i.e.: my $conn = IO::Socket::INET.new() is probably the best idea at this point
12:57 wayland76 So how do we specify that we want TCP vs. UDP?
12:58 wayland76 Do we pass a "protocol" parameter, with a default of TCP?
13:01 masak ruoso: I agree about not being too hung up about nice syntax -- OTOH, we should not underestimate the convenience of same. many people will judge Perl 6 over exactly such details.
13:03 wayland76 Btw, I'm also thinking that uri() won't be able to interpret http urls unless "use HTTP" is done first
13:03 masak that's fine by me.
13:03 masak I guess method signatures will handle that seamlessly.
13:04 masak and also handle the case where a protocol is not recognized.
13:05 wayland76 I think we need another global variable :)
13:05 wayland76 A hash that maps protocols to the classes that handle them
13:06 ruoso nah...
13:06 masak I never liked the first hash of protocols.
13:06 ruoso no need for globals...
13:06 wayland76 ie. 'http' => 'IO::Socket::HTTP'
13:06 ruoso multi uri($uri where /^http:///
13:06 ruoso multi uri($uri where /^http:/)
13:06 wayland76 Oh, can we do that?
13:06 wayland76 I like it much better!
13:07 masak ruoso: that's what I was thinking as well.
13:08 ruoso but I insist... getting the syntax nice after having all the things sorted out is really easy... that is Perl 6 after all
13:08 ruoso so... let's focus on getting the things straight first...
13:08 masak fair enough.
13:08 wayland76 I think I'll focus on going to bed
13:08 masak I'd be happy with _some_ way to fetch a web page.
13:08 wayland76 it's after midnight now :)
13:08 masak making things happen is a good antidote to bikeshedding.
13:09 ruoso I'd suggest making IO::Socket::INET to work just like the p5 one
13:09 ruoso then make a HTTP module that uses it
13:09 wayland76 I wouldn't
13:10 wayland76 The p6 one should auto-open
13:10 ruoso auto-open is syntax sugar
13:10 ruoso (if i see what you mean by auto-open)
13:11 wayland76 IO::Socket::INET should be opened as soon as it is created, unless NoOpen is passed in
13:12 ruoso why?
13:12 masak yes, why?
13:13 wayland76 Well, the reason I wrote the spec that way is that I figure that normally, when people create a socket, they want to open it :)
13:13 masak same could be said of files.
13:13 wayland76 Exactly, which is why IO::File also auto-opens :)
13:13 masak it does?
13:14 wayland76 Well, in the spec, anyway
13:14 masak what if I just want to check if a file exists?
13:14 wayland76 Then you use a FSNode
13:15 masak eeeew.
13:15 masak do not want.
13:15 wayland76 No?  I thought keeping the inside and outside of a file separate was a good thing :)
13:15 wayland76 But maybe not.
13:15 masak hm. maybe.
13:16 ruoso making them separate yes
13:16 ruoso making them different classes/roles? I doubt
13:16 wayland76 Anyway, it looks like the IO spec might need some discussion.
13:16 masak these are just my instinctive reactions, by the way. no rationales involved.
13:17 wayland76 Well, I'd be quite happy to wake up tomorrow and find a message or more about the IO spec in my p6l inbox
13:18 wayland76 but my brain is shutting down now.  Enen my typing is slowing........
13:18 masak wayland76: sleep well.
13:18 wayland76 I'll try :)
13:18 ruoso good night wayland76
13:18 wayland76 'night all
13:18 ruoso but I'd say
13:18 ruoso roles doesn't represent state
13:18 ruoso and that seems to be a common mistake of roles usage
13:21 masak ruoso: do you mean to say that roles don't have attributes?
13:21 ruoso I mean that the fact of being composed with a role doesn't represent staet
13:21 ruoso i.e. IO::Readable
13:22 masak ah.
13:31 * ruoso brb &
14:30 frioux_ joined #november-wiki
14:39 frioux_ joined #november-wiki
14:47 szabgab joined #november-wiki
14:56 wayland76 joined #november-wiki
14:59 mj41 joined #november-wiki
15:27 PerlJam joined #november-wiki
15:53 ihrd joined #november-wiki
15:59 ihrd left #november-wiki
19:16 szabgab joined #november-wiki
19:23 Tene_ joined #november-wiki
21:00 sri_kraih joined #november-wiki
23:25 wayland76 Btw, masak, I didn't say that :e "/path/to/file" still works for checking whether it exists

| Channels | #november-wiki index | Today | | Search | Google Search | Plain-Text | summary