code logs -> 2010 -> Sat, 23 Oct 2010< code.20101022.log - code.20101024.log >
--- Log opened Sat Oct 23 00:00:03 2010
00:02
<@Derakon>
True/false: you could make a compiled language with duck typing without losing most of the benefits of precompilation.
00:03
< Vornicus>
False.
00:03
< Vornicus>
Well, if you mean "compiled" like C is, as opposed to like Python is.
00:03
<@Derakon>
I did.
00:04
<@ToxicFrog>
Actually, Scala has static duck typing.
00:04
<@ToxicFrog>
You can, for example, declare a function as taking "any object that has methods with these signatures".
00:04
< celticminstrel>
Doesn't Objective C do that? Though, I think it has a runtime or something which the program needs to link with...
00:04
< celticminstrel>
When I say "that", I mean duck typing.
00:05
< celticminstrel>
I'm pretty sure the language it's based on does, anyway. (Smalltalk, as I recall.) But Smalltalk isn't compiled, is it?
00:05
< Vornicus>
Duck typing has several problems that make full-strength compilation difficult, specifically that you need to check, every call, against the signature of the object.
00:05
<@ToxicFrog>
So I would actually say "true" as long as the duck typing is allowed to be resolved at compile time.
00:05
< Vornicus>
"is allowed to be" -- or even "can", which isn't necessarily possible.
00:05
< celticminstrel>
I'd agree with ToxicFrog. As long as you can't do things like adding methods to a class at runtime, I think it'd be fine.
00:06
< Vornicus>
(C++'s type resolving system is technically turing complete.)
00:06
<@Derakon>
That seems like it would involve a heck of a lot of code analysis to figure out what an object could possibly be.
00:06
< Vornicus>
Yes.
00:06
<@ToxicFrog>
Vornicus: under what circumstances can't it be? I'm talking type systems like Java or Scala here where you can't create new types at runtime, mind.
00:08
< celticminstrel>
Come to think of it, can't you do something like duck typing with C++ templates?
00:09
< Vornicus>
McM has greater knowledge in this, seeing as he can put "Dr." before his name on this subject, but there are situations where it is literally impossible to tell what types an object can be via static analysis.
00:11
<@ToxicFrog>
Vornicus: I suspect languages with static duck typiing disallow such situations.
00:18 shade_of_cpux is now known as cpux
00:19
< Vornicus>
Such situations are apparently possible in Java.
00:21
<@ToxicFrog>
Got an example?
00:22
< Vornicus>
Not on me, but McM does, and back when he was working on his dissertation often talked about it in here.
00:23
<@ToxicFrog>
Aah.
00:24
<@ToxicFrog>
(at any rate, the quick and dirty solution to that is "if you can't determine the type at compile time, it doesn't pass type checking and your code does not compile")
00:26
<@Derakon>
Incidentally, this was all inspired by a comment someone made on a forum I read: "The litmus test for any new language I learn is this: If the implication "It compiles => It works" generally holds, then it's a good language."
00:27
<@Derakon>
(The topic of conversation was the feasibility of porting Angband to Python)
00:27
<@McMartin>
TF: "determine the type" is readily possible if you mean "determine a type it is safely castable to".
00:27
<@McMartin>
What is not possible is "determine the *exact* type".
00:27
<@ToxicFrog>
Aah, well the.
00:28
<@McMartin>
Obvious counterexample. class Foo; class Bar extends Foo; class Baz extends Foo; main() { Foo a; if (f()) a = new Bar(); else a = new Baz();
00:28
<@McMartin>
Getting the exact type of a at the end of that function involves solving the halting problem, more or less.
00:29
<@ToxicFrog>
Right. But in either case you can safely say at compile time that it is_a Foo; you just can't tell if it's also a Bar or a Baz.
00:29
<@McMartin>
But whatever it is, it's some subclass of Foo.
00:29
<@McMartin>
Right.
00:29
<@McMartin>
The algo for that is "Rapid Type Analysis" and it's conceptually similar to detecting use-before-def or def-without-use.
00:29
<@McMartin>
Doing *that* level of stuff is actually handled by the JVM as part of link-loading; it's what "bytecode verification" boils down to.
00:31 * ToxicFrog nods
00:32
<@ToxicFrog>
So in that case the answer is "sort of, but you end up disallowing some operations that are permitted by dynamic duck typing"
00:32
<@McMartin>
Yes.
00:32
<@McMartin>
Java handles that by having java.lang.Object as the Type Of Last Resort.
00:34
<@Derakon>
...I remember an assignment in my intro CS course that involved a lot of casting to/from Object.
00:35
<@Derakon>
IIRC it had something to do with writing the same unit converter we'd written in a functional language in a previous assignment, though I don't remember now why we had to do all the casts.
00:35
<@Derakon>
It was pretty painful though.
00:39
<@McMartin>
Yeah, Java's symbolic method invocation stuff involves a lot of java.lang.Object and a large number of exceptions the compiler forces you to handle.
00:44 SmithKurosaki [Smith@Nightstar-2d0312f0.generalmotorscentre.com] has joined #code
00:50 You're now known as TheWatcher[T-2]
00:56 You're now known as TheWatcher[zZzZ]
01:19 kws-not-here is now known as kwsn
01:53 Orthia [orthianz@Nightstar-6bf3dd83.xnet.co.nz] has joined #code
01:58 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has joined #code
02:05 SmithKurosaki [Smith@Nightstar-2d0312f0.generalmotorscentre.com] has quit [Ping timeout: 121 seconds]
02:21 Derakon is now known as Derakon[AFK]
02:24 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:26 Anno[Laptop] [annodomini@Nightstar-0150ae5b.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
02:28 Anno[Laptop] [annodomini@Nightstar-3a254a39.adsl.tpnet.pl] has joined #code
03:08 * celticminstrel is debating writing something like PISG, but in Python.
03:58
< celticminstrel>
Question... I'm guessing that if RawConfigParser.set is called with an option that is already present, it is overridden?
03:59
< Vornicus>
I'd assume so.
04:00
< celticminstrel>
On second thoughts, I just remembered the config files support some kind of line continuation...
04:01
< celticminstrel>
...is it just attained by indenting the continuation lines?
04:03
< Vornicus>
Hell if I know. I don't even know what language you're in.
04:04
< celticminstrel>
Python... though the config file format is semi-standard.
04:04
< celticminstrel>
At least, I know that PHP, DOSBox, and some others use essentially the same format (though probably with little variations).
04:07
<@ToxicFrog>
There is no "standard" config file format.
04:08
<@ToxicFrog>
There are a few relatively common ones; .rc and .ini are probably the most common.
04:08
< celticminstrel>
No, but several places use similar ones. The python one uses name:value or name=value with [headers].
04:08
< Vornicus>
json is pretty common.
04:08
<@ToxicFrog>
name=value with [headers] is .ini.
04:08
< Vornicus>
Not jut for configs but for serialization of a great many other things.
04:09
<@ToxicFrog>
Oh yeah, also JSON. And XML.
04:09
< celticminstrel>
So, in .ini, is an indented line considered a continuation of the previous line?
04:09
<@ToxicFrog>
Programs that are using Lua already tend to use Lua code for configuration, too.
04:09
<@ToxicFrog>
Depends on the app!
04:10
< celticminstrel>
Pseudo-HTML seems to be oddly common too; PISG uses it, InspIRCd uses it...
04:10
<@ToxicFrog>
If you think this is any sort of documented or formal standard you are in for a tragic awakening.
04:10
< celticminstrel>
No, I definitely don't think that. :)
04:10
<@ToxicFrog>
Pseudo-HTML, or XML?
04:10
<@ToxicFrog>
Anyways. I've seen \ used for linecontinuation, in the same manner as C
04:11
< celticminstrel>
Um... well, I don't think it has self-closing tags, so I'd say HTML (or SGML).
04:11
< Vornicus>
Seriously though, I highly recommend JSON for this sort of thing, it's nice and easy and everybody has an implementation.
04:13
< celticminstrel>
But JSON is pretty much the same as just importing a module.
04:13
< celticminstrel>
A module defining some dictionary variables.
04:13
< celticminstrel>
Or objects, or whatever.
04:15
<@ToxicFrog>
Yes. How is a .ini file any different?
04:17
< celticminstrel>
I dunno. I think it looks a bit nicer.
04:17
< celticminstrel>
It's nice and clearly categorized.
04:17
< celticminstrel>
Though only in a one-level hierarchy, but that's probably fairly simply to fix.
04:18
< celticminstrel>
If it were needed, that is.
04:20
< celticminstrel>
What was the check to see if a Python module was run from the command-line rather than by importing it? Something like "if name == '__main__':", except that's not quite right.
04:20
< celticminstrel>
I think.
04:20
< Vornicus>
if __name__ == "__main__":
04:21
<@ToxicFrog>
celticminstrel: but those are two seperate things - if ini looks nicer, fine, but that has nothing to do with how you load it
04:21
< celticminstrel>
...what?
04:33
<@ToxicFrog>
You said that "JSON is pretty much the same as just importing a module", then when I asked how are INIs any different, you replied "they're prettier"
04:54 Anno[Laptop] [annodomini@Nightstar-3a254a39.adsl.tpnet.pl] has quit [[NS] Quit: leaving]
05:10
< celticminstrel>
My point was that the JSON syntax is almost identical to dictionary syntax. But now, bed.
05:10 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
05:11
< Vornicus>
That's because it is dictionary syntax.
05:29 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
06:09 Stalker [Z@2C3C9C.B2A300.F245DE.859909] has quit [Ping timeout: 121 seconds]
06:14 Stalker [Z@5E691D.FC7C16.75EF63.1806CB] has joined #code
06:29 Stalker [Z@5E691D.FC7C16.75EF63.1806CB] has quit [Ping timeout: 121 seconds]
06:48 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
07:24 Derakon[AFK] is now known as Derakon
07:55 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
08:01 Derakon is now known as Derakon[AFK]
09:14 Vornicus is now known as Vornicus-Latens
09:15 You're now known as TheWatcher
10:22 Attilla [Some.Dude@Nightstar-668e6b4a.threembb.co.uk] has joined #code
10:22 mode/#code [+o Attilla] by Reiver
10:30 Zed_ [Zed@Nightstar-556ea8b5.or.comcast.net] has quit [[NS] Quit: Leaving]
10:30 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has joined #code
10:32
< simon_>
I was wondering
10:33
< simon_>
a friend of mine has this project in which he generates a bunch of random Game of Life "lifeforms" (NxN starting conditions) and spots which of them have self-replicating behaviour, etc.
10:34
< simon_>
a lot of work goes into determining symmetries in the beginning.
10:37
< simon_>
and I was thinking that there might be a datastructure that could canonically represent a GoL starting condition such that, given another starting condition, a comparison would be straight-forward (no twisting and turning the thing in eight different ways)
10:43 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
11:56 Orthia [orthianz@Nightstar-6bf3dd83.xnet.co.nz] has quit [Ping timeout: 121 seconds]
12:06 * TheWatcher carelessly ventures into the world of Dark Engine script writing
12:13 Orthia [orthianz@Nightstar-2a4dd775.xnet.co.nz] has joined #code
12:49 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has quit [[NS] Quit: Leaving]
12:49 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has joined #code
13:09 Anno[Laptop] [annodomini@Nightstar-3a254a39.adsl.tpnet.pl] has joined #code
13:36 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
13:46 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [Ping timeout: 121 seconds]
13:48 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
14:12 SmithKurosaki [Smith@Nightstar-753c8aae.sdsl.bell.ca] has joined #code
14:35 SmithKurosaki [Smith@Nightstar-753c8aae.sdsl.bell.ca] has quit [Ping timeout: 121 seconds]
14:44 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Client closed the connection]
16:17 Stalker [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
16:23 Stalker [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
16:39 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has quit [Client exited]
16:52 SmithKurosaki [Smith@Nightstar-753c8aae.sdsl.bell.ca] has joined #code
16:58 Stalker [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
17:28 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
17:29 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Client closed the connection]
17:38 Vornicus-Latens is now known as Vornicus
17:51 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
17:51 celticminstrel [celticminst@Nightstar-f8b608eb.cable.rogers.com] has joined #code
18:28 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has quit [Ping timeout: 121 seconds]
18:39
< celticminstrel>
Okay, so if I'm in module xxx and I want to import module xxx.yyy, "import xxx.yyy" won't work? Will "import yyy" work? (This is Python if it's not obvious.)
18:45
< Vornicus>
http://docs.python.org/tutorial/modules.html#intra-package-references
18:48 Derakon[AFK] is now known as Derakon
20:18 cpux is now known as shade_of_cpux
20:30 Taki^ [jwjw@Nightstar-726bee87.consolidated.net] has joined #code
21:05 Stalker [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
21:28 Stalker [Z@5E691D.FC7C16.9F8D82.9AAF90] has joined #code
21:37 Stalker [Z@5E691D.FC7C16.9F8D82.9AAF90] has quit [Ping timeout: 121 seconds]
22:03 Stalker [Z@2C3C9C.B2A300.F245DE.859909] has joined #code
22:45 SmithKurosaki [Smith@Nightstar-753c8aae.sdsl.bell.ca] has quit [Operation timed out]
23:09 Attilla [Some.Dude@Nightstar-668e6b4a.threembb.co.uk] has quit [[NS] Quit: ]
--- Log closed Sun Oct 24 00:00:04 2010
code logs -> 2010 -> Sat, 23 Oct 2010< code.20101022.log - code.20101024.log >