--- Log opened Sun Mar 11 00:00:45 2012 |
00:34 | | Kindamoody is now known as Kindamoody[zZz] |
00:35 | | Aeron is now known as EvilDarkLord |
00:37 | | Anna is now known as Ling |
00:52 | < Tarinaky> | Am I being -phenominally- stupid but... |
00:52 | < Tarinaky> | http://www.pyside.org/docs/pyside/PySide/QtUiTools/QUiLoader.html#PySide.QtUiToo ls.PySide.QtUiTools.QUiLoader.addPluginPath implies that it wants a String passed to it as its parameter. |
00:53 | < Tarinaky> | So why is it complaining that it's getting String :/ |
00:54 | < Tarinaky> | Ahah! |
00:54 | | * Tarinaky facepalms. |
00:54 | < Tarinaky> | It's a class, not a singleton Tarinaky. Don't be stupid >.< |
00:58 | < Tarinaky> | :/ I can't seem to get it to find my widget in the plugin path. |
00:58 | < Tarinaky> | I'm not sure what I'm doing wrong because I'm doing so much wrong >.< |
01:13 | < Tarinaky> | Sweet! It works! |
01:29 | < Tarinaky> | Right, now I need to figure out how the hell you draw to a widget :/ |
01:37 | < maoranma> | I wonder if I can pass a function to another function and based on some conditions, choose not to execute that method... |
01:38 | <&Derakon> | Trivially. |
01:38 | < maoranma> | I figured, but I'm tired |
01:39 | < maoranma> | basically, since I'm building an oyoyo bot, I have to write in pretty much everything except simple commands and connecting |
01:41 | < maoranma> | look |
01:42 | < maoranma> | No, not look, because I'm not in a mud |
01:42 | < maoranma> | fuck I'm tired |
01:42 | <&Derakon> | Take a nap, zen fire ze missiles? |
01:42 | < maoranma> | Can't, but coding to stay awake probably isn't ideal |
01:42 | < RichyB> | 'Bout that time, eh chaps? |
01:42 | <&Derakon> | Righto. |
01:44 | | Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has joined #code |
01:46 | | Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has quit [Client closed the connection] |
01:46 | | maoranma is now known as noahderp |
01:47 | | RichyB [MyCatVerbs@Nightstar-86656b6c.cable.virginmedia.com] has quit [[NS] Quit: zzz] |
01:47 | | Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has joined #code |
01:47 | | noahderp is now known as maoranma |
01:50 | | Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has quit [Client closed the connection] |
01:52 | | maoranma is now known as noahdamnit |
01:53 | | noahdamnit is now known as maoranma |
02:11 | | Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has joined #code |
02:11 | | maoranma is now known as mao42ranma |
02:11 | < mao42ranma> | .join #test |
02:11 | < mao42ranma> | uhg. |
02:11 | | mao42ranma is now known as maoranma |
02:14 | < maoranma> | ifAdmin(nick,chan,helpers.join(nightstar,msg.split()[1])) |
02:15 | < maoranma> | How do I prevent that third argument from being called? |
02:16 | <~Vornicus> | What are you /actually/ trying to do |
02:16 | < celticminstrel> | Huh? |
02:16 | < maoranma> | Because being passed like that it seems to be calling it |
02:16 | < celticminstrel> | Prevent what from huh... |
02:16 | < celticminstrel> | What are you talking about... |
02:16 | < maoranma> | def ifAdmin(nick,chan,command): |
02:16 | < maoranma> | if nick.split('!')[0] in admins: |
02:16 | < maoranma> | command() |
02:16 | < maoranma> | that's the wrapper |
02:18 | < maoranma> | I want to wrap the function, so that if it's called and nick doesn't show up in admins, it does nothing |
02:18 | < maoranma> | that way I don't have to use several if statements stating the same thing for new admin functions, I can just pass them through ifAdmin() to check if the person calling it can |
02:21 | < celticminstrel> | But you're passing a string as the command...? |
02:21 | < maoranma> | No, another function |
02:48 | <&Derakon> | You want a function decorator. |
02:49 | <&Derakon> | http://pastebin.com/HcjHgc1k |
02:50 | <&Derakon> | Uh, I think that'd work. You'd call it as join(nick, server, chan) and the decorator would strip the nick arg off to check for permissions. |
03:09 | < maoranma> | Ahh, yea, I think that'd work, lemme see |
03:09 | < maoranma> | Does that have to come before a definition though? |
03:10 | <&Derakon> | The decorator function has to be defined by the time the parser gets to the function being decorated. |
03:10 | <&Derakon> | You could stick it into a different module if you wanted. |
03:12 | < maoranma> | Right, but does decoration only happen at the definition of a function, or can I decorate it prior to execution? |
03:13 | <&Derakon> | Decoration using the @ syntax has to happen when you define the function. |
03:14 | < maoranma> | Ah, hmm |
03:16 | < maoranma> | So I'd have to write that decorator, then write a new function that uses the old function, and decorate that, before calling it |
03:16 | | ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has quit [Connection reset by peer] |
03:16 | <&Derakon> | Er... |
03:16 | <&Derakon> | What exactly are you trying to do here? |
03:16 | < maoranma> | The function helper.join() is oyoyo's join function. |
03:17 | | ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code |
03:17 | | mode/#code [+o ToxicFrog] by ChanServ |
03:17 | < maoranma> | I wanted to write a wrapper that allowed me to check a user to see if they're admin, but without having to write the if statement over and over for the other oyoyo functions |
03:18 | <&Derakon> | Okay, then what you want is something more like "callIfAdmin(function, argsForFunction)" |
03:19 | <&Derakon> | def callIfAdmin(func, *args): if admin: func(*args) |
03:19 | < maoranma> | I believe so...but I can't seem to wrap my head around it |
03:19 | < maoranma> | That's it? |
03:19 | <&Derakon> | That's it. |
03:20 | <&Derakon> | Well, the invocation would look more like "callIfAdmin(func, arg1, arg2, arg3...)" |
03:20 | <&Derakon> | And you'd want to have **kwargs in there as well to handle keyword arguments. |
03:20 | < maoranma> | I don't have any, but it's possible that I'd might as some point |
03:21 | <&Derakon> | I'd consider it good style, whenever dealing with arguments in an anonymous manner like this, to support keyworded arguments. |
03:23 | | Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has quit [Client closed the connection] |
03:24 | | Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has joined #code |
03:24 | | maoranma is now known as freshderp |
03:24 | < freshderp> | .join #test |
03:25 | | freshderp is now known as maoranma |
03:25 | < maoranma> | .join #test |
03:25 | < maoranma> | Perfect |
03:25 | < maoranma> | I had to pass nick to it |
03:25 | < maoranma> | And I passed chan as well, incase I want to do a keyed admin channel, but that works now |
03:25 | < maoranma> | Thanks Derakon |
03:27 | | Kindamoody[zZz] is now known as Kindamoody |
03:27 | < maoranma> | In theory, I should be able to have it check the channel the command is coming from, and if that channel is in an admin channel list, anyone on that particular channel should be able to execute the command, without me having to add them to the admin list |
03:30 | < maoranma> | I'll have to add some reload functions for configs, so I can change things about the bot while it's still running without having to kill it |
03:43 | | Attilla [Obsolete@Nightstar-02bcbdd2.as43234.net] has quit [Ping timeout: 121 seconds] |
04:28 | < Tarinaky> | :/ Okay, I really don't understand what I'm doing wrong here. |
04:30 | < maoranma> | ? |
04:32 | < Tarinaky> | Qt/PySide. |
04:32 | < Tarinaky> | Can't figure out how to get my custom widget to actually draw. |
04:33 | < Tarinaky> | Unless I make it a window on its own, then it works fine bizarrly. |
04:33 | < Tarinaky> | *bizzarely |
04:33 | < Tarinaky> | *Whatever |
04:37 | < Tarinaky> | http://pastebin.com/0C4XW362 << Is this correct Python or am I being phenominally stupid? |
04:41 | <@Ling> | It is not to my knowledge |
04:41 | <@Ling> | That last line probably belongs in the constructor |
04:41 | < Tarinaky> | Which constructor? |
04:41 | < Tarinaky> | That block is in a constructor. |
04:42 | < Tarinaky> | I dunno why it didn't copy+paste the whole file |
04:42 | < Tarinaky> | I obviously wasn't paying attention |
04:42 | < Tarinaky> | http://pastebin.com/gNwMdRT2 try that >.< |
04:43 | <@Ling> | Why are you defininf a function in the constructor? |
04:43 | <@Ling> | nm |
04:44 | < Tarinaky> | >.> |
04:45 | | * Ling doesn't use Python for anything anymore, can't see an issue there. Sorry |
04:45 | | eckse [eckse@Nightstar-86a236d5.dsl.sentex.ca] has joined #code |
04:45 | | mode/#code [+o eckse] by ChanServ |
04:45 | | * Tarinaky frowns. |
04:46 | < Tarinaky> | I'm going to go shower and thing about getting some coffee. |
04:46 | | eckse [eckse@Nightstar-86a236d5.dsl.sentex.ca] has quit [Connection reset by peer] |
04:46 | < Tarinaky> | It is by will alone I set my mind in motion etc... |
04:48 | | eckse [eckse@Nightstar-86a236d5.dsl.sentex.ca] has joined #code |
04:49 | | mode/#code [+o eckse] by ChanServ |
04:53 | | Kindamoody is now known as Kindamoody|breakfast |
04:58 | < celticminstrel> | I think that's correct Python. |
04:58 | < celticminstrel> | I don't know why you'd do it that way, though. |
05:02 | < Tarinaky> | Because Qt Designer only lets me put down the widgets it's got. |
05:03 | < Tarinaky> | If I create a custom class I can't, actually, do dick with it :/ |
05:03 | <&Derakon> | ...couldn't you make a custom class that inherits from the standard widgets and then use normal function overriding? |
05:04 | < Tarinaky> | Yes. But then I can't use it in Qt Designer. |
05:04 | < Tarinaky> | So I can't do anything -with- it :/ |
05:04 | < Tarinaky> | Unless I'm missing something. |
05:05 | <&Derakon> | ":\" is your favorite emote, isn't it? |
05:05 | < Tarinaky> | Yes. |
05:05 | <&Derakon> | Anyway, you shouldn't need Qt Designer to design UIs. |
05:05 | < Tarinaky> | Well, I do... |
05:05 | <&Derakon> | Not that I've used Qt at all but you should be able to make your UIs in code. |
05:05 | < Tarinaky> | Emphasis on the 'I'. |
05:05 | < Tarinaky> | Since I know nothing. |
05:05 | < Tarinaky> | >.< |
05:06 | <&Derakon> | Well then, start learning. |
05:06 | <&Derakon> | You're the only one who can prevent yourself from succeeding. |
05:06 | < Tarinaky> | I'm very good at it. |
05:06 | < Tarinaky> | But in seriousness... part of the point of this exercise was learning how to use Qt Designer. |
05:07 | < Tarinaky> | Making the UI by hand is... ell... Not doing that is the entire reason I decided to use Qt instead of just handrolling something in PyGame. |
05:07 | <&Derakon> | There's a big difference between PyGame and designing a UI in code using a UI library. |
05:08 | < Tarinaky> | If I needed a UI Library then yes. |
05:08 | < Tarinaky> | Except I don't, really, need a UI library. |
05:08 | < Tarinaky> | I just wanted to cut corners. |
05:09 | < Tarinaky> | Like being able to connect signals and slots with drag+drop :/ |
05:09 | < Tarinaky> | That kind of thing. |
05:15 | | Kindamoody|breakfast is now known as Kindamoody |
05:35 | | Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has quit [[NS] Quit: Leaving] |
05:48 | < Tarinaky> | Okay, sortof working. Just need to figure out how to reattach the signals manually :/ |
05:55 | < Tarinaky> | That was less painful than expected. |
05:58 | | Stalker [Z@2C3C9C.B2A300.F245DE.859909] has quit [Ping timeout: 121 seconds] |
06:04 | | Kindamoody is now known as Kindamoody|gaming |
06:13 | | celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
06:25 | <&McMartin> | connect() is pretty boss |
06:41 | < Tarinaky> | The problem I have atm is that my scorlling is pretty lame. |
06:41 | < Tarinaky> | Can't think of an easy fix though. |
06:41 | < Tarinaky> | *scrolling |
06:41 | < Tarinaky> | Sorry for typos, I can't see what I've typed till after I hit enter due to bad internets between my and irssi. |
06:45 | < Tarinaky> | http://imgur.com/L8Vj9 Almost looks like a game already, lol. |
06:47 | | Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code |
07:00 | | eckse [eckse@Nightstar-86a236d5.dsl.sentex.ca] has quit [Connection closed] |
07:00 | | eckse [eckse@Nightstar-86a236d5.dsl.sentex.ca] has joined #code |
07:00 | | mode/#code [+o eckse] by ChanServ |
07:00 | | Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Client closed the connection] |
07:46 | <@ToxicFrog> | Tarinaky: I note that you can create most of a GUI using QtD and then add more stuff to it at runtime. |
07:47 | <@ToxicFrog> | So you can, for example, leave a blank spot for your custom widget and put everything else together, then slap the custom widget in when you load it. |
07:48 | <@ToxicFrog> | As for scrolling, that pretty much Just Works with a QGraphicsView, not sure about custom widgets. |
07:57 | <&McMartin> | There should be some relevant signal sent, or else repaint is smart enough to know how to place the region |
08:00 | <@ToxicFrog> | Yeah, in the case of the QGraphicsView you basically just set the scrollbar visibility flags and everything else happens automatically based on the current zoom level, the actual bounding box of the backing QGraphicsScene, etc |
08:21 | < Tarinaky> | It scrolls. |
08:21 | < Tarinaky> | It just doesn't do so very smoothly. |
08:21 | < Tarinaky> | Because the scrollbars can only have integer values. |
08:23 | | Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has joined #code |
08:25 | | froztbyte [froztbyte@Nightstar-dc394964.za.net] has quit [Ping timeout: 121 seconds] |
08:25 | | froztbyte [froztbyte@Nightstar-dc394964.za.net] has joined #code |
08:40 | | Kindamoody|gaming is now known as Kindamoody |
08:42 | | eckse_ [eckse@Nightstar-86a236d5.dsl.sentex.ca] has joined #code |
08:45 | | eckse [eckse@Nightstar-86a236d5.dsl.sentex.ca] has quit [Ping timeout: 121 seconds] |
08:53 | | eckse_ [eckse@Nightstar-86a236d5.dsl.sentex.ca] has quit [Client closed the connection] |
09:59 | < Tarinaky> | http://imgur.com/t7GcN << :D |
11:24 | | Kindamoody is now known as Kindamoody|out |
13:36 | | Attilla [Obsolete@Nightstar-6af7959c.as43234.net] has joined #code |
14:44 | | ShellNinja is now known as AnnoDomini |
14:44 | | AnnoDomini is now known as ShellNinja |
15:09 | | Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code |
15:09 | | mode/#code [+o Syloqs_AFH] by ChanServ |
15:10 | | Syloqs_AFH is now known as Syloqs-AFH |
15:17 | | celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code |
16:21 | < maoranma> | Going through the help() for oyoyo, really glad that feature is in python |
16:22 | < maoranma> | Apparently there is a DefaultBotCommandHandler for building commands |
16:23 | < maoranma> | And there's a protected command attribute |
16:24 | | RichyB [MyCatVerbs@Nightstar-86656b6c.cable.virginmedia.com] has joined #code |
16:34 | | cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Client closed the connection] |
17:56 | < Tarinaky> | I'm having trouble with Layouts and inserting/removing widgets from them during run-time. |
17:56 | < Tarinaky> | Basically, when I click certain elements I want a panel to appear. |
17:57 | < Tarinaky> | Currently, when the panel is added to the Layout the display is split 50% to each - rather than allocating only the widget's maximum size. |
17:57 | < Tarinaky> | And when I remove the widget, the grid doesn't reset. |
17:57 | <@ToxicFrog> | Don't add/remove it; just add it once at startup, set its properties, and then show/hide it |
17:57 | < Tarinaky> | How do I get the behavior I actually want? |
17:57 | <@ToxicFrog> | That I'm afraid I don't remember, but it's definitely doable |
18:03 | | Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has quit [Client exited] |
18:09 | < Tarinaky> | >.< |
18:09 | < Tarinaky> | I can't seem to figure it out :/ |
18:09 | < Tarinaky> | Even close() doesn't seem to do as advertised. |
18:18 | | cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code |
19:16 | < Tarinaky> | ToxicFrog: I can create a hidden widget fine. When I show() it it behaves nicely, but if I hide it again it will refuse to show(). |
19:17 | < Tarinaky> | Also, I need to pass out. |
19:17 | < Tarinaky> | Later. |
19:28 | | Vash [Vash@Nightstar-cdeba41f.wlfrct.sbcglobal.net] has joined #code |
19:28 | | mode/#code [+o Vash] by ChanServ |
19:47 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds] |
20:00 | | himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code |
20:00 | | mode/#code [+o himi] by ChanServ |
20:04 | | Kindamoody|out is now known as Kindamoody |
20:09 | | Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds] |
20:14 | | Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code |
20:14 | | mode/#code [+o Syloqs_AFH] by ChanServ |
20:15 | | Syloqs_AFH is now known as Syloqs-AFH |
20:54 | | Kindamoody is now known as Kindamoody[zZz] |
21:02 | | Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds] |
21:17 | | eckse [eckse@Nightstar-147f193a.dsl.sentex.ca] has joined #code |
21:17 | | mode/#code [+o eckse] by ChanServ |
21:28 | <@ToxicFrog> | Oh god |
21:28 | <~Vornicus> | oh god? |
21:28 | <@ToxicFrog> | Memo to self: when the compiler asks for explicit type annotations on something, don't just shrug and put them in. |
21:28 | <~Vornicus> | Find Out Why? |
21:29 | <@ToxicFrog> | This is a sign that you are doing something the type inferrer couldn't follow, and should really find out why, because odds are it means you're doing something that compiles but doesn't do what you want. |
21:29 | < Eri> | Warnings are just warning, man. Live life dangerously |
21:29 | <@ToxicFrog> | (in this case, calling children contains p rather than children exists p; both will typecheck, but the former requires type annotation on p's arguments and the latter is what I actually want) |
21:30 | <~Vornicus> | I don't know what either of those are supposed to do, nor what language you're even working in. |
21:31 | <@ToxicFrog> | Scala. x contains p is true if the collection x contains the value p. x exists p returns true if there exists any element e in x such that p(e) is true. |
21:34 | <@ToxicFrog> | Note that they will both pass type checking, but only one will actually call p~ |
21:38 | <@ToxicFrog> | (ask me how I know this!) |
21:39 | < Eri> | ToxicFrog, how do you know these things? |
21:39 | <~Vornicus> | (I don't have to.) |
21:39 | <@ToxicFrog> | Because I just spent twenty minutes tracking down a bug caused by calling contains rather than exists! |
21:39 | < Eri> | Should've read the documentation better |
21:39 | <~Vornicus> | but, uh, wait |
21:39 | <~Vornicus> | Why does contains ask for type annotation on p's arguments? |
21:40 | <@ToxicFrog> | I actually suspect this is a bug in collections.Buffer; Buffer[A].contains should have signature (A): Boolean, not (Any): Boolean. |
21:41 | <@ToxicFrog> | Vornicus: in the case of (x exists p), where x has type Collection[A], it can infer the type of p as (A => Boolean), so you don't have to explicitly annotate p's argument - it infers the type as A |
21:41 | <@ToxicFrog> | In the case of (x contains p), p could be literally anything, and it won't infer function argument types based on how they're used in the function, so you have to specify. |
21:41 | <~Vornicus> | RIght, I figured that |
21:41 | <~Vornicus> | But |
21:42 | <~Vornicus> | And it can't just go... uh... |
21:42 | <@ToxicFrog> | It probably could; I mean, in the case of (x contains (e => true)), you can plausibly infer the type of e to be Any |
21:43 | <@ToxicFrog> | But this rapidly gets messy |
21:43 | <~Vornicus> | I don't know, something seems off here but this might be inexperience with the language talking here |
21:43 | <@ToxicFrog> | I think something is off here, actually |
21:43 | <~Vornicus> | I don't see why you need to know the type of p |
21:43 | <~Vornicus> | To determine whether it's in x |
21:43 | <@ToxicFrog> | But what's off here is that contains should be restricted to the type that x contains |
21:44 | <@ToxicFrog> | Eg, x contains "foo" should not pass typechecking ever unless x is a collection of String. |
21:44 | <~Vornicus> | RIght, just so |
21:44 | <@ToxicFrog> | And on most collection types it is restricted in that way, but for some reason this particular one is not. |
21:46 | <@ToxicFrog> | scala> Set[String]().contains(1) |
21:46 | <@ToxicFrog> | <console>:8: error: type mismatch; |
21:46 | <@ToxicFrog> | found : Int(1) |
21:46 | <@ToxicFrog> | required: String |
21:47 | <@ToxicFrog> | scala> Buffer[String]().contains(1) |
21:47 | <@ToxicFrog> | res3: Boolean = false |
21:47 | <~Vornicus> | Yeah, that feels wrong |
21:49 | <@ToxicFrog> | Oh, it's a type covariance/mutability interaction |
21:49 | <@ToxicFrog> | (Seq is immutable, Buffer is not) |
21:49 | <~Vornicus> | But |
21:50 | <~Vornicus> | Wait, is this the same mutability setup as python's tuples vs lists? |
21:51 | <@ToxicFrog> | How do you mean? |
21:52 | <~Vornicus> | Like, when you say Buffer is mutable, do you actually mean that you can futz its typechecking or something? |
21:53 | <@ToxicFrog> | I mean that it can be mutated in-place in the same way as a C array or (if I remember my Python right) a Python list. |
21:54 | <~Vornicus> | okay, but then scala is statically typed. Why does that make buffer[string] accept contains(integer)? |
21:58 | <@ToxicFrog> | The most immediate reason that passes typechecking is that the signature of Buffer.contains is contains(element: Any): Boolean - ie, it takes an argument of any type, disregarding the type the object is specialized to. |
21:58 | <@ToxicFrog> | I am currently asking in #scala why this is the case~ |
21:59 | <@ToxicFrog> | Aah. Ok. |
22:03 | | eckse_ [eckse@Nightstar-e75743c0.dsl.sentex.ca] has joined #code |
22:06 | <~Vornicus> | ? |
22:06 | | eckse [eckse@Nightstar-147f193a.dsl.sentex.ca] has quit [Ping timeout: 121 seconds] |
22:09 | <@ToxicFrog> | Sorry, hang on |
22:13 | | Stalker [Z@2C3C9C.B2A300.F245DE.859909] has joined #code |
22:14 | <@ToxicFrog> | Ooookay. |
22:14 | <@ToxicFrog> | Alright, covariant/contravariant typing and immutability, while interesting, have little to do with this. |
22:14 | <@ToxicFrog> | Ditto (im)mutability. |
22:15 | <@ToxicFrog> | Or maybe it is, aagh |
22:15 | <~Vornicus> | covariant/contravariant typing? |
22:16 | <@ToxicFrog> | Ok, we have two conflicting opinions here, neither of which seems likely to emerge as the true answer unless we can get the writing of scala.collections in da house |
22:23 | <@ToxicFrog> | Vornicus: if you want a function that takes an Int, a function that takes a Number is just as good; (Number => Boolean) is a subtype of (Int => Boolean). Functions are contravariant in their arguments; a function f' whose arguments are all improper supertypes of the arguments of f is a subtype of f. |
22:24 | <@ToxicFrog> | Conversely, if you need a list of Numbers, a list of Ints fits the bill; List[Int] is a subtype of List[Number] (as Int is a subtype of Number); thus, List is covariant in its stored type. |
22:24 | <&McMartin> | This is something that it actually took type theorists a disgustingly long time to actually get right. |
22:24 | <@ToxicFrog> | (for an example of this gone horribly wrong, see Java arrays, which are covariant in their stored type but also mutable in place) |
22:25 | <@ToxicFrog> | (which means that this will pass typechecking: Integer foo[] = new Integer[1]; Number bar[] = foo; bar[0] = 0.0;) |
22:25 | <~Vornicus> | But clearly a list of strings doesn't have a direct co- or contravariance with ints, beyond Object |
22:25 | <&McMartin> | (Java Collections, however, fixed this in 1.5. But where introduced in 1.3. -_-) |
22:25 | <@ToxicFrog> | Vornicus: yeah, hence why I said this isn't a co/contravariance issue |
22:26 | <@ToxicFrog> | One faction is theorizing that it's because they modeled the API after Java collections, which has AbstractCollection<E>.contains(Object o) for some godforsaken reason |
22:28 | <&McMartin> | Same godforsaken reason equals() does, I think~ |
22:29 | <&McMartin> | (That is, if you're getting objects from a type-erased source, it saves you a checked downcast =P) |
22:29 | <&McMartin> | (I didn't say it was *good* reason) |
22:29 | <@ToxicFrog> | (fuck type erasure in hell forever, seriously) |
22:29 | <~Vornicus> | type erasure? Casting to object? |
22:29 | <&McMartin> | (equals() gets a pass because "the source is an Object parameter" is one of the few forms that is OK) |
22:30 | <&McMartin> | Vornicus: Casting T<O> to T<Object> under the hood as part of compilation. |
22:30 | <~Vornicus> | ah yes |
22:30 | <&McMartin> | casting to Object for generic functions is fine as long as it's What You're Doing. |
22:30 | <~Vornicus> | Okay, so what's the other faction saying? |
22:31 | < celticminstrel> | [Mar 11@6:25:22pm] ToxicFrog: (which means that this will pass typechecking: Integer foo[] = new Integer[1]; Number bar[] = foo; bar[0] = 0.0;) |
22:31 | < celticminstrel> | I don't see what's wrong with this... |
22:31 | <@ToxicFrog> | Collection types are covariant in their contained type but methods are contravariant in their parameters and you can't have the same type parameter be both at once. |
22:32 | <@ToxicFrog> | celticminstrel: it attempts to store a float into an array of ints. |
22:32 | <@ToxicFrog> | That's an ArrayStoreException (I think) at runtime. |
22:32 | < celticminstrel> | Ohhh, I see it now. |
22:33 | <@ToxicFrog> | But it passes typechecking because in Java, Array[Number] is a supertype of Array[Int]. |
22:34 | < Namegduf> | :( |
22:34 | < Namegduf> | What would be ideal would be that being true, but ONLY for immutable collection types. |
22:35 | < Namegduf> | So you could still construct an Array<Int> and pass it as a collection of <Number>, but only for purposes which didn't need to modify it. |
22:36 | < Namegduf> | But the semantics of actually providing language support for that... |
22:36 | | eckse_ [eckse@Nightstar-e75743c0.dsl.sentex.ca] has quit [Connection reset by peer] |
22:36 | | eckse [eckse@Nightstar-bc49ffc9.dsl.sentex.ca] has joined #code |
22:36 | | mode/#code [+o eckse] by ChanServ |
22:37 | <~Vornicus> | This does look like a particularly, um. I was hoping for an appropriately gostakian term but I can't think of anything. |
22:41 | <@ToxicFrog> | Namegduf: actually, all Scala immutable types are covariant in their contained type |
22:41 | <@ToxicFrog> | Er, immutable collection types |
22:42 | < Namegduf> | Neat. |
22:43 | <@ToxicFrog> | And it has support for type co- and contravariance in general. |
22:44 | <&McMartin> | Vornicus: "scurm"~ |
22:44 | | eckse [eckse@Nightstar-bc49ffc9.dsl.sentex.ca] has quit [Client closed the connection] |
22:45 | | eckse [eckse@Nightstar-3c6c2eb0.dsl.sentex.ca] has joined #code |
22:45 | | mode/#code [+o eckse] by ChanServ |
22:45 | <~Vornicus> | That does seem heamy for this case, yes |
22:48 | <&McMartin> | A wainted felliger, that's what that is. |
22:48 | <&McMartin> | About as heamy as a darf of jenth |
22:49 | <~Vornicus> | (this is your fault, by the way, for calling something "zorking jenth" earlier, mcm) |
22:51 | <@ToxicFrog> | Ok. Type theory digression over, back to implementation. |
22:51 | <&McMartin> | Sadly, that LP seems to have not made it into the archives. |
22:52 | <&McMartin> | Speaking of languages better than Java targeting the JVM and the Java libraries, I hear Groovy is pretty, well, groovy |
22:53 | <@ToxicFrog> | I don't remember what that one's deal is |
22:59 | <@ToxicFrog> | Aah, it's a kind of ruby/pythonesque thing with Java-like syntax? |
23:04 | | * TheWatcher has a vague need to write an android app, but a greater need to avoid java, sighs vaguely |
23:04 | <@TheWatcher> | (yes, I'm being very vague) |
23:05 | <@ToxicFrog> | scalaaaaaaaaaaaaa |
23:05 | <@ToxicFrog> | * suggestion not valid if targeting older platforms that can't handle 10MB applications |
23:06 | <@TheWatcher> | Wait. I can use perl O.o |
23:11 | | * Vornicus wonders how many older platforms scala can target in the first place |
23:12 | <@ToxicFrog> | Vornicus: in principle, anything with a Java 1.5 VM or newer is targetable by Scala. |
23:12 | <~Vornicus> | ...which means shitty old phones, right |
23:13 | <@ToxicFrog> | In practice, the runtimes are up to 10MB (so you need enough storage for those, in addition to the JRE and application) and the memory requirements are somewhat larger as well. |
23:13 | <@ToxicFrog> | So there probably is some stuff that's running 1.5 but will choke if you try to load a Scala app on it. |
23:13 | <&McMartin> | Yeah, I kind of gave up on getting Scala running even on fairly advanced Androids such as my own |
23:14 | <&McMartin> | Especially since I have literally written books on Java and the JVM -_- |
23:14 | <@ToxicFrog> | What went wrong with it? |
23:14 | <@ToxicFrog> | In principle, it seems like you should be able to just ship scala-library.jar with your app (or, if Android doesn't let you do that, merge its contents with your application) and have it Just Work, but I am speaking from a position of almost total ignorance WRT Android development. |
23:15 | <&McMartin> | I couldn't get Eclipse to simultaneously be an Android dev environment and a scala dev environment before I ran out of patience and just did things the Java way |
23:15 | <@ToxicFrog> | Aah. |
23:16 | <@ToxicFrog> | ...do you need Eclipse specifically for Android dev, or is there a devkit that you can link against from any IDE that understands Java? |
23:16 | <&McMartin> | Yes to both, as is so often the case with these things |
23:17 | <&McMartin> | If you don't mind hand-generating all the XML metadata, resource files, etc. etc., then yeah, Eclipse is optional. |
23:17 | <&McMartin> | I mind that sort of thing lots. |
23:17 | | Kindamoody[zZz] [Kindamoody@Nightstar-5507a6b5.tbcn.telia.com] has quit [Ping timeout: 121 seconds] |
23:17 | <&McMartin> | But yeah, one could easily do that stuff by hand or with a set of ancillary scripts. |
23:18 | <&McMartin> | But when you can replace all of that with "push F7" I get a lot less willing to learn. |
23:18 | <&McMartin> | Especially since direct Java development is not, for me a particularly horrible fate |
23:18 | <&McMartin> | (Most Java *project teams*, on the other hand...) |
23:19 | | * ToxicFrog nods |
23:19 | <@ToxicFrog> | If there is an easy way to tell Eclipse "here is a jar, plz turn into Android application package", then you could use something that groks Scala to generate the jar and then Eclipse to package it |
23:19 | | Kindamoody[zZz] [Kindamoody@Nightstar-5507a6b5.tbcn.telia.com] has joined #code |
23:19 | | mode/#code [+o Kindamoody[zZz]] by ChanServ |
23:19 | <&McMartin> | (Android does not, itself, actually run the JVM; the core Android devkit takes JARs and metadata and compiles that into the Android VM code) |
23:19 | <&McMartin> | So yeah, I know it can be done |
23:20 | <&McMartin> | I just couldn't get it working until Avert Sunk Cost Fallacy hit. |
23:20 | | * ToxicFrog nods |
23:20 | <&McMartin> | This is of course also ignoring the minor issue of "Also, I need a problem of a sort that Scala is intrinsically far better at than Java" |
23:21 | <@ToxicFrog> | If I ever find myself targeting Android I'll probably be using IDEA, which I know supports Scala well and which purports to support Android |
23:21 | <@ToxicFrog> | And I know it handles mixed scala/lua and scala/java projects without complaint, so one would hope scala/android would work as well. |
23:21 | <&McMartin> | That soudns pretty promising, yeah |
23:21 | <@ToxicFrog> | If so, I'll report on how it goes. |
23:21 | <&McMartin> | That would be "we've done the ancillary scripts" as such |
23:21 | <@ToxicFrog> | Yeah |
23:22 | <&McMartin> | Alternately, they may have since expanded the Android SDK so that it works more like Inform 7 and inweb, where the SDK has execution modes that are "create an empty project with all the metadata set to reasonable defaults" etc. |
23:23 | <&McMartin> | At which point you no longer need an IDE at all unless you are Inform 7 and need the IDE to properly display the program analysis results that are part of compilation |
23:23 | | * ToxicFrog nods |
23:24 | <&McMartin> | And now, speaking of programming languages |
23:24 | | * McMartin goes to replace some Perl scripts in his work's build process with Python scripts. |
23:24 | <&McMartin> | It turns out that they've discovered as secret way to make me work a lot harder: give me a task that I really want to get done but make it minimum priority so that it might be overridden at any time. |
23:27 | < Namegduf> | XD |
23:27 | | * ToxicFrog beats KSP with a stick |
23:27 | <@ToxicFrog> | new File("parts").listFiles.map( |
23:27 | <@ToxicFrog> | x => """_""".r.replaceAllIn(Object.fromFile(new File(x, "part.cfg")).getProperty("name"), ".") |
23:27 | <@ToxicFrog> | ).toSet |
23:27 | <@ToxicFrog> | Part names in part definition files don't exactly correspond to part names in save files >.< |
23:32 | <@TheWatcher> | Replacing perl scripts a minimum priority? Crazy people.. |
23:33 | | eckse_ [eckse@Nightstar-8ad49db7.dsl.sentex.ca] has joined #code |
23:33 | <&McMartin> | TheWatcher: Well, they aren't customer-facing, and half the time they aren't even developer-facing |
23:34 | <&McMartin> | They're just rot in the build internals. |
23:36 | | eckse [eckse@Nightstar-3c6c2eb0.dsl.sentex.ca] has quit [Ping timeout: 121 seconds] |
23:39 | | eckse [eckse@Nightstar-62908728.dsl.sentex.ca] has joined #code |
23:39 | | mode/#code [+o eckse] by ChanServ |
23:42 | | eckse_ [eckse@Nightstar-8ad49db7.dsl.sentex.ca] has quit [Ping timeout: 121 seconds] |
--- Log closed Mon Mar 12 00:00:02 2012 |