code logs -> 2012 -> Sat, 02 Jun 2012< code.20120601.log - code.20120603.log >
--- Log opened Sat Jun 02 00:00:56 2012
00:37 Vash [Vash@Nightstar-241cb5d4.wlfrct.sbcglobal.net] has joined #code
00:37 mode/#code [+o Vash] by ChanServ
00:57 Derakon[AFK] is now known as Derakon
01:00 Kindamoody[zZz] is now known as Kindamoody
01:53 Derakon is now known as Derakon[AFK]
03:03 Attilla [Obsolete@Nightstar-7a57bd9d.as43234.net] has quit [Ping timeout: 121 seconds]
03:42 Kindamoody is now known as Kindamoody|afk
03:46
<&McMartin>
Hrm.
03:46
<&McMartin>
So, it looks like grep doesn't understand \s or \S, but does understand [[:space:]].
03:50
< RichyB>
egrep?
03:50
< RichyB>
Plain BRE grep wouldn't even understand [[:space:]].
03:50
< RichyB>
But yeah, it's POSIX ERE rather than PCRE.
03:51
< RichyB>
pcregrep(1) exists if you really want Perl regexp syntax.
03:51
< RichyB>
...even has a JIT in it these days, I think.
04:04
<&McMartin>
Well
04:04
<&McMartin>
What I *really* need here is sed
04:04
<&McMartin>
I want to mass-wipe trailing whitespace from this repository.
04:05
<&McMartin>
Unless there's a specific tool just for this that I am unaware of~
04:08
< RichyB>
find . -name "*.c" -exec sed -ri 's/[[:space:]]+$//' {} + # ought to do it.
04:08
< RichyB>
If you're on BSD, their sed uses the '-i' option a little differently
04:08
< RichyB>
so phrase that as: find . -name "*.c" -exec sed -r -i '' 's/[[:space:]]+$//' {} + # instead.
04:09
< RichyB>
Or grab Emacs, write a little lisp to recursively visit every file in the tree and run M-x delete-trailing-whitespace. ;)
04:09
< RichyB>
So um I mean yes, sed probably is indeed what you want, with the -i option.
04:10
< RichyB>
McMartin, that help any or can I assume from the deafening silence that you already knew and I've merely annoyed you?
04:10
<&McMartin>
Actually, I was tabbed out
04:10
<&McMartin>
Let me try tha tout.
04:10
<&McMartin>
What's the + # there?
04:11
< RichyB>
find . -exec command {} +
04:11
< RichyB>
The {} gets replaced by the list of things that find found
04:11
<&McMartin>
Oh. Hm. I'm used to -exec expecting ; as the terminator?
04:11
< RichyB>
the + terminates the -exec ... commands.
04:11
<&McMartin>
Or, well, \;.
04:11
< RichyB>
Batching.
04:12
< RichyB>
find . -exec command {} \; # runs command file1; command file2; command file3; ...
04:12
<&McMartin>
Aha, OK.
04:12
< RichyB>
find . -exec command {} + # runs command file1 file2; command file3 file4; ...
04:12
<&McMartin>
I have learned a new Thing!
04:12
<&McMartin>
I'm used to just xargs-ing it up for that.
04:12
< RichyB>
(in blocks larger than just two items, it's usually a few hundred, depending on ulimits, I think)
04:13
<&McMartin>
Yeah
04:13
<&McMartin>
That's going to track xargs more or less exactly
04:13
<&McMartin>
Or, well, -print0 | xargs -0.
04:13
<&McMartin>
Excellent.
04:13
<&McMartin>
It also works, so woo, thanks~
04:13
< RichyB>
Yay! You're welcome.
04:13
<&McMartin>
It was -r that I was missing.
04:13
< RichyB>
*nodnod*
04:13
< RichyB>
sed gives you posix BREs by default, which are naturally the worst thing ever.
04:14
<&McMartin>
I'm actually doing -ri.bak so that if things go horribly wrong I don't have to dick around with revision control.
04:14
< RichyB>
-r turns EREs on, so you get the same syntax as egrep.
04:14 * McMartin nods
04:14
<&McMartin>
So, um
04:14 * RichyB blink.
04:14
<&McMartin>
I have this notion that \s means "whitespace" and \S means "non-whitespace" or vice versa.
04:14
< RichyB>
You Are Using Version Control, Right? o_O
04:14
<&McMartin>
Where did I pick that up?
04:14
<&McMartin>
Yes, I am
04:14
< RichyB>
Okay, no panic then.
04:14
<&McMartin>
But I'm also trying to group commits sensibly.
04:14
< RichyB>
McMartin, Perl. \s and \S comes from Perl, I think.
04:15
<&McMartin>
I guess I can commit what I have *now* and then squash this commit in during rebase later.
04:15
<&McMartin>
That still feels dirty to me though.
04:15
< RichyB>
Nah, that's exactly the workflow that rebase is for.
04:16
< RichyB>
Make a tiny branch if you want to be extra safe.
04:16
<&McMartin>
I'm still not comfortable with that workflow yet.
04:16
< RichyB>
AIUI, these days, everyone imitates Perl-compatible regexps using JITing engines that do funky things with automaton theory, like compiling to DFAs for expressions that happen to not use any of the features that make PCREs NP-hard.
04:17
<&McMartin>
Always a plus.
04:17
<&McMartin>
DFAs roxxor.
04:18
< RichyB>
Yeah. Okay, well, I don't know *how many* engines actually do that, but they do exist. Like re2 for Python is supposed to do roughly that, and I think that the regular expression engines in JS runtimes are now really shockingly aggressive.
04:18
<&McMartin>
JS runtimes generally are shockingly aggressive.
04:18
<&McMartin>
They take the C++ dictum of "don't pay for features you aren't using" to the dizzying heights that it actually deserves.
04:18
<&McMartin>
As opposed to breaking the back of an entire language for it. -_-
04:18
< RichyB>
Heh.
04:19
< RichyB>
That reminds me
04:19
<&McMartin>
Anyway, this is what's being worked on
04:19
<&McMartin>
https://github.com/michaelcmartin/Ophis/commits/master/
04:19
< RichyB>
I'm about halfway through reading a thing on an OS for the 68k called "Synthesis" that someone wrote
04:20
<&McMartin>
I think I'm going to unleash GLORIOUS CRUSHINGS on my local commit history and just toss it all in as a "code modernization" pass that mysteriously was all done last night despite the fact that I'm doing most of it right now.
04:20
< RichyB>
Which used runtime code-generation in all *kinds* of places. Pretty much entirely just the simplest big-win stuff, constant folding and propagation.
04:20
< RichyB>
That took partial evaluation to pretty dizzying heights.
04:20
< RichyB>
Ah, Alexia Massalin.
04:21
< RichyB>
It's really neat. She partially-evaluates her partial-evaluator in order to make her code-generation less expensive. :D
04:21
< RichyB>
http://valerieaurora.org/synthesis/SynthesisOS/index.html
04:21
<&McMartin>
Ha ha
04:21
<&McMartin>
Nice
04:21
<&McMartin>
So Many Things
04:22
< RichyB>
Yeah, I know what you mean. My books-to-read stack is currently, uh.
04:23
< RichyB>
Well, it's about as long as my arm, and that's not counting any of the PDFs nor the deluge of articles that I keep digging up online.
04:29
<&McMartin>
Eek
04:29
<&McMartin>
Important things to not do: fuck up the stuff in .git
04:29 * McMartin caught that just before he hit enter
04:30
<&McMartin>
I think I'll just back up this directory
04:31
< RichyB>
oh that would be bad
04:31
< RichyB>
well
04:31
< RichyB>
Yeah.
04:31
<&McMartin>
"You could reclone" - the whole point is that this is part of unpushed commits because it's not done yet
04:31
< RichyB>
Well, more that you can recover from pretty much anything provided you don't munge the actual *commit* files.
04:32
< RichyB>
It would involve interminable quantities of fucking around to rebuild your repo from just a bunch of bare objects with no idea which hashes correspond to the tips of the branches.
04:32
< RichyB>
Er, I should swear less, sorry.
04:32
<&McMartin>
Well
04:32
<&McMartin>
The repo is on github, so.
04:32
<&McMartin>
But I want to keep my latest commits.
04:33
<&McMartin>
So, local clone elsewhere on the filesystem, kthxbye
04:33
< RichyB>
Sensible.
04:37
<&McMartin>
Not the most concise filter, in the end.
04:37
<&McMartin>
Dry run:
04:37
<&McMartin>
find . -type f -not -path \*.git\* -not -name \*.map -not -name \*.pdf -not -name \*.exe -not -name \*.bin | xargs grep -l "[[:space:]]$"
04:38
< RichyB>
List all the code with trailing whitespace, outside of .git.
04:38
< RichyB>
Then put the output of that through sed -ri?
04:39
<&McMartin>
I was just going to do the sed -ri to everything that isn't code, confident it's a no-op everywhere else.
04:39
<&McMartin>
Er, that isn't binary
04:39
< RichyB>
Right, hopefully. :)
04:40
< RichyB>
If you're reformatting all of the code for whitespace, might I suggest going the whole hog and running astyle over all of it? Or PEP-8'ing it?
04:40
< RichyB>
Whatever your chosen language's usual style linter or enforcer is.
04:40
<&McMartin>
These are mostly text files and assembler here.
04:41
<&McMartin>
Is there a program for PEP-8'ing?
04:41
< RichyB>
Oh. Yeah, that probably isn't too relevant for assembler. Definitely not for text.
04:41
< RichyB>
If there is, I don't know of one.
04:41
< RichyB>
My preferred mechanism is to use just the pep8 *checker* and then harm people who write code that doesn't pass it until they learn to stop checking that shit in in the first place.
04:42
<&McMartin>
Oh hey, look at that, sed also fixed all my "no newline at end of file"
04:42
< RichyB>
Take that with a huge pinch of salt. I don't actually get to do that in practice. It's what I would like to do, though.
04:42
<&McMartin>
OK, so, next question. Where does one get a PEP-8 checker?
04:43
< RichyB>
The canonical one is called "pep8".
04:43
< RichyB>
I don't know if there's a Python reformatter. I assume that there *ought* to be.
04:43
< RichyB>
(I just haven't looked.)
04:43
<&McMartin>
I'm fine with a checker
04:43
< RichyB>
pep8 happens to be in Debian's repositories under the name "pep8".
04:44
< RichyB>
or /usr/ports/devel/pep8 in FreeBSD. ;)
04:44 * McMartin runs "sudo yum whatprovides pep8"
04:45
< RichyB>
Fedora or RHEL?
04:45
<&McMartin>
Fedora 17, mostly
04:45
< RichyB>
How do you like it?
04:45
<&McMartin>
preupgrade seems to be a little confused.
04:45
<&McMartin>
I'm still running an F16 kernel for some reason (probably because F17 has the same version)
04:46
<&McMartin>
I've been a Fedora guy since, basically, FC3.
04:46 * RichyB is still on Ubuntu 10.04 at the moment because, holy gosh-darn, more recent versoins of Ubuntu got all scary.
04:46
<&McMartin>
Heh
04:46
<&McMartin>
I use Ubuntu at work. 12.04 is less scary than its immediate predecessors.
04:46
< RichyB>
I tried 11.10 for a bit, hated it.
04:46
<&McMartin>
Looks like Fedora has it as python-pep8.
04:46
< RichyB>
Lots of stuff randomly didn't work, ccsm was gutted, where the Hell are my wobbly windows?
04:47
< RichyB>
Unity kind of drove me up the wall at first but I later got used to it. Gnome2 was just broken in a million different stupid ways so going back to it did not really feel like a viable alternative.
04:47
<&McMartin>
Using compiz as your window manager is an abomination unto the FSM -_-
04:48
<&McMartin>
Making compiz actually run on our partners' hardware was such a pain we actually ported mutter back to earlier versions -_-
04:48
< RichyB>
Haters gonna hate, but I have wobbly windows and I like it
04:48
<&McMartin>
hee
04:48
< RichyB>
Well okay right now I have that turned off ¬_¬
04:49
< RichyB>
But I love things like Compiz's magnifier and colour filter plugins. I have a keyboard shortcut that simulates red-green colour blindness with a fullscreen fragment shader.
04:49
<&McMartin>
Actually, you know what?
04:50
< RichyB>
?
04:50
<&McMartin>
I'm not willing to commit automatic changes to HTML docbook wrote.
04:50 * McMartin resets that subtree.
04:58
<&McMartin>
Oof. That's a lot of stuff.
04:58
<&McMartin>
I think I've autofixed a big chunk of it though.
05:00
< RichyB>
http://demoseen.com/windowpane/fl0wer.png.html
05:00
< RichyB>
(Works in Chrome 18 but not Firefox 15 on my machine)
05:01
< RichyB>
That monstrosity is a polyglot PNG file and a HTML file.
05:01
<@Tamber>
Works in firefox 12 for me.
05:01
<@Tamber>
Well, 'works'.
05:01
< RichyB>
I am using a nightly FF build.
05:02
< RichyB>
I am neither surprised nor disappointed when something fails.
05:02
<@Tamber>
Without javascript, I get the garbage I normally expect if an image gets served up as plain-text; with it, I get a swirling angry fruit salad.
05:02
< RichyB>
Angry fruit salad is the goal.
05:02
<@Tamber>
And it succeeds wonderfully.
05:02
<@Tamber>
It is certainly very angry, and rather fruity.
05:10
<&McMartin>
Bleh. 2 lines around each function? >_<
05:14 * McMartin gets about 750 errors from pep8.
05:15
<&McMartin>
I suppose that's actually not bad for never having read pep8.
05:15
< RichyB>
2 lines around every top-level class and function.
05:15
<&McMartin>
And 1 around methods, yea
05:16
<&McMartin>
So, this code was consistently 1 and 0, respectively, so it's pitching a fit.
05:16
< RichyB>
Heh.
05:16
< RichyB>
PEP8 is good though.
05:16
< RichyB>
I don't perfectly agree with the exact letter of every one of the rules in PEP8, but none of them are actually flat-out wrong
05:17
<&McMartin>
Yeah, no sense in not doing this with the reformat.
05:17
< RichyB>
and I'd much rather have a single language-recommended standard that everyone sticks to than a different standard for Every. Single. Project.
05:17
< RichyB>
*cough*every C, C++ and Java project ever written*coughcough*
05:21 io|meh is now known as io|bed
05:26
<&McMartin>
Silliness
05:27 * McMartin fiddles with his code generator.
05:27
<&McMartin>
That got it down to 526~
05:27
<&McMartin>
Mysteriously, autogenerated Python code is often over 80 columns wide~
05:30
< RichyB>
Yes.
05:31
< RichyB>
Oh, I would not bother with PEP8 on anything that is generated from a Makefile. ~
05:32
<&McMartin>
Well, it's not made from a Makefile
05:32
<&McMartin>
It's made by a script in tools/ that isn't really intended to be invoked more than once.
05:32
<&McMartin>
And it was simple enough to make it emit PEP8-compliant code.
05:33
< RichyB>
Huh,
05:33
<&McMartin>
I'm not completely convinced that's a win - it breaks the "tabular" nature of the data - but that's so wide in the first place it's not clear how sensible that is in the first place.
05:33
<&McMartin>
(Opcodes.py is machine-generated)
05:34
< RichyB>
What's your interest in the 6502?
05:35
<&McMartin>
It's the first chip I ever learned to program, both "in any language" and "with assembler".
05:35
<&McMartin>
Including hand-assembling to decimal and POKEing it in, in BASIC programs. :D
05:35
< RichyB>
Awww. :)
05:35
< RichyB>
One thing I never understood about 8-bit micros.
05:35
< RichyB>
The BASIC dialects for them were so restrictive
05:36
<&McMartin>
When I found a C64 emulator and was able to type, FROM MEMORY, "POKE 53280,6" and have it do precisely what I expected, I realized maybe I should revisit it with my adult skills.
05:36
< RichyB>
wasn't assembly *easier*? At least with ASM you get to use all of the CPU's features.
05:36
<&McMartin>
It... depended. A lot.
05:36 Kindamoody|afk is now known as Kindamoody
05:36
<&McMartin>
Things BASIC gave you that were usually not easy in Assembler: string-to-integer conversion. keyboard input. disk operations. floating point.
05:37
<&McMartin>
It's actually not uncommon to see assembly programs call into the BASIC ROM for that last one.
05:37
<&McMartin>
And those BASICs also usually had trig functions and such too, and garbage-collected string heaps with decent symbol manipulation.
05:37
< RichyB>
That sounds perfectly sensible.
05:37
< RichyB>
Really? Okay, I thought they gave you much less than that.
05:38
< RichyB>
Like, just integers, if statements and GOTO.
05:39
<&McMartin>
Nah, there was quite a bit in CBM BASIC, though it's noticably weaker than Apple II's BASIC (which had a pretty extensive graphical suite) or the 16-bit BASICs (which were so mighty it took Python 2.3 or so to meaningfully displace them in the roles they were good at)
05:40
<&McMartin>
The BASIC dialect I used in high school for hobby programming was for at least as powerful as Turbo Pascal, with each having their own particular advantages.
05:40
<&McMartin>
(That would have been QBASIC, a compiled dialect that is what VB was before it became Visual, more or less, and keeping all the goodies GW-BASIC and similar had)
05:40
< RichyB>
Wow! Okay, I hadn't had any idea about that at all!
05:40
< RichyB>
QBASIC was... was it byte-coded?
05:41
<&McMartin>
It had compilers and interpreters, but the compilers were hard to come by.
05:41
<&McMartin>
Raw numerical speed was a thing Turbo Pascal was better at.
05:41
< RichyB>
I remember coming across a full copy of QuickBASIC once.
05:41
<&McMartin>
QBASIC had direct access to Mode 13h, though (320x200 VGA graphical screen with 256 color palette from 24-bit truecolor palette)
05:41
< RichyB>
which spat out MS-DOS EXE files, evne.
05:41
< RichyB>
*even.
05:42
< RichyB>
I ended up losing that file completely by accident. Eh.
05:42
<&McMartin>
Yup. That'll be the compiled version, and that was a Full Compiler.
05:42
<&McMartin>
http://www.qb64.net/ is a C++/SDL emitter for QBASIC, including careful recreations of the old BIOS CGA/EGA/VGA modes. :D
05:43
< RichyB>
Wow
05:44
< RichyB>
_why wasn't kidding around when he talked about people going to extreme lengths to resurrect old videogames. :)
05:44 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Connection closed]
05:44
<&McMartin>
GORILLAS.BAS remains the gold standard for everything~
05:45 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
05:45 mode/#code [+o himi] by ChanServ
05:45
<&McMartin>
When I was working on that mini-Pascal for the 6502, I actually considered QBASIC as the language to compile
05:46
<&McMartin>
Then I went looking through the basics of its core library, and realized it was going to be massively excessive.
05:46
< sshine>
_why is that Ruby guy, right?
05:47
< RichyB>
Yeah.
05:48
< RichyB>
The one who wrote a *really* quirky book on learning Ruby, a bunch of nice libraries, then got unhappy for some reasons which I am not privy to and committed spontaneous infosuicide.
05:49
<&McMartin>
Oh hey
05:49
< RichyB>
Apparently he made an offhand comment at one point about the longevity of software
05:49
<&McMartin>
He's probably one of the reasons I refuse to learn Ruby!
05:49
< RichyB>
about how people pretty much throw away frameworks and libraries like Ruby or Node or Zope or whatever at the first opportunity,
05:50
< RichyB>
but videogames are effectively forever because holy Hell will people put a lot of effort into getting the original Command & Conquer going on a modern PC for nostalgia's sake.
05:50
<&McMartin>
... there's an obvious reason for this
05:50
< RichyB>
McMartin, really? The Zed Shaw didn't beat him to it? ;)
05:50
< RichyB>
Well several.
05:50
<&McMartin>
People throw away office memos at every opportunity but go to enormous lengths to preserve old novels.
05:51
<&McMartin>
It's like they're different classes of cultural artifact or something.
05:51
< RichyB>
McMartin, I'd like to hear your enumeration of the obvious reasons in case there's one I missed.
05:51
< RichyB>
Ooh! Yes, I love your phrasing. :D
05:51
<&McMartin>
Old games are ends in themselves and creative artifacts being Lost Forever is bad.
05:51
<&McMartin>
Zope, Ruby, etc, are all means to an end.
05:52
< RichyB>
Yyyyes...
05:52
<&McMartin>
That said, languages - or their stored formats - are effectively forever, in that people will keep emulators/reimplementations around.
05:52
<&McMartin>
See also: QB64.
05:52
< RichyB>
I'm thinking that things like OSes and machines really ought to be preserved, though.
05:53
<&McMartin>
Well, I mean
05:53
<&McMartin>
They *are*
05:53
< RichyB>
e.g. that Synthesis thing that I'm reading at the moment, well, I have no realistic hope of getting the original thing running, I think?
05:53
<&McMartin>
The danger there is that a lot of academic stuff is No Plans No Prototype No Backup
05:53
<&McMartin>
But, like, there are PDP-6 emulators that run in your browser these days :D
05:53
< RichyB>
Heh.
05:54
< RichyB>
Lack of backup for academic stuff fills me with incoherent rage.
05:54
< RichyB>
Preserving hard-won knowledge is supposed to be like half of universities' entire remit, y u no have stable plans for it!?
05:54
<&McMartin>
Well, I mean, my stuff is "backed up", but it's at this point useless.
05:54
<&McMartin>
Since the *actual system* was keyed to a specific version set of the JVM bytecode.
05:55
<&McMartin>
The replication would be easy enough, but you don't need the code for that.
05:55
<&McMartin>
I'm kind of curious how hard it would be to do in Clojure - I recall noting bitterly that most of my research would have been considered trivial in Common Lisp.
05:55
<&McMartin>
At least in terms of KLOC.
05:56
<&McMartin>
The core concept would still work, I think, at least if you had some way of indicating types (it was static-type specific).
05:56
<&McMartin>
... like you do in Clojure
05:56 * McMartin puts another entry on The List.
05:56
< RichyB>
Was your system reading JVM bytecode or generating it? I thought that the JVM was backwards-compatible with old .class files basically forever.
05:56
<&McMartin>
Mutating it.
05:56
< RichyB>
Ah, yeah, so you need to know everything.
05:57
<&McMartin>
Java 1.6 added significant additional bytecode annotation requirements to generated bytecode.
05:57
< RichyB>
Were you writing a static analyser or implementing some new optimisation passes?
05:57
<&McMartin>
Neither.
05:57
<&McMartin>
It was a configurable "super-taint mode", more or less
05:57
<&McMartin>
Operated on sets of objects, was capable of binding objects into the sets as free variables and identifying patterns that were intersections of context-free grammars on the alphabet of method calls.
05:58
<&McMartin>
The connection to static analyzers was "this is how hard a problem you need to pose to actually *require* the latest static analysis techniques", and we had some static components to it.
05:58
<&McMartin>
Hell, it might still be up, one moment
05:58
<&McMartin>
Oh hey, it is
05:59
<&McMartin>
http://pql.sourceforge.net/
05:59
< RichyB>
I can't immediately reason out what the applications are?
05:59
<&McMartin>
You'd have to have (and force) Java 1.5 compat mode to make it work
05:59 Derakon[AFK] is now known as Derakon
05:59
<&McMartin>
The go-to example was to recreate taint-like things in Java, and in particular automatically detect and render harmless SQL injection attacks.
05:59
<&McMartin>
By "render harmless" I mean that Ms. O'Connor gets to actually get her data in and out of the DB, too.
06:00
< RichyB>
Ah! Um, hrmn.
06:00
<&McMartin>
The OOPSLA paper is still pretty much the best description of the full system.
06:00
<&McMartin>
I tied it into various other systems for the actual dissertation
06:01
<&McMartin>
I think the abc compiler group is still doing stuff with similar concepts, but they were trying to use it as a software structuring technique
06:01
< RichyB>
So you'd rewrite cursor.sendQuery("SELECT * FROM users WHERE USER = " + request.form.get("username") + ";"); to cursor.sendQueryParams("SELECT * FROM users WHERE user = ?;", request.form.get("username")); ?
06:02
<&McMartin>
No - at the time of the unsafe call, it would make an aspect-oriented-style callout to a reaction routine which has access to every object that was involved in creating the query
06:02
<&McMartin>
It would then re-create the query out of properly-escaped components.
06:03
<&McMartin>
Basically, retroactively escaping the input at the last minute.
06:03
< RichyB>
...neat.
06:03
<&McMartin>
But yes, you highlight my primary objection to my work
06:03
< RichyB>
Instinctively I'd much rather have that as a *check* that throws a noticeable error message than an automatic rewrite.
06:03
<&McMartin>
Sure, you could do that too
06:03
<&McMartin>
It was, as noted, an aspect-based system. Upon getting a match it would call a method of your devising.
06:03
<&McMartin>
Nothing stopping that method from being System.dieHorribly.
06:04
<&Derakon>
How about System.diePeacefullyInYourSleep?
06:04
<&McMartin>
Or, as one of the other applications managed, ModelChecker.signalTargetEndState.
06:04
< RichyB>
I am not a huge fan of rewrites which change the semantics of programs, even when the semantics of the existing program are wrong and unsafe.
06:04
<&McMartin>
Yeah, well, aspect.
06:04
<&McMartin>
AOSD is basically The Principle Of Maximum Surprise
06:04
< RichyB>
For the wrong and dangerous case, I would much rather be *told* about it with loud shouty words.
06:04
<&McMartin>
Not even fucking *exaggerating*, much less kidding
06:05
< RichyB>
One day I might explain plone.app.dexterity to you.
06:05
< RichyB>
and Grok
06:05
< RichyB>
and we'll compare notes.
06:05
<&McMartin>
But yeah, when I wasn't directly competing with AOSD people, PQL was used to configure systems that did systematic error testing.
06:05
< RichyB>
First I'll need to actually understand p.a.dexterity and Grok though, and that could take an unbounded length of time to get.
06:05
<&McMartin>
And the action on match was "report error condition, now with complete history of how it got to be where it is."
06:06
< RichyB>
heh
06:06
<&McMartin>
Most of the rest of my published work is essentially "How do you keep that state space tractably small"
06:06
<&McMartin>
This resulted in my jamming more code through the Java Pathfinder model checker than it had previously managed by a factor of 100.
06:07
< RichyB>
I don't really understand your concise descriptions here.
06:07
< RichyB>
Possibly because I've stayed up until 6am because fuck knows why, I'm an idiot like that sometimes.
06:07
<&McMartin>
To be honest, I only have the abstracts paged in - 2006 was a long time ago.
06:07
< RichyB>
But I'm reading your OOPSLA 2005 paper now.
06:07
<&McMartin>
My work doesn't involve my grad research, and - as you may have picked up from my discussion of it - I've largely repudiated my earlier research.
06:08
< RichyB>
Damn dude.
06:08
< RichyB>
You did remember to publish both, right? :)
06:08
<&McMartin>
Oh, of course.
06:08
< RichyB>
Good, good. :)
06:08 * McMartin is Dr. McMartin.
06:08
<&McMartin>
I'm just saying that I consider the papers to be a more important contribution than the systems - I think that the papers *actually* prove the system is impractical.
06:08
< RichyB>
Sweet.
06:08
< RichyB>
Oh.
06:09
< RichyB>
Er
06:09
< RichyB>
Oh well.
06:09
< RichyB>
McMartin, the OOPSLA '05 paper is the one that I want to be reading, right?
06:09
<&McMartin>
Yeah.
06:09
<&McMartin>
Martin/Livshits/Whaley/Lam, IIRC.
06:09
<&McMartin>
That's the same Lam that's on the author list of the Dragon book
06:10
<&McMartin>
Anyway, yeah
06:10
< RichyB>
Cool! Your advisor?
06:10
<&McMartin>
Yeah
06:10 * RichyB slightly jealous.
06:10
<&McMartin>
Heh
06:11
<&McMartin>
My parents were not big fans of me going into CS, considering it kind of unclassy, like going into plumbing or TV and VCR repair
06:11
<&McMartin>
They recognized enough faculty at the grad level that this finally stopped =P
06:11
< RichyB>
Pffff, Stanford's like fuck me CS celebrities everywhere
06:12
< RichyB>
Yes, that. :)
06:12
<&McMartin>
I certainly don't regret my academic career, and there's some useful stuff that came out of it
06:12
< RichyB>
If I hadn't screwed up my academic career towards the end (also the beginning and middle, to be fair) of my undergrad, I'd totally have been angling for some postgrad work in complexity theory
06:12
<&McMartin>
But in terms of pushing usable state of the art, outside of some very esoteric fields, all my results are basically negative results.
06:12
<&McMartin>
That's still science, but it's the kind that doesn't make you wealthy and famous.
06:13
< RichyB>
partly because it's horrendously interesting but also because I'd attempt to get Richard Jozsa as advisor where I was studying. :)
06:13
<&McMartin>
That said. Clojure has dynamic rebinding and you can use that to implement what AspectJ calls "around" advice and CLOS calls something similar.
06:13
<&McMartin>
Almost all of my JVM hacking was to weave that stuff in based on a spec from the query language.
06:14
<&McMartin>
I think Clojure's methods might even allow :around
06:14
< RichyB>
A bit lost. You were talking about performing rewriting of JVM bytecode?
06:15
<&McMartin>
Yeah, basically, the JVM rewrite was to insert calls to my pattern matcher at appropriate points.
06:15
< RichyB>
For instrumentation?
06:15
<&McMartin>
And intervention if necessary.
06:15
<&McMartin>
Again, this is paged out, I'm going on fuzzy memory...
06:15
<&McMartin>
... but the kind of interruptions you got were "before", "after", and "around" - around *replaces* the call with the option of running the original call in the middle somewhere, conditionally
06:15
< RichyB>
Oh okay.
06:16
<&McMartin>
The "instrumentation" was the one that kept tabs on all the objects in the system that might be part of a match eventually, track their progress, and fire off the reaction events if a match happened.
06:17
< RichyB>
*nodnod* I think I read something about the CLOS object model at one point, I've definitely seen dynamic languages with OO dispatch that had "before" and "after" hooks on all methods.
06:17
<&McMartin>
Yeah. "Around" is the wacky one.
06:17
< RichyB>
Why wacky? It's just the composition of both "before" and "after".
06:17
<&McMartin>
I've never been super facile with Common LISP, though I do have both Guy L. Steele's classic book on it and a more gentle treatise on it in my labrary.
06:18
< RichyB>
oh yeah
06:18
<&McMartin>
Not quite. around can remove the call entirely.
06:18
<&McMartin>
It's really more "instead"
06:18
< RichyB>
I think I skimmed a ~100 page slim tome on Common Lisp at one point which was a fast and rough introduction.
06:18
< RichyB>
My general impression was something like "this is probably just ugly enough to get real work done with."
06:19
< RichyB>
Before and after can't?
06:19
<&McMartin>
After obviously can't - it's too late.
06:19
<&McMartin>
Before usually can't - it's for stuff like logging AIUI.
06:19 * RichyB facepalm.
06:19
<&McMartin>
The one case where I don't bitch about AOSD
06:19
< RichyB>
Yes, okay.
06:19
<&McMartin>
Maybe you need some sleep >_>
06:19 Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has joined #code
06:19
< RichyB>
So if you have...
06:19
<&McMartin>
Also, Inform 7 has totally corrupted my memory banks here
06:21
< RichyB>
Okay, so if you change the signature of :before a little bit,
06:21
< RichyB>
so that instead of getting handed just the context
06:22
< RichyB>
it instead gets handed the context (parameters) and a reference to the original method
06:22
<&McMartin>
Yeah, that'll let you block it.
06:22
< RichyB>
then it easily encompasses all three by choosing whether or not to call the original method, with what parameters, and what to do afterwards
06:22
<&McMartin>
Both before and after are implementable in terms of around - I'm *pretty* sure 'around' is all you nead.
06:22
<&McMartin>
*need
06:24
< RichyB>
Assuming that you have, monkey_patch :: (Method a b) -> Class -> Class
06:25
< RichyB>
where (Method a b) is a reified method, with the method name and body, and the type parameters "a" and "b" are the parameters and the results of the method
06:25
< RichyB>
and monkey_patch modifies the class and gives you back a new one with the method patched in...
06:26
< RichyB>
Ah, you should need to pass it the name of the method that you want replaced, and it should hand you a reference to the old method too.
06:26
<&McMartin>
Right.
06:26
<&McMartin>
IIRC, I did it with a pair of callouts - part before, part after, and 'should we actually do it' returned by the part before.
06:26
<&McMartin>
But that's just "what it compiles to"
06:27
< RichyB>
Anyway, before would be something like, before new_def class = monkey_patch "methodname" (\old_method -> new_def old_method) class
06:27
<&McMartin>
Pretty much
06:27
<&McMartin>
Note that what you're defining here is less PQL and more "all the advice-based aspect systems, also some of CLOS's features"
06:28
<&McMartin>
Though CLOS doesn't do classes per se because single dispatch is for wimps and communists
06:28
< RichyB>
Yes, I'm aware that I'm only thinking about :around in this case.
06:28
<&McMartin>
Right.
06:28
< RichyB>
CLOS does single dispatch just fine! It's merely a degenerate case of multiple dispatch.
06:28
<&McMartin>
Just clarifying: I'm not taking credit for :around.
06:28
<&McMartin>
I came up with a novel application of it, more or less.
06:29
<&McMartin>
Or, alternately, I designed a new system for tracking program flow and implemented it via :around, which, sadly, my target language didn't *have*
06:29
<&McMartin>
Thus, work
06:29
< RichyB>
McMartin, did I ever mention Zope Component Architecture to you? Some of the Zope people implemented multiple dispatch in Python.
06:29
<&McMartin>
Oh, it's easily doable.
06:29
<&McMartin>
*I* implemented multiple dispatch in Python, or at least a limited version of it, with a hybrid of Visitor pattern and reflection.
06:29
< RichyB>
Yes, but it's a major fuckup if it ever gets done twice in any one programming language.
06:30
<&McMartin>
Visitor is kind of The Way You Cheat.
06:30
<&McMartin>
Eh
06:30
<&McMartin>
I can't agree there, I'm afraid.
06:30
< RichyB>
Fortunately, the only people who seem to have ever wanted multi-dispatch in Python were the web application communities
06:30
<&McMartin>
Well, and the compilation ones.
06:30
< RichyB>
and they seem to all be pretty happy with ZCA.
06:30
< RichyB>
McMartin, eh? Libraries.
06:30
<&McMartin>
But Visitor pattern handles compilation cases well enough that people have forgotten that multiple dispatch solves it neatly and that it's what they're doing.
06:30
< RichyB>
How do you cope with two different libraries which disagree on how multiple-dispatch works without wanting to boil one of them in tar?
06:31
<&McMartin>
Hm, I wasn't clear.
06:31
<&McMartin>
If you're using it as a *language extension*, yes, you're in trouble.
06:31
<&McMartin>
If you're using it *internally as an implementation convenience*, the rest of the world shouldn't care, or, indeed, even notice.
06:32
< RichyB>
Yeah, no. The web app people are interested in using it as part of their public APIs to talk to one another.
06:32 * McMartin channels Adam Savage
06:32
<&McMartin>
Well, there's your problem.
06:32
< RichyB>
Hence why I'm extremely glad that ZCA seems to be the only one that anyone uses.
06:32
<&McMartin>
As soon as objects escape your world is pain.
06:33 * McMartin sends a squad of message-passers to fight the sinister forces of CORBA COMMANDER
06:33
< RichyB>
I'm not talking about distributed object brokering.
06:33
<&McMartin>
I know, but the principle still holds.
06:33
< RichyB>
I'm talking about cross-module calls within a single process that has multiple eggs loaded.
06:33
<&McMartin>
I consider Qt's biggest weakness to be "you have to deal with objects across DLL boundaries"
06:34
< RichyB>
Good luck writing Python software that never passes objects from one module into another. What?
06:34
<&McMartin>
Yeah, and Python has a dictated object model that never changes.
06:35
<&McMartin>
Qt requires you to have a library that was compiled with the exactly identical compiler and options as the program you're running *right now*.
06:35
<&McMartin>
GTK, on the other hand, uses a more basic API that's actually standard and gives no fucks what compiler you use.
06:35
< RichyB>
Damn! God no, nothing that bad.
06:35
< RichyB>
Well, it probably helps GTK that C never had name-mangling.
06:35
< RichyB>
Let alone *implementation-defined* name-mangling.
06:36
< RichyB>
(Seriously Bjarne you nutty eejit.)
06:36
<&McMartin>
Right, but IIRC GTK manages to also not depend on (also implementation defined) structure layout.
06:36
<&McMartin>
And - in the absence of some master control program like, uh, Zope itself, presumably, I would expect the world of protocol interoperation to work more like Qt, which is to say, to not do so.
06:36
< RichyB>
I don't think that that's actually possible. How do they get things to agree on the shapes of vtables?
06:37
<&McMartin>
They don't. GTK doesn't let you look into those objects, it only gives you handles to stuff it built itself, and only it gets to access it.
06:37
<&McMartin>
As long as one guy gets to define the universe, and everyone else plays along in that universe, you're basically fine.
06:37
< RichyB>
Oh! Right, that makes sense.
06:38
<&McMartin>
The GTK case - or, really, any two C++ libraries that share a well-defined C-based interface that only uses opaque pointers - is a case where parallel universes can talk
06:38
<&McMartin>
With Zope, I'd think that Zope would get to define the universe for all its eggs, and that you wouldn't try to write an egg for both Zope and some other alternate overlord.
06:38
< RichyB>
Does GObject have vtables and overloading and the like? I assume that there are C functions that you have to call to ask questions of the GObject layer about what's in its tables and so on?
06:38
<&McMartin>
Yeah, though I believe it doesn't have vtables per se because IIRC the semantics are more Smalltalk/Pythonic.
06:39
<&McMartin>
I haven't use GObject directly much.
06:39
< RichyB>
ZCA isn't really tied to Zope any more, it's pretty much just called that now.
06:40
< RichyB>
What you end up with is that ZCA is a single mechanism, and anything can either use it or leave it. It doesn't muck with the semantics of Python (much, it cheats a tiny with with some harmless sys.getframe(-1) to make some of the syntax nicer).
06:41 * McMartin nods
06:41
< RichyB>
So you can either make use of ZCA, and write: rs = responsestorage.interfaces.IResponseStorage(context);
06:41
< RichyB>
or, uh, not.
06:41
<&McMartin>
Hrm.
06:41
< RichyB>
The thing that's fortunate is that there's nothing really competing with ZCA
06:42
< RichyB>
so that you don't have two different mechanisms for multiple-dispatch
06:42
<&McMartin>
It occurs to me that for Python, the exported interface for multiple dispatch would be wildly trivial.
06:42
< RichyB>
and nobody ever demands that you write your adapters twice for both of them or bridge them or anything.
06:42
<&McMartin>
It would look like a call, and then somewhere inside __call__ it would pay attention to All The Types.
06:42
< RichyB>
Yes, that's pretty much what ZCA does.
06:43
< RichyB>
It's not entirely trivial because you seriously do not want to be using base isinstance() for that.
06:43
<&McMartin>
no, but you could use __type__, right?
06:43
< RichyB>
You really don't want to be using bare __type__ either for exactly the same reason.
06:43
< RichyB>
You can't arbitrarily change the __type__ of an object.
06:43
<&McMartin>
I guess I'm not familiar enough with Python's type system to be clear on that.
06:43
< RichyB>
Instead ZCA makes its notion of "types" orthogonal to Python's
06:43
<&McMartin>
Well, sure, but with multiple dispatch, you don't *want* to.
06:44
<&McMartin>
Oh.
06:44
<&McMartin>
Hrm.
06:44
< RichyB>
it has its own Interface specification
06:44
<&McMartin>
OK, I can see where mixing that up would get messy.
06:44
< RichyB>
and you can specify that any object provides any set of Interfaces.
06:44
<&McMartin>
I'm imagining something that looks a whole lot more like ML/Haskell's pattern-matching on Constructors.
06:44
< RichyB>
So I can do things like register a multi-adapter from (IFoo, IBar) -> IBaz
06:45
<&McMartin>
HRm.
06:45
<&McMartin>
What does this get you that duck typing does not?
06:45
<&McMartin>
Static enforcability?
06:45
< RichyB>
God no it's not even slightly static.
06:45
< RichyB>
and ask, getMultiAdapter((foo, bar), IBaz) and get that adapter back.
06:46
<&McMartin>
OK, I don't think I'm awake enough to fill in the gaps on this on my own right now.
06:46
<&McMartin>
I'm just getting random COM neurons firing, and that's not how this is rolling.
06:46
< RichyB>
because interfaces are separate from Python types, I can add them to arbitrarily add or remove them from individual objects at runtime
06:47
< RichyB>
so I can take an object x, which previously didn't provide IBar, and the ((IFoo, IBar) -> IBaz) adapter won't fire with it in the second position.
06:47
< RichyB>
I can call IBar.alsoProvidedBy(x), and suddenly it *does*.
06:49
< RichyB>
whereas there is no way of changing which class `x` happens to have been constructed by, that doesn't involve spiders.
06:50
< RichyB>
Guh.
06:50
< RichyB>
McMartin, the really short, simple version is that it's multiple dispatch based on interfaces that the objects provide rather than the objects' concrete types.
06:50
< RichyB>
and it adds its own "Interface" mechanism because there isn't an explicit one in Python already for it to be able to hook into.
06:51
< RichyB>
s/hook into/make use of/
06:52 * McMartin nods
06:53
<&McMartin>
I don't think I intuitive 'get' it yet - this doesn't seem like a 'multiple dispatch' system as I understand it and instead more like a Master API instead - but maybe that's because of unfamiliarity with the problem domain/use case
06:53
< RichyB>
I mean you could try to make one implicitly by inspecting the set of methods available but oh god that path leads to more spiders.
06:53
<&McMartin>
Well, I mean
06:53
<&McMartin>
It's already kind of trusting you on this, more or less
06:53
<&McMartin>
Presumably once you get handed this adapter you just duck type it up on your arguments
06:54 * McMartin goes, fires up Python 2.3.5 to see if certain features are in it.
06:54
< RichyB>
Inasmuch as everything is duck-typed in Python, but the Inteface that you asked the be given in return for the objects you submitted will have promises to implement various different methods in its docstrings.
06:55
< RichyB>
so the IBaz interface will document that IBaz objects should provide .x() and .y() and .z()
06:55 Derakon is now known as Derakon[AFK]
06:59
<&McMartin>
Right right.
06:59
<&McMartin>
OK.
06:59
<&McMartin>
Hm, yeah, Python doesn't carry arg types around, so quackery is harder to automate.
06:59
<&McMartin>
Also, boo.
07:00
<&McMartin>
My first feature that requires enhancing to a still ancient version of Python by which is still perfectly fine.
07:00 * Vornicus lost the thread of that last sentence.
07:00
<&McMartin>
I'm cleaning up Ophis's code in here.
07:01
<&McMartin>
Found a map from string to boolean, which would be equally well served as a set.
07:01
<&McMartin>
I'm pretty sure replacing it with one qualifies as "gratuitously breaking compatibility" even though it's only with 2.3.
07:02
<~Vornicus>
heh
07:02
<~Vornicus>
but still: "by which is.." and I lost what you were saying
07:02
<&McMartin>
That's because I blew it
07:03
< RichyB>
I think sets as a builtin were introduced in 2.4?
07:03
<&McMartin>
"but which is still perfectly fine [on its own]", by which I mean, I think not even Nuggan cares too much about maps to bool for stuff semantically equivalent to sets.
07:03
<&McMartin>
Yes indeed.
07:03
<&McMartin>
However, rewriting this code to use sets would up the minimum supported version to 2.4, and it seems like a silly thing to up for even if 2.4 is ancient.
07:03
<&McMartin>
Upping to 2.3 gave me new-style classes and optparse.
07:03
< RichyB>
For small enough sets, lists or tuples are fine anyway. Linear scans for membership of two or three element lists won't hurt.
07:04
<&McMartin>
This is for .require - I want to enforce that .required files are loaded only once so I keep a map of loaded files.
07:05
< Rhamphoryncus>
sets.Set() came before the builtin set. Slightly different API but largely the same
07:06
< Rhamphoryncus>
http://docs.python.org/library/sets.html
07:06
< Rhamphoryncus>
in 2.3
07:06
<&McMartin>
So it was
07:06
<&McMartin>
Still not worth the rewrite.
07:07
< Rhamphoryncus>
It's gone in 3.x but will be around through 2.x
07:07
<&McMartin>
Again - not writing from scratch here.
07:08
< Rhamphoryncus>
What kind of map are you talking about? If only to satisfy my curiosity :)
07:08
<&McMartin>
I'm updating the code of my old 6502 assembler for "final" publication, and to make it fit in better with grown-up toolchains.
07:08
<&McMartin>
One of the directives this assembler supports is .require, which is like .include but it guarantees that it will only be loaded once.
07:09
<&McMartin>
So there's a map from filenames to booleans to indicate whether or not you've been loaded.
07:09
<&McMartin>
This could easily been replaced with a set of filenames.
07:09
< Rhamphoryncus>
You can treat the dict as a set too. Just check that the key is present, ignore the value
07:09
<&McMartin>
That's precisely what it's doing now.
07:09
< Rhamphoryncus>
(None would be the convention there)
07:10
< RichyB>
Yes.
07:10
< RichyB>
i_miss_set = {}
07:10
<&McMartin>
If None is the convention, who am I to argue
07:10
< RichyB>
i_miss_set['foo.asm'] = 1
07:10
<&McMartin>
You've just written the 2.1 version of this code :)
07:10
< RichyB>
if i_miss_set.get('foo.asm', None): ...
07:10
<&McMartin>
I changed 1 to True.
07:11
<&McMartin>
also, if 'foo.asm' in i_miss_set
07:11
< Rhamphoryncus>
But yeah, it's pretty minor in the grand scheme of things. Not worth the effort unless you're doing the rewrite anyway
07:11
< RichyB>
McMartin, I have written more code that uses dicts to emulate sets than any sane person should've.
07:11
<&McMartin>
Thus: not worth breaking compatibility just for that!
07:11
<&McMartin>
Resolved.
07:11
< RichyB>
I don't want to talk about why, it's embarrassing. (But it's Zope's fault.)
07:12
< Rhamphoryncus>
McMartin: yeah, the "map from string to boolean" threw me off :)
07:12
< Rhamphoryncus>
red herring, etc
07:15 * Rhamphoryncus ponders the odd symmetry of Haskell's -- and ++
07:16
< Rhamphoryncus>
From a language design point of view. Obviously they're unrelated in semantics
07:19
< RichyB>
I cannot begin to fathom why they picked -- for a comment character.
07:19
< RichyB>
ML and Miranda lineage, I guess.
07:20
< Rhamphoryncus>
/ and /* have always been problematic, especially when you can define your own operators. # could work, although it is a little heavy
07:21
< Rhamphoryncus>
++ for joining lists I like. It avoids all the confusing overloading of + or |
07:21
< RichyB>
# looks really pretty as an operator too though.
07:22
< RichyB>
(GHC uses # all over to mean "this is a primitive thing", like for unboxed tuples.)
07:22
< Rhamphoryncus>
But since you've already decided to use ++ (you don't need nor want C's pre/postincrement operators) then -- is available as well. Thus my comment on symmetry
07:22
< RichyB>
(and scary types like Addr# and Word#.)
07:23
<~Vornicus>
/* and */ are really easy to type at least.
07:23
< RichyB>
I guess. There *are* probably Haskell DSLs that would have benefited from being able to use "--" as an infix operator.
07:23
< Rhamphoryncus>
hmm fair point
07:23 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has left #code ["Leaving"]
07:23 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
07:23
< RichyB>
Whoops, wrong button.
07:23
<~Vornicus>
I can't actually name an operator that I'd use those for
07:23
< Rhamphoryncus>
hmm fair point
07:23
< RichyB>
On my keyboard, /* and */ are a bit awful.
07:24
<~Vornicus>
And I know a metric fuckton of operators.
07:24
< Rhamphoryncus>
.. heh, I just went to type /* */ and mistimed a shift. I wouldn't call it trivial to type, no
07:25
<~Vornicus>
The keys are right next to each other on the numpad
07:25
< Rhamphoryncus>
You use the numpad?
07:25
< Rhamphoryncus>
I only use it for calculators
07:25
<~Vornicus>
I use the numpad relatively often, yes
07:26
< RichyB>
Oh fair point.
07:26
< RichyB>
At this juncture I am used to not having a numpad.
07:32 Vash [Vash@Nightstar-241cb5d4.wlfrct.sbcglobal.net] has quit [[NS] Quit: I lovecraft Vorn!]
07:33
<&McMartin>
Down to 141 pep8 complaints
07:44
<&McMartin>
74
07:54
<&McMartin>
8
07:58
<&McMartin>
0
07:58
<&McMartin>
Carlsbad:Ophis mmartin$ find . -name \*.py | xargs ../pep8/pep8.py
07:58
<&McMartin>
Carlsbad:Ophis mmartin$
07:58
<&McMartin>
2512 LOC.
07:59
<&McMartin>
Unit tests all still pass.
07:59
< RichyB>
w00t
08:00
< RichyB>
McMartin, stupid question, how do you implement "require" without the source code on Github actually containing the word "require" anywhere?
08:00
<&McMartin>
By the power of the King In Yellow.
08:00
< RichyB>
This is conundrum is screwing my yud.
08:00
<&McMartin>
Ophis.CorePragmas.pragmaRequire()
08:01
<&McMartin>
Pragmas are implemented by titlecasing them, prepending "pragma", and looking for them in the registered pragma modules.
08:01
< RichyB>
Curses! Foiled again by curse-sensitivity in grep expressions!
08:01 * RichyB would have gotten away with it if it weren't for those meddling bits.
08:01
<&McMartin>
A similar trick is used for defining which function is called in the relevant passes.
08:02
<&McMartin>
Anyway, rebasing my "modernization", will be pushing it soon
08:02
< RichyB>
Sweet.
08:02
<&McMartin>
Anyway, I only call hasattr() once
08:02
<&McMartin>
And getattr() twice ;-)
08:02
<&McMartin>
Therefore I need not worry about Sudden Elder God springing out of the fireplace.
08:04
< RichyB>
I don't really mind setattr() and getattr() too much.
08:04
< RichyB>
hasattr() is a bit scary.
08:05
< RichyB>
But I find the whole set completely inoffensive in things like spark.py which deliberately make a point of not looking too much like actual Python code, so wacky semantics aren't surprising.
08:05
<&McMartin>
The joke is that if you call hasattr() three times the King In Yellow appears and devours your soul
08:05
< RichyB>
http://svn.python.org/projects/python/trunk/Parser/spark.py
08:05 * RichyB facepalms.
08:05
< RichyB>
I should have gotten that
08:05
< RichyB>
I really should.
08:07
<&McMartin>
This is going to play merry hell with my pending pull requests.
08:08
<&McMartin>
OK, pull at will
08:08
<&McMartin>
Also, now to see if 2.3.5 still runs it >:D
08:09
<&McMartin>
Looks like it does, awesome
08:10
< RichyB>
That looks shockingly neater.
08:11
<&McMartin>
I was pretty bad about whitespace when building strings.
08:15
<&McMartin>
Also, this means I've pushed, and can switch off the damned laptop \o/
08:29
< Rhamphoryncus>
RichyB: grep -iIR is your friend
08:32
< RichyB>
Ah, I never used to use -I because it used to be way way slower than specifying the state machine explicitly with egrep for some reason
08:32
< RichyB>
Back in the day when I was grepping dozens of megabytes on a really slow laptop.
08:32
< RichyB>
"grep -I foo" is appreciably slower than "egrep [fF][oO][oO]" on a 100MHz Pentium 1 for some reason.
08:38
<&McMartin>
This is the most ridiculous commit message I've ever produced
08:38
<&McMartin>
https://github.com/michaelcmartin/Ophis/commit/14a37ca87919f5e2eb678d19dd94415ba 9c427df
08:41
< RichyB>
Offtopic
08:42
< RichyB>
is it just me or are StackExchange moderators acting like Wikipedia admins?
08:42
< RichyB>
I don't think I've seen a single question on programmers.stackexchange.com that the moderators didn't try to close as offtopic for some damn excuse.
08:43
< Namegduf>
Have you tried visiting http://programmers.stackexchange.com/
08:44
< Namegduf>
There's a list there
08:44
< Namegduf>
On that page
08:44
< Namegduf>
XD
08:48
< Rhamphoryncus>
McMartin: most of my commit messages are along the lines of "moo"
09:03
<&McMartin>
I meant more the thousands and thousands of lines of only whitespace changes
09:10
< RichyB>
Fuck yes.
09:10
< RichyB>
I think I just convinced some poor soul on freenode to give Prolog a try.
09:13
< RichyB>
McMartin, a friend of mine holds the opinion that it is perfectly valid to submit a patch that changes every single line of an existing project with the commit message being these five bytes: "PEP-8."
09:13
< RichyB>
McMartin, provided that the patch does not change *anything* except for formatting, of course. :)
09:14
< RichyB>
I'm slowly coming around to his way of thinking.
09:20
< Namegduf>
There's pros and cons.
09:20
< Namegduf>
Pro: Project is tidy.
09:20
< Namegduf>
Con: Comparing changes across that commit is no longer possible.
09:20
< Namegduf>
You've essentially segmented history as far as diffs are concerned.
09:20
< RichyB>
That's okay.
09:21
< RichyB>
"svn annotate" will thereafter correctly attribute credit.
09:21
< Namegduf>
Thereafter, everything is perfectly fine.
09:21
< Namegduf>
Also in commits entirely before, everything is fine.
09:21
< RichyB>
The previous people who submitted non-pep8 code were scumbags and deserve no credit.
09:21
< Namegduf>
So I'd say if you had to do it, do it as soon as possible, and don't make it necessary again.
09:21
< RichyB>
Hell, pep8-ing code should result in copyright assignment.
09:22
< Namegduf>
The alternative approach is "make use new standards next time you touch it".
09:22
< Namegduf>
I think I lean more towards the "get it out of the way in one huge break and don't let it happen again" point of view.
09:23
< Namegduf>
But I don't have good data on enough large codebases and projects to say whether I'm sure what is better.
09:23
< RichyB>
In practice I do the cleanup bit-by-bit.
09:34 Kindamoody [Kindamoody@Nightstar-6154a72a.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
09:42 Kindamoody|out [Kindamoody@Nightstar-6154a72a.tbcn.telia.com] has joined #code
09:42 mode/#code [+o Kindamoody|out] by ChanServ
09:42
< Rhamphoryncus>
If you do it in one batch you could con your VCS into thinking your name is "pep8", which will show up as such when you do annotate
09:43
< Rhamphoryncus>
Making it obvious when you have to go back further to find when a line was created
09:43 Kindamoody|out is now known as Kindamoody
10:00
<&McMartin>
Heh
10:00
<&McMartin>
Anyway, yeah
10:01
<&McMartin>
The "real" point of this project is in part to get (back?) into professional-quality code in Python so I have something I can directly point to for a portfolio.
10:09
< Rhamphoryncus>
oh hey, I got haskell to give me an exception rather than a type error XD
10:30 You're now known as TheWatcher
10:39
< RichyB>
Rhamphoryncus, you took the head of an empty list, didn't you?
10:48
< Rhamphoryncus>
last actually, but later duplicated with head and tail
10:48
< Rhamphoryncus>
And it was intentional, to see what would happen
10:56
< RichyB>
Eeeeveryone takes the head of an empty list.
10:56
< Rhamphoryncus>
I'd say it's a good sign
11:11 Attilla [Obsolete@Nightstar-7a57bd9d.as43234.net] has joined #code
11:27 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has quit [[NS] Quit: Leaving]
11:33 You're now known as TheWatcher[afk]
12:50 Noah [nbarr@Nightstar-f93cf469.pools.spcsdns.net] has quit [Ping timeout: 121 seconds]
13:03 AnnoDomini [annodomini@A08927.B4421D.B81A91.464BAB] has joined #code
13:03 mode/#code [+o AnnoDomini] by ChanServ
13:17 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
14:22 io|bed is now known as io
14:25 Noah [NSwebIRC@D82662.C541A8.D65203.7C054A] has joined #code
14:38 Noah [NSwebIRC@D82662.C541A8.D65203.7C054A] has quit [Ping timeout: 121 seconds]
14:46
< Rhamphoryncus>
... oh wow. Defining a type with attributes that are accessed by position, not name. That's really impressive :P
14:54 * Rhamphoryncus finds another tutorial as he has mentally thrown that one out the window
14:56
< gnolam>
?
14:58
< Rhamphoryncus>
It basically went "here's how you create your own type (and just to relate to something you know, types are a lot like tuples)"
14:58
< Rhamphoryncus>
And then went on with the details.. and on.. and on.
14:58
< Rhamphoryncus>
I kept waiting for the part where they'd get to attribute names
14:59
< Rhamphoryncus>
Eventually they had a link to even further down which gives an alternate way of doing them
15:00
< Rhamphoryncus>
I am sure that being nothing more than a renamed tuple is important to the generality of the type system, how it checks various invariants and whatnot, but that's their problem, not mine. I just want to get stuff done
15:04
< Rhamphoryncus>
Telling me that a language has a trick to accomplish absolutely basic behaviour does not endear me to it
15:04
< Rhamphoryncus>
and I just found this in another tutorial:
15:05
< Rhamphoryncus>
data Person = Person { firstName :: String
15:05
< Rhamphoryncus>
, lastName :: String
15:05
< Rhamphoryncus>
, age :: Int
15:05
< Rhamphoryncus>
, height :: Float
15:05
< Rhamphoryncus>
, phoneNumber :: String
15:05
< Rhamphoryncus>
, flavor :: String
15:05
< Rhamphoryncus>
} deriving (Show)
15:05
< Rhamphoryncus>
That abomination is exactly why most languages allow "redundant" commas at the end of such literals
15:05
< Namegduf>
Yes.
15:07
< froztbyte>
http://iotic.com/averia/
15:08
< Rhamphoryncus>
Gonna be much harder to learn now. I put myself into the frame of mind that I would appreciate the design decisions once I learned them in context, despite my biases. That just proved otherwise :(
15:09
< Namegduf>
Professional Quality(TM)
15:09
< froztbyte>
I don't understand
15:09
< froztbyte>
does haskell disallow commas at the end of String?
15:11
< Rhamphoryncus>
[3,4,5] is good. [3,4,5,] is a parse error
15:12
< Rhamphoryncus>
Which is fine for one-liners, but when you go multiline.. well that author obviously gets bitten a lot so they came up with an abomination to avoid it
15:15
< froztbyte>
why would you write [3,4,5,]?
15:15
< Rhamphoryncus>
See the example I pasted
15:15
< froztbyte>
in most of what I've dealt with, that's a syntax error
15:15
< froztbyte>
Rhamphoryncus: yes, I did, I still can't see a use for it
15:16
< Rhamphoryncus>
consider this in python:
15:16
< Rhamphoryncus>
x = [
15:16
< Rhamphoryncus>
32,
15:16
< Rhamphoryncus>
84,
15:16
< Rhamphoryncus>
12,
15:16
< Rhamphoryncus>
]
15:16
< Rhamphoryncus>
That would be a parse error because you have to remove the comma on the last line
15:17
< Rhamphoryncus>
Every time you change that list you need to catch yourself to make sure you readd and reremove the comma
15:17
< froztbyte>
yes, and? :)
15:17
< Rhamphoryncus>
It's stupid
15:17
< froztbyte>
no
15:17
< froztbyte>
it's not
15:17
< Rhamphoryncus>
Which is why the author has their style of putting the comma first
15:18
< froztbyte>
Rhamphoryncus: so if you're writing C++ or PHP and you forget to put a semi-colon in on some line....same issue
15:18
< froztbyte>
syntax validation tools exist to help catch this issue
15:18
< froztbyte>
and I can't see why worrying about it is a problem
15:19
< froztbyte>
Mr Computer will tell you that there's a small issue, you fix it, you go on
15:19
< Rhamphoryncus>
eh, I don't feel like arguing language design with you
15:20
< froztbyte>
I just don't think it's worth any real attention
15:20
< froztbyte>
err, rather
15:20
< froztbyte>
it's really not such a big thing
15:20
< froztbyte>
and comes down to stylistic preference
15:21
< froztbyte>
so while you may dislike it, I don't think you should let that stand in the way of further learning what you can from haskell :)
15:21
< Rhamphoryncus>
It's the secondary issue
15:22 AnnoDomini [annodomini@A08927.B4421D.B81A91.464BAB] has quit [[NS] Quit: Switch OS.]
15:22
< Rhamphoryncus>
The inferior way "records" are treated as the primary issue
15:24
< froztbyte>
well, the haskell community is pretty open on most things
15:24
< froztbyte>
so I'm sure if you have it out with them about what you think might be better, they'd be receptive to discussion
15:24
< Rhamphoryncus>
I doubt my ranting about how stupid the language design is will get a positive response
15:28
< Rhamphoryncus>
And yes, I know that's not the way to approach it. Convincing someone that their decision is stupid, without calling them stupid or making them feel stupid? That's an art form, a massively important skill, and one I don't have
15:28
< froztbyte>
eh, even so
15:28
< froztbyte>
a post to the list going "I don't think this is The Best Thing, and here's why <reasons here>" could be useful
15:30
< Rhamphoryncus>
I have negative opinions of functional languages in general. Not the style; pure functions/types, even as the default, are incredibly useful. It's the whole mindset, trying to make something mathematically Awesome rather than a crude, practical tool refined by carefully watching how people use it
15:31
< froztbyte>
interesting anecdote on that
15:32
< froztbyte>
the haskell people and the math people often argue about how not-quite-on-the-mark haskell is as far as pure math goes :P
15:33
< Rhamphoryncus>
Yeah, that's like one person with purple hair saying another's purple hair isn't quite purple enough
15:34
< Rhamphoryncus>
It's kind of a hallmark of functional languages: they're made by math geeks for math geeks
15:35
< Rhamphoryncus>
It's putting the solution before the problem
15:35
< Rhamphoryncus>
The other extreme is PHP: just a giant hack to get something done, without ever stepping back to look at how you're doing it
16:04
< Rhamphoryncus>
Hrm.. so I'm back down to C++ or Python. Python is a clear fail in the long run, but is it worth prototyping in python only to almost entirely rewrite in C++ once it hits a certain stage of development?
16:08
< celticminstrel>
Um, Python does allow the redundant trailing commas, by the way.
16:08
< celticminstrel>
Your example isn't a parse error.
16:09
< Rhamphoryncus>
I meant the equivalent in haskell is a parse error
16:09
< celticminstrel>
Ah.
16:09
< Rhamphoryncus>
I'm still not comfortable enough to do an example directly in haskell without butchering it
16:21
< gnolam>
... you were planning on writing a game in Haskell? o_O
16:22
< Rhamphoryncus>
No, I was planning on writing a game in C++ and the pain of getting templates right made me pragmatic enough to put aside my biases and start learning haskell
16:23
< Rhamphoryncus>
The ability to write a game in it.. well, I would just *assume* it's capable, and not asking falls under "put aside my biases"
16:26
< celticminstrel>
It's working for me.
16:28
< Rhamphoryncus>
What is?
16:28
< celticminstrel>
C++?
16:28
< Rhamphoryncus>
oh
16:28
< Rhamphoryncus>
That's my best long term option, yes
16:29 * celticminstrel is also writing a game in C++ with SDL.
16:29
< Rhamphoryncus>
Learning how to get templates to work sucks, but I'll eventually get through it
16:29
< celticminstrel>
Maybe I can help a bit?
16:30
< gnolam>
You also don't /have/ to make heavy use of templates.
16:30
< celticminstrel>
Indeed. I'm only using them a little.
16:31
< celticminstrel>
Searching for the keyword gives only 14 results. Though some of those results are themselves heavily used in the code.
16:32
< Rhamphoryncus>
The issue isn't in using them a lot. It's that the compiler errors are useless, so I have to stare and experiment a lot or spend 10 minutes cutting it down to a minimal example for every little error
16:32
< Rhamphoryncus>
Most of that I won't have to repeat because I learn what to associate the errors with
16:54
< celticminstrel>
Ahh.
16:54
< celticminstrel>
I found that too until I started using clang... though the errors are still sometimes not very useful, they're generally more useful than they were with GCC.
16:55
< celticminstrel>
I spent awhile trying to hunt down a bug about a template parameter being invalid.
16:55
< celticminstrel>
It turned out that it was invalid because there was a variable in scope with the same name as the type.
16:56
< Rhamphoryncus>
yeah
16:56
< Rhamphoryncus>
It's good for simple stuff, mostly C features
16:56
< Rhamphoryncus>
templates are well beyond
16:56
< celticminstrel>
Clang is also a bit more strict with some things though.
16:57
< celticminstrel>
I think that cause a few minor problems when I initially switched.
16:57
< celticminstrel>
^caused
16:57 * Rhamphoryncus nods
17:07 Derakon[AFK] is now known as Derakon
17:19 * Tarinaky blinks.
17:19
< Tarinaky>
Why is Eclipse underlining a line as an error when it runs fine.
17:23
<~Vornicus>
what's it say when you point at it?
17:24
<~Vornicus>
or possibly right click it?
17:26 You're now known as TheWatcher
17:41
< Tarinaky>
ARGH
17:41
< Tarinaky>
texture_cache.button("None", 12, pygame.Rect(174,64), color.COLORS["Black"], color.COLORS["Blue"], "End Turn"))
17:41
< Tarinaky>
Whoops
17:41
< Tarinaky>
Stupid copy paste
17:41
< Tarinaky>
pygame.Rect(174,64),
17:41
< Tarinaky>
TypeError: Argument must be rect style object
17:41
< Tarinaky>
IT IS A RECT!
17:47 Kindamoody is now known as Kindamoody|afk
17:49
< Tarinaky>
Who wrote this mess of horrible code...
17:49
< Tarinaky>
Oh wait, I did.
17:49
< Tarinaky>
-.-
17:55 * TheWatcher patpat
17:59
< celticminstrel>
Hm, when I rewrite the level reading code I could use the new regex library...
18:43 Vash [Vash@Nightstar-241cb5d4.wlfrct.sbcglobal.net] has joined #code
18:43 mode/#code [+o Vash] by ChanServ
18:54 rms is now known as Anna
19:01 AnnoDomini [annodomini@A08927.B4421D.B81A91.464BAB] has joined #code
19:01 mode/#code [+o AnnoDomini] by ChanServ
19:01 AnnoDomini is now known as Jasever
19:09 EvilDarkLord is now known as Aeron
19:09 Kindamoody|afk is now known as Kindamoody[zZz]
20:05 Attilla [Obsolete@Nightstar-7a57bd9d.as43234.net] has quit [Ping timeout: 121 seconds]
20:08 Attilla [Obsolete@Nightstar-7a57bd9d.as43234.net] has joined #code
20:13 Attilla_ [Obsolete@Nightstar-00137a38.as43234.net] has joined #code
20:13 Attilla [Obsolete@Nightstar-7a57bd9d.as43234.net] has quit [NickServ (GHOST command used by Attilla_)]
20:13 Attilla_ is now known as Attilla
20:42 Attilla_ [Obsolete@Nightstar-00137a38.as43234.net] has joined #code
20:43 Attilla [Obsolete@Nightstar-00137a38.as43234.net] has quit [NickServ (GHOST command used by Attilla_)]
20:43 Attilla_ is now known as Attilla
20:44 Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has quit [Client exited]
22:24 Noah [nbarr@Nightstar-8d8cc7d8.pools.spcsdns.net] has joined #code
23:01 Aeron is now known as EvilDarkLord
23:01 Jasever is now known as AnnoDomini
23:02 Anna is now known as rms
23:06 ShellNinja [abudhabi@Nightstar-300ad1ff.adsl.inetia.pl] has quit [Operation timed out]
23:11 maoranma [nbarr@Nightstar-8f3ee3b6.pools.spcsdns.net] has joined #code
23:12 Noah [nbarr@Nightstar-8d8cc7d8.pools.spcsdns.net] has quit [NickServ (GHOST command used by maoranma)]
23:12 maoranma is now known as Noah
23:25 AnnoDomini [annodomini@A08927.B4421D.B81A91.464BAB] has quit [Ping timeout: 121 seconds]
23:27 ShellNinja [abudhabi@Nightstar-2ad06044.adsl.inetia.pl] has joined #code
23:47 You're now known as TheWatcher[T-2]
23:53 You're now known as TheWatcher[zZzZ]
--- Log closed Sun Jun 03 00:00:12 2012
code logs -> 2012 -> Sat, 02 Jun 2012< code.20120601.log - code.20120603.log >

[ Latest log file ]