code logs -> 2014 -> Sat, 05 Apr 2014< code.20140404.log - code.20140406.log >
--- Log opened Sat Apr 05 00:00:47 2014
00:12
<&ToxicFrog>
That is an implementation detail which is not an excuse for making the error message misleading.
00:13
<@RchrdB>
Yeah, maybe message really ought to say "has neither __contains__ nor __iter__", or something else to that effect.
00:13
<&McMartin>
"Error: Object X does not implement __constains__" is indeed also misleading since it's legal not to
00:16
<@RchrdB>
I wonder what the rationale for all of the method names being __underscored__ like that was, anyway?
00:17
<&McMartin>
It's how the C library indicates "I am internal"
00:17
<&McMartin>
And in theory "don't use me directly" but in practice "USE THIS FUCKING EVERYWHERE"
00:18
<@RchrdB>
Sure, I know that, and IMO __dunder__ is a great convention for private methods
00:19
<@RchrdB>
It's not immediately obvious though that "for ... in ..." should have been written as ".__iter__()" instead of ".iter()", though.
00:19 * McMartin revisits King James Programming
00:19
<&McMartin>
"the LORD preserve knowledge, and he overthroweth the words of Alan Perlis, âSyntactic sugar causes cancer of the semicolon.â "
00:20
<@RchrdB>
I guess it's sort of necessary to have *some* kind of namespacing of special methods for whenever you want to add *more* of them. e.g. __enter__() and __exit__() on context managers.
00:22
<&McMartin>
"we have heard that antichrist shall come, even now are there many antichrists; whereby we know that we are forced to admit time into our computational models" is almost literally Chapter 3 of SICP
00:55 Turaiel[Offline] is now known as Turaiel
01:02
<@RchrdB>
<secret nature="terrible">I should really read all of SICP myself instead of just trying to trick other people into doing so all the time.</secret> ¬_¬
01:03
<&ToxicFrog>
McMartin: 'error: object X is not iterable and does not implement __contains__'
01:04
<&ToxicFrog>
RchrdB: the true terror is your use of XML~
01:05
<@RchrdB>
(with-nature "terrible" (secret "I should really read all of SICP myself instead of just trying to trick other people into doing so all the time."))
01:06
<@RchrdB>
secret(S),terrible(S),content(S, "I should really read all of SICP myself...");
01:08 macdjord|wurk is now known as macdjord
01:08
<&McMartin>
Reading *all* of SICP is less critical; the final chapter on "register machines" is complicated enough to be head-hurty and abstract enough to not actually be very useful
01:13
<@RchrdB>
Dammit, "TypeError: can't set attributes of built-in/extension type 'function'"
01:14
<@RchrdB>
I wanted to stick a __contains__ on functions to make 1-arity predicates work with "in". :|
01:41
<@celticminstrel>
What's that third one, RchrdB?
01:42
<@celticminstrel>
I thought you could set attributes on functions...
01:57
<@RchrdB>
celticminstrel, predicate(Variable1, Variable2). ; is Prolog's syntax.
01:57
<@RchrdB>
Also Erlang's, more or less, I think because of hysterical raisins.
02:00
<@RchrdB>
celticminstrel, I *can* set properties on individual functions, but I wanted to add a descriptor to the function type object so that it would show up on all functions. :|
02:00
<@celticminstrel>
Oh.
02:02
<@RchrdB>
You know how in Javascript you can monkey-patch other peoples' classes by altering the properties of their prototypes? The equivalent works just fine in Python too, though not for classes defined in C code. :|
02:02
<@celticminstrel>
Yeah, I know about that in JavaScript. Even works for the built-in classes, more or less.
02:03
<@RchrdB>
Indeed. It works just fine for *pure* Python, but most of the builtin classes are implemented in C and won't let you.
02:42 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has joined #code
03:08 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
03:08 mode/#code [+qo Vornicus Vornicus] by ChanServ
03:47 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
03:47 mode/#code [+o himi] by ChanServ
04:08 Kindamoody[zZz] is now known as Kindamoody
04:14
<&McMartin>
Vorn: You were out when I announced this early this morning, but: I cracked the C64 floating point format
04:14
<&McMartin>
It's now totally feasible to use the BASIC evaluation vectors to compile formula translators
04:15
<&McMartin>
http://pastebin.starforge.co.uk/630
04:22 thalass [thalass@Nightstar-90oetb.bigpond.net.au] has joined #code
04:22 mode/#code [+o thalass] by ChanServ
04:24 * thalass ponders an open source electronic voting system
04:24
<@RchrdB>
McMartin, what's that format? 8 bits of exponent, offset from zero, 31 bits of mantissa with the sign bit in between the exp and mantissa?
04:25
<&McMartin>
RchrdB: Yeah, with 0 0 0 0 0 as zero and 129 as the encoding for 2^0
04:25
<@RchrdB>
(+ exponent 129) is a bit odd. IEEE754 puts the offset exactly in the centre.
04:26
<&McMartin>
There are two formats used, actually. This is the "at rest" format
04:26
<@RchrdB>
Interesting! That'll be the first 40-bit floating point format that I've heard of.
04:26 * RchrdB -> slep.
04:26
<&McMartin>
The Floating Point Accumulator is a couple more bytes and has a bunch of redundancy
04:26
<&McMartin>
Mainly I think to make certain operations much faster
04:27
<@macdjord>
McMartin: 'call-with-cthulhu-invocation'?
04:28
<&McMartin>
call-with-current-continuation, one of the more eldritch control constructs.
04:30
<&McMartin>
It's roughly the generalization of setjmp/longjmp in a world where all captured execution contexts last forever until garbage collected, and as a result it is simultaneously do-while, exceptions, co-routines, and an intermediate format you can compile arbitrary code to.
04:30 thalass is now known as Thalass|lunchymunchy
04:33
<@macdjord>
So... it... auto-loops a function? With built-in tail-recursion?
04:34
<&McMartin>
No, because you can also store it in a global variable, return from that function, and then invoke it later to go back where you were.
04:34
<&McMartin>
Repeatedly
04:34
<&McMartin>
I think of it as a tail-call that replaces the entire call stack instead of just the last stack frame as a tail-call would.
04:35
<@macdjord>
I... glurg.
04:35
<&McMartin>
But the case where you're inside one function and looping until you're done is common enough that there's a syntax for just doing that, and it's basically clojure's loop-recur
04:35
<&ToxicFrog>
macdjord: basically, (call/cc f) calls f with a 'continuation'. Returning from f returns from call/cc.
04:35
<&ToxicFrog>
Calling the continuation also returns from call/cc.
04:35
<&ToxicFrog>
You can save the continuation somewhere and do this as many times as you want.
04:36
<&McMartin>
That explanation never helped me much because it doesn't make a whole lot of sense to return from a function whose caller returned three days ago~
04:36
<@macdjord>
... this sound even /more/ spagetti than GOTO.
04:36
<&McMartin>
Anyway, here's the fully local, macroed away version that's actually easy
04:37
<&McMartin>
(define (fact n) (let loop ((r 1) (i 1)) (if (> i n) r (loop (* r i) (+ i 1)))))
04:37
<~Vornicus>
mcm: holy shit
04:37
<&McMartin>
macdjord: When you're using it as a compilation target, you are in fact appending every machine instruction with a possibly nondeterministic GOTO.
04:37
<&McMartin>
But then, we call those things "control flow graphs"
04:37
<~Vornicus>
(re floating point format)
04:38
<&McMartin>
(I figured you were not impressed with factorial)
04:38 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
04:43
<&ToxicFrog>
McMartin: I found out about call/cc after coroutines, and found that it made slightly more sense if envisioned as being able to repeatedly resume a coroutine at the same yield point - i.e. (resume co) does not mutate co and can be repeated.
04:43
<&McMartin>
Yeah
04:52 Thalass|lunchymunchy is now known as Thalass
05:14 Derakon is now known as Derakon[AFK]
05:37 Thalass [thalass@Nightstar-90oetb.bigpond.net.au] has quit [Ping timeout: 121 seconds]
05:42
<@celticminstrel>
Hm, I was going to use a std::set because it automatically handles duplicates, but then I remembered I need to preserve insertion order...
05:44
< [R]>
By "handles duplicates" did you mean it deduplicates?
05:44
<@celticminstrel>
More or less? I don't want to add elements if they're already there.
05:45
< [R]>
Cause I'm pretty sure the insertion order requirement will fail if you implement deduplication.
05:45
<@celticminstrel>
I don't see how?
05:45
<@celticminstrel>
Scan the list/vector for it, don't add it if found.
05:46
< [R]>
If you have 1 2 5 3 4 2 3...
05:46
< [R]>
If you want, you could use a set for a list of keys and use a map/hashtable thing? (I can't remember what the STL's offerings are ATM)
05:47
< [R]>
Err
05:48
<@celticminstrel>
Eh, the original vector should work.
05:48
< [R]>
Basically one for a list list of the elements that keeps the insertion order, and the storage structure that handles the dedupe.
05:48
<@celticminstrel>
Hm.
05:48
<@celticminstrel>
I dunno if I want to have two copies of everything.
05:48
< [R]>
The order thing is just the list of keys...
05:49
< [R]>
Unless you're storing ints
05:49 * [R] has been assuming you're storing data structures of some sort
05:49
<@celticminstrel>
I'm storing objects. Which contain strings and integers.
05:50
<@celticminstrel>
I was going to defined a less than operator and throw them in a set, but that'll sort them by the key values.
05:50
<@celticminstrel>
Because it's a tree set.
05:50
<@celticminstrel>
(And if I used a hash set it'd scramble the order.)
05:50
<@celticminstrel>
(Or sort them by the hash, I suppose.)
05:51
<@celticminstrel>
(Which doesn't help.)
05:51
<@celticminstrel>
You're suggesting I keep a set containing just a key generated from the object?
05:52
<@celticminstrel>
So basically, all this means is that, instead of running std::find each time I want to add something, I look it up in the set?
05:52 RchrdB [RichardB@Nightstar-c6u.vd5.170.83.IP] has quit [[NS] Quit: Gone.]
05:52
<@celticminstrel>
It seems basically the same as what was there before I thought of changing it to a set, except maybe faster.
05:52
< [R]>
Well any container that keeps the insertion order (unless you have that covered already, in which case, any one that does dedupe for you somehow)
05:53
< [R]>
Oh right, lower level stuff
05:53
<@celticminstrel>
Lower level stuff/
05:53
<@celticminstrel>
^?
05:54
< [R]>
(Used to HLLs where what I'm suggesting is a bit more sane)
05:54
<@celticminstrel>
C++ isn't a high level language?
05:54
< [R]>
No
05:54
<@celticminstrel>
<_<
05:54
<@celticminstrel>
I guess for now I'll just use std::find to make sure it's not already there.
05:55
<@celticminstrel>
This is definitely not a good time to be thinking about optimization.
05:55 RchrdB [RichardB@Nightstar-c6u.vd5.170.83.IP] has joined #code
05:57
< [R]>
IMO if you can fuckup memory allocation yourself (IE it's not a bug in the VM/interpreter/compiler), it's not an HLL.
05:58
<@celticminstrel>
Ah.
05:59
< [R]>
Yes, there a libraries to fix that... but there are libraries to do the same for C
06:00
<&McMartin>
You can fuck up memory allocation in Java.
06:01
<&McMartin>
By leaving dangling references you didn't intend, etc.
06:01 * McMartin tends to think of a language as high-level if it has its own runtime.
06:01
< [R]>
Runtime == VM/interpreter?
06:01
<@celticminstrel>
I fully expect runtime errors once I get this to link.
06:01
<&McMartin>
No, like, libc.
06:01
< [R]>
O.o
06:02
<&McMartin>
HLL is anything that isn't an assembler, basically, and some assemblers are borderline.
06:02 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has quit [[NS] Quit: Leaving]
06:02
<@celticminstrel>
Which might actually be this weekend, since there were only 18 source files left to get through a couple attempts back.
06:03
<@celticminstrel>
Though some of those source files have a lot of errors, so maybe not.
06:07 himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
06:20 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
06:20 mode/#code [+o himi] by ChanServ
06:30 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
06:46 ErikMesoy|sleep is now known as ErikMesoy
07:06 macdjord is now known as macdjord|slep
07:29 Turaiel is now known as Turaiel[Offline]
07:56 Kindamoody is now known as Kindamoody|afk
07:58 celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
08:22 JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
08:22 mode/#code [+o JackKnife] by ChanServ
08:50 ErikMesoy [Erik@Nightstar-6v0.mal.203.80.IP] has quit [[NS] Quit: Leaving.]
09:54 himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
10:07 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
10:07 mode/#code [+o himi] by ChanServ
10:25 himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
10:38 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
10:38 mode/#code [+o himi] by ChanServ
11:03 Syka [the@Nightstar-s57.sib.126.1.IP] has joined #code
11:04 Syka is now known as NSGuest65501
11:07 NSGuest65501 is now known as Syk
11:21 Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has quit [Ping timeout: 121 seconds]
11:28 Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has joined #code
11:28 mode/#code [+o Orthia] by ChanServ
11:59 ErikMesoy [Erik@Nightstar-6v0.mal.203.80.IP] has joined #code
12:00 mode/#code [+o ErikMesoy] by ChanServ
12:23 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
12:28
< AnnoDomini>
Are there any extant examples of moons having their own moons?
12:42
< Syk>
AnnoDomini: probably not
12:42
< Syk>
AnnoDomini: although, define 'moon'
12:42
< AnnoDomini>
A celestial body orbiting a celestial body orbiting a star.
12:43
< Syk>
that's just a regular moon
12:43
< Syk>
you mean a body orbiting a body orbiting a body orbiting a star?
12:43
< AnnoDomini>
Yes.
12:43
< Syk>
right
12:44
<@Tamber>
Yo dawg, I heard you liked moons... >_>
12:46 * AnnoDomini imagines a moon inside of a moon.
12:47
<&McMartin>
So you can moon while you moon?
12:47
< AnnoDomini>
I'd rather not, thanks.
12:48
<@Tamber>
So you can orbit while you orbit while you orbit.
12:48
< Syk>
wheeeeee
13:46
< AnnoDomini>
C++ with Qt. Is it possible to refer to the outer object from an inner object? I struggle to define what I mean.
13:48 JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
13:51
< AnnoDomini>
Sort of like "this" refers to the current object in Java. But I'd like to determine what object the current object is part of and access that parent object's properties.
14:02 JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
14:02 mode/#code [+o JackKnife] by ChanServ
14:04
<@gnolam>
::parentWidget()
14:04 JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Connection closed]
14:04 JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
14:04 mode/#code [+o JackKnife] by ChanServ
14:05
< AnnoDomini>
Is that only for Widgets or for arbitrary classes and structs I make too?
14:10 JustLurk [justbob@ServerAdministrator.Nightstar.Net] has joined #code
14:10 JustBob [justbob@ServerAdministrator.Nightstar.Net] has quit [NickServ (RECOVER command used by JustLurk)]
14:10 JustLurk is now known as JustBob
14:10 mode/#code [+o JustBob] by ChanServ
14:20 * AnnoDomini is struck that he knows what the moons of Mars are called because he played Doom.
14:28
<@TheWatcher>
well hey, at least you /know/, which is more than can be said for most
15:22 celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has joined #code
15:22 mode/#code [+o celticminstrel] by ChanServ
15:23 Typherix [Typherix@Nightstar-n91qrf.lnngmi.sbcglobal.net] has quit [Ping timeout: 121 seconds]
15:28 Typherix [Typherix@Nightstar-n91qrf.lnngmi.sbcglobal.net] has joined #code
15:41
<&McMartin>
AnnoDomini: Non-widgets don't have parents; the parent-child relationship is part of being in a GUI.
15:41
< AnnoDomini>
OK.
16:02
< AnnoDomini>
Using the Qt form designer right now seems like a logic puzzle. I had to come up with an exact series of drag-and-drop operations to get the nested layout I want.
16:05
<@macdjord|slep>
<Syk> you mean a body orbiting a body orbiting a body orbiting a star?
16:05
<@macdjord|slep>
Binary star systems.
16:05
<@macdjord|slep>
You have moons, that orbit planets, that orbit a small star, that orbits a larger star.
16:07 macdjord|slep is now known as macdjord
16:09
<@macdjord>
AnnoDomini: Could be worse. Could be you know the moons of Mars because they are the names of Sailor Mars's crows. <_<
16:18
< AnnoDomini>
She has crows?
16:24
<@macdjord>
... yes. A whole flock. But she has two of particular intelligence which she keeps as pets, named Deimos and Phobos.
16:25
<@celticminstrel>
Possibly only in the manga?
16:25
<@macdjord>
Perhaps? My memories of the show are... distant.
16:26
<@celticminstrel>
Probably better that way.
16:27 * McMartin fiddles with Commodore BASIC
16:27
<@macdjord>
Actually, from what I've heard, the original version (subbed) is actually pretty good. It was the butchered English dub that really sucked.
16:27
<&McMartin>
This is such a pile of inconsistency
16:27
<&McMartin>
Nonlocal NEXT/RETURN, but no computed GOTO or GOSUB
16:28
<@celticminstrel>
I vaguely recall not liking it that much, but maybe that's just me.
16:52 * AnnoDomini runs the Debian dual-boot for the first time in months.
16:52
< AnnoDomini>
For some reason, trying to install the Perl MT PRNG results in a proposed solution of uninstalling half of what's installed.
16:54
< AnnoDomini>
486 MB to be freed! Except I notice that useful stuff like, say Open Office, and what appears to be half of Gnome, will be uninsalled.
16:54
< AnnoDomini>
+t
16:57
< AnnoDomini>
I'm going to do that once I finish syncing my Dropbox, just to see what happens.
17:45 Derakon[AFK] is now known as Derakon
18:01 Turaiel[Offline] is now known as Turaiel
18:35 * AnnoDomini finds out what happens: The OS uninstalled itself.
18:44
<@macdjord>
AnnoDomini: Oops?
18:44
<@macdjord>
Hey, at least it /has/ that capacity. Unlike some OSes.
19:00 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [Connection closed]
19:00 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
19:21
< AnnoDomini>
TheWatcher: How do I install Perl libraries under Cygwin?
19:48
< AnnoDomini>
What do I do about this? http://pastie.org/8996851
19:53 * AnnoDomini solves it.
19:53
< AnnoDomini>
The makefile wanted to run "gcc-4" and "g++-4" instead of "gcc" and "g++".
19:54
<&ToxicFrog>
AnnoDomini: re-run the Cygwin installer, and select the libraries you want installed
19:54
<&ToxicFrog>
Alternately, re-run the installer, install CPAN, and use that
19:54
<&ToxicFrog>
The Cygwin installer is also the updater and package manager.
19:54
< AnnoDomini>
Yeah, I tried CPAN first, found out that I have no build essentials installed, then used the installer to install that.
19:55
< AnnoDomini>
Then I ran into the problem of the bloody makefile having wrong command names.
20:00 * AnnoDomini finds that make test on Net::Ping::External fails.
20:00 * AnnoDomini goes ahead straight to make install.
20:00
< AnnoDomini>
This was quite a bit of yak shaving to be able to develop my bot.
20:03
<@gnolam>
IRC bot?
20:03
< AnnoDomini>
Yes.
20:03
<@gnolam>
Not to be That Guy, but if you're using C/C++ for it, you're using the wrong language.
20:04
< AnnoDomini>
Perl, actually.
20:04
<@gnolam>
Ah.
20:05
< AnnoDomini>
But yes, I needed a lot of somewhat unrelated things to be able to run it.
20:20
<@ErikMesoy>
I think I have been doing poor coding practice: using patterns like "try: DoThingWith(x) except: DoThingWith(defaultvalue)" to handle all errors when I should be using checks like like "if x is not null" and "if x exists" and "if len(x) >1" to handle several-but-not-all errors.
20:56 Kindamoody|afk is now known as Kindamoody
21:10 Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has quit [Ping timeout: 121 seconds]
21:11 Kindamoody is now known as Kindamoody[zZz]
21:28
< AnnoDomini>
If \x02 is the code for the bolding character, what's the foreground/background reversing code?
21:30
<@celticminstrel>
^V
21:33
< AnnoDomini>
Thanks.
21:33
< AnnoDomini>
How do I represent an either-or in bracket code in syntax definitions? I mean, I want to say "choose one of these but not both".
21:33
<@celticminstrel>
In what now?
21:34
<@celticminstrel>
If you're talking about defining a grammar, it's probably |
21:34
< AnnoDomini>
You know, <required> [optional]
21:34
< AnnoDomini>
OK, thanks. That works.
22:42 JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has quit [[NS] Quit: If the world didn't suck, we'd all fall off.]
23:25 iospace is now known as io\BADGERS
23:44 Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has joined #code
23:44 mode/#code [+o Orthia] by ChanServ
--- Log closed Sun Apr 06 00:00:03 2014
code logs -> 2014 -> Sat, 05 Apr 2014< code.20140404.log - code.20140406.log >

[ Latest log file ]