code logs -> 2007 -> Fri, 07 Dec 2007< code.20071206.log - code.20071208.log >
--- Log opened Fri Dec 07 00:00:31 2007
00:45 You're now known as TheWatcher[T-2]
00:48 You're now known as TheWatcher[zZzZ]
01:16 Dieter is now known as gneckpain
02:04 ReivZzz is now known as Reiver
02:15 gneckpain [lenin@85.8.5.ns-20483] has quit [Quit: Z?]
03:37 Vornicus is now known as Vornicus-Latens
05:33 ChalcyOut [~Chalcedon@Nightstar-9233.ue.woosh.co.nz] has quit [Quit: Gone]
05:52 Forj [~Forj@Nightstar-9233.ue.woosh.co.nz] has joined #code
05:52 mode/#code [+o Forj] by ChanServ
05:58 Doctor_Nick [~nick@68.42.57.ns-4111] has joined #code
05:59 Forj [~Forj@Nightstar-9233.ue.woosh.co.nz] has quit [Quit: Gone]
07:06 You're now known as TheWatcher
07:17
<@ToxicFrog>
<ToxicFrog> The problem with implementing Lisp macros in languages that aren't Lisp is that in most languages, you aren't writing directly in ASTs.
07:17
<@ToxicFrog>
<ToxicFrog> And the problem with thinking about this at 2am is that you inevitably come to the conclusion that you should be writing in ASTs.
07:44
<@ToxicFrog>
Hmm
07:44
<@ToxicFrog>
I think I've finally cemented in my mind why implementing lisp macros in other language is, truly, such a pain in the ass
07:45
<@ToxicFrog>
In lisp, code is lists, and lists are ASTs, and they're all one
07:45
<@ToxicFrog>
So you define a macro simply by giving a list consisting of an AST node name and a set of bindings for its leaves, and another list consisting of the actual AST to replace that with, and it's a simple transform for the parser to apply.
07:46
<@ToxicFrog>
Most languages, however, have rather more complex grammars, so you can't simply define new AST node types on the fly - you have to tell them where it fits in the grammar, and whether it's a statement or an expression or something else (if the language differentiates), and so forth
07:47
<@ToxicFrog>
Which, in turn, makes the macro interface more complicated.
07:47
<@ToxicFrog>
And now that I know what the problem is, I can set about solving it.
07:50
<@ToxicFrog>
But first, (macro (slep) `(SLEP))
08:16 You're now known as TheWatcher[afk]
10:14 You're now known as TheWatcher[d00m]
12:24 You're now known as TheWatcher
13:18 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
13:18 mode/#code [+o gnolam] by ChanServ
13:37 You're now known as TheWatcher[afk]
13:44 You're now known as TheWatcher
14:30 Kyrre [~Z@87.72.35.ns-26506] has quit [Connection reset by peer]
14:30
<@AnnoDomini>
"In spite of the team's expertise, they didn't use any source control. Instead, the team invented their own naming conventions to keep things straight; filename.asp would sit right next to filename_new.asp, filename_new2.asp, filename_2asp.asp, filename_prod.asp, filename_prod2.asp, filename_final.asp, and filename_finalactual.asp." <- Sounds like KarmaBot's source code.
14:30 Netsplit DeepThought.NY.US.Nightstar.Net <-> Troika.TX.US.Nightstar.Net quits: @Pi, EvilDarkLord, Doctor_Nick, @Vornicus-Latens, @jerith, @Reiver, @Chalain
14:31 Kyrre [~Z@87.72.35.ns-26506] has joined #Code
14:35 * AnnoDomini laughs at the reader survey at The Daily WTf.
14:35
<@AnnoDomini>
*WTF
14:35
<@AnnoDomini>
"Please leave this question blank for quality control purposes."
14:36
<@AnnoDomini>
There's a dozen or so blank fields. And two not blank - "not blank" and "file not found".
14:38
<@AnnoDomini>
... And another question has a 'invalid reply' error prompt.
14:42 Kyrre [~Z@87.72.35.ns-26506] has quit [Connection reset by peer]
14:43 Kyrre [~Z@87.72.35.ns-26506] has joined #Code
14:54
<@gnolam>
That reminds me.
14:54
<@gnolam>
http://www.lysator.liu.se/~gnolam/pictures/accessibility.jpg
14:54
<@AnnoDomini>
Oh lord.
14:55
<@gnolam>
I laughed so hard I couldn't breathe when I discovered that one.
15:39 You're now known as TheWatcher[afk]
15:45 jerith [~jerith@IRCop.Nightstar.Net] has joined #Code
15:45 Pi [~sysop@Nightstar-24414.hsd1.wa.comcast.net] has joined #Code
15:45 mode/#code [+o jerith] by ChanServ
15:45 Chalain [~chalain@Admin.Nightstar.Net] has joined #Code
15:45 mode/#code [+o Pi] by ChanServ
15:45 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
15:45 mode/#code [+o Chalain] by ChanServ
15:45 EvilDarkLord [~jjlehto3@130.233.228.ns-13022] has joined #Code
15:45 Vornicus-Latens [~vorn@76.233.6.ns-2929] has joined #Code
15:45 Doctor_Nick [~nick@68.42.57.ns-4111] has joined #Code
15:45 ServerMode/#Code [+o Vornicus-Latens] by Troika.TX.US.Nightstar.Net
15:45 mode/#code [+o Reiver] by ChanServ
15:45 mode/#code [-o Vornicus-Latens] by ChanServ
15:50 * gnolam reposts http://www.lysator.liu.se/~gnolam/pictures/accessibility.jpg .
16:02
< Attilla>
What?
16:02
< Vornicus-Latens>
...is that /inside/ the glass?
16:03
<@AnnoDomini>
Yes.
16:03
<@AnnoDomini>
Yes, it is.
16:03
< Attilla>
How helpful.
16:03
< Attilla>
For blind ghosts
16:18 Xiphias [Ameroth@Nightstar-25243.dsl.in-addr.zen.co.uk] has joined #code
16:24 Vornicus-Latens is now known as Vornicus
17:23 * ToxicFrog fiddles with macro specifications
17:24
<@ToxicFrog>
I bet I could rewrite the metalua AST syntax to be more lispy.
17:25
<@jerith>
lispy++
17:26
<@ToxicFrog>
At the moment it can only be described as ugly.
17:27 Xiphias [Ameroth@Nightstar-25243.dsl.in-addr.zen.co.uk] has quit [Quit: I was never gone]
17:32
<@ToxicFrog>
Hmm. So.
17:32
<@jerith>
So?
17:32
<@ToxicFrog>
+{ ... }+ is the AST representing the contained code. -{ ... }- lets you splice in additional ASTs or lists thereof.
17:33
<@ToxicFrog>
This is basically equivalent to Scheme's `(...) and ,(...)
17:33
<@jerith>
I don't know enough Scheme yet. :-/
17:33
<@ToxicFrog>
Well. You know how ' is the literalizer?
17:33 * jerith nods.
17:33
<@ToxicFrog>
Ie, '(+ 1 2) is the AST, not the result of the operation?
17:34
<@ToxicFrog>
` is similar, except you can poke holes in it:
17:34
<@ToxicFrog>
(def foo '(* 2 2))
17:34
<@ToxicFrog>
`(+ ,foo 2)
17:35
<@ToxicFrog>
=> '(+ (* 2 2) 2)
17:35
<@jerith>
Cool.
17:35
<@ToxicFrog>
You use this inside macros to construct result ASTs that include the leaves of the macro.
17:36
<@ToxicFrog>
Eg: (macro (double bar) `(+ ,bar ,bar))
17:37
<@ToxicFrog>
Although that should probably return `(* ,bar 2) instead to avoid evaluating bar twice, but whatever.
17:37
<@ToxicFrog>
Anyways. The idea with +{ ... }+ and -{ ... }- is similar.
17:38
<@ToxicFrog>
The problem is that in Lua, you aren't writing direct ASTs, so now we have to introduce the AST as a data type.
17:38
<@ToxicFrog>
The type of an upshift is an AST, and the contents of a splice must evaluate to an AST (or list thereof)
17:39
<@ToxicFrog>
So: a = 2; foo = +{ 2 * -{a}- }+ is illegal
17:39
<@ToxicFrog>
But: a = +{ 2 }+; foo = +{ 2 * -{a}- }+ is not.
17:40 * jerith ponders this.
17:40
<@ToxicFrog>
Here's where it gets ugly.
17:40
<@ToxicFrog>
In Lisp, all is ASTs.
17:40
<@ToxicFrog>
The above (macro) basically defines a new AST node type, 'double'
17:41
<@ToxicFrog>
In Lua, however, you need to actually parse source and transform it into an AST.
17:41
<@ToxicFrog>
Which means, among other things, it needs to know which parse node to start at.
17:41
<@ToxicFrog>
Ie, 2+2 is an expression, but not a statement
17:41
<@ToxicFrog>
do return 1 end is a statement, but not an expression
17:41
<@ToxicFrog>
foo(6) is both.
17:42 * jerith nods.
17:42
< Vornicus>
Color me confused, but I don't see what the scheme setup gets you (in scheme).
17:42
< Vornicus>
(it's pretty obvious in Lua)
17:42
<@ToxicFrog>
...compile-time macros of arbitrary complexity
17:42
<@ToxicFrog>
Take the above example
17:43
<@ToxicFrog>
This means that when you write (double 2) in your code, it gets parsed to (+ 2 2 )
17:43
<@ToxicFrog>
Which is a simple substitution within the capabilities even of, say, cpp.
17:43
<@ToxicFrog>
But this extends to arbitrarily complicated things.
17:44
< Vornicus>
right, right, but what I'm saying is, in Scheme, this just seems like something you could do with regular functions.
17:44
<@ToxicFrog>
(macro (trycatch try-block catch-block) `(...some wacky thing probably using call/cc that I can't write off the top of my head goes here...)
17:45
<@ToxicFrog>
The examples I've been giving, yes
17:45
<@ToxicFrog>
Although there are advantages to having stuff transformed at compile time, especially since Scheme doesn't do lazy evaluation in function arguments
17:45
<@ToxicFrog>
So for some stuff, like writing your own short-circuit operators, macros are essential
17:46
<@ToxicFrog>
Mostly, I see it used to change the language in scary ways that I don't fully understand
17:46
<@ToxicFrog>
Like one that replaced that ( with indent and ) with exdent a la python.
18:00
<@ToxicFrog>
Anyways. So we much now expect the upshift syntax to indicate what node to start with.
18:00
<@ToxicFrog>
Err, extend.
18:01
<@ToxicFrog>
Metalua uses +{node: ... }+
18:01
<@ToxicFrog>
which strikes me as ugly, but I can't come up with anything better./
18:11
<@ToxicFrog>
Anyone have a better idea?
18:11 * Vornicus doesn't knwo.
18:12
< Vornicus>
You're the low-level guru in the house. I just make the pretty algorithms.
18:13
<@ToxicFrog>
What I want is advice in making things pretty!
18:14
< Vornicus>
Heh
18:15
< Vornicus>
Do some sample code and we'll see what happens.
18:29 Forj [~Forj@203.211.125.ns-20845] has joined #code
18:29 mode/#code [+o Forj] by ChanServ
18:51
<@ToxicFrog>
Hmm. I need some way to express both the type and the name of a binding in the macro.
19:02 You're now known as TheWatcher
19:16
<@ToxicFrog>
Vornicus: http://lua.pastebin.com/m682440cd
19:20
< Vornicus>
hrm
19:28
<@ToxicFrog>
http://lua.pastebin.com/mce069e4 -- using raw ASTs
19:31
< Vornicus>
What's gensym() do?
19:33
<@ToxicFrog>
Creates a guaranteed-unique symbol.
19:33
<@ToxicFrog>
So you don't end up creating macros that shadow other symbols.
19:34
< Vornicus>
OK.
19:34
<@ToxicFrog>
it might return, say, `name{ "gensym8010dd2096a944f98e91921236130232" }, although probably not soemthing that long
19:36
< Vornicus>
Idunno. I don't see any improvements that can be made.
19:46 Vornotron [~vorn@64.252.102.ns-21668] has joined #code
19:48 Vornicus [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout]
19:48 Vornotron is now known as Vornicus
19:48
< Doctor_Nick>
ADA IS THE BEST PROGRAMMING LANGUAGE EVER
19:49
<@AnnoDomini>
Bah. BASIC for the C64.
19:50
< Doctor_Nick>
today is opposite day
19:50
<@AnnoDomini>
No, it's not.
19:50
< Doctor_Nick>
you are not right
19:50
<@AnnoDomini>
Yes, I am.
19:51
< Doctor_Nick>
yes, you aren't
19:51 * Vornicus throws you both off the earth.
19:51
< Doctor_Nick>
so it WAS flat
19:56
<@ToxicFrog>
killall -SIGSTOP Doctor_Nick AnnoDomini
19:58
<@AnnoDomini>
((-SIGSTOP?))
19:59
<@ToxicFrog>
(it's like SIGCONT, only the converse)
19:59
<@AnnoDomini>
((Okay. If you say so. ;.))
19:59
<@ToxicFrog>
(transparently suspends execution of the process until it's CONT'd)
20:02
<@AnnoDomini>
((I see.))
20:03
<@ToxicFrog>
You've never used that?
20:03
<@AnnoDomini>
Used it where?
20:04
<@ToxicFrog>
...on any *nix system?
20:04
<@ToxicFrog>
When you need to temporarily put a program on ice without killing it outright
20:05
<@AnnoDomini>
I need to roll a DC 20 Int check each time I want to log in to a *nix system, much less use anything within.
20:06
< Doctor_Nick>
root
20:06
< Doctor_Nick>
:root
20:06
< Doctor_Nick>
try that
20:07
<@ToxicFrog>
...
20:08
< Doctor_Nick>
or password1
20:08
<@AnnoDomini>
Or "god"?\
20:08
<@AnnoDomini>
-\
20:08
< Doctor_Nick>
right
20:12 You're now known as TheWatcher[afk]
20:12 * ToxicFrog blinks at AnnoDomini
20:12
<@AnnoDomini>
Yes?
20:16
<@ToxicFrog>
It's not that hard!
20:22
<@AnnoDomini>
Once you know how to do it, nothing is hard.
20:22
<@AnnoDomini>
The difficulty lies in getting to know how to do it.
20:24
<@ToxicFrog>
I tend to find logging in pretty intuitive.
20:27
<@AnnoDomini>
I was exaggerating.
20:28
< Doctor_Nick>
ill exaggerate you!
20:28 * AnnoDomini will Doctor_Nick's head to implode.
20:29
<@AnnoDomini>
*wills
20:29
< Doctor_Nick>
sorry, i've already reached maximum density
20:29
< Doctor_Nick>
blammo
20:30 * AnnoDomini teleports somewhere safe from Doctor_Nick's head-singularity.
20:47
<@gnolam>
You've got headpigeons. Get to the nurse before they spread to the other children.
21:00 You're now known as TheWatcher
21:11 AnnoDomini [~farkoff@Nightstar-7034.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
21:17
<@McMartin>
Up is down! Top is Bottom! Type Inference is Dataflow Analysis!
21:17
<@jerith>
And minidbug breaks your code?
21:18 AnnoDomini [AnnoDomini@Nightstar-29453.neoplus.adsl.tpnet.pl] has joined #Code
21:18 mode/#code [+o AnnoDomini] by ChanServ
22:32 AnnoDomini [AnnoDomini@Nightstar-29453.neoplus.adsl.tpnet.pl] has quit [Quit: <>There is no phenotype</>]
22:35 AnnoDomini [AnnoDomini@Nightstar-29453.neoplus.adsl.tpnet.pl] has joined #Code
22:35 mode/#code [+o AnnoDomini] by ChanServ
--- Log closed Sat Dec 08 00:00:38 2007
code logs -> 2007 -> Fri, 07 Dec 2007< code.20071206.log - code.20071208.log >