Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Bottom-Up vs Top-Down Macroexpansion

Name: Anonymous 2014-06-20 6:51

What if we macroexpand depth-first? Don't you think that macros get more powerful?

Name: Anonymous 2014-06-20 8:07

top down
bottom up
that's the way
we like to metaprogram

Name: Anonymous 2014-06-22 11:59

How would you implement this? You can't know the output of a ``real macro'' without running the macroexpansion function on the body. Of course, if you're talking about Scheme-like macros, it would be feasible.

Care to give a few examples of how it would be more powerful?

Name: Anonymous 2014-06-22 12:20

I'm top-down and bottom-up, anus ready to work

Name: Anonymous 2014-06-22 14:13

>>3
It's powerful the same way exploratory programming is more powerful. Bottom-up vs top-down. It's better and way more powerful.

Name: Anonymous 2014-06-22 18:57

How about type-safe macroexpansion for starters?

Name: Anonymous 2014-06-22 19:51

>>6
type-safe
Shalom!

Name: Anonymous 2014-06-22 20:07

>>6
Type-Safe, Generative, Binding Macros in MacroML
www.cs.indiana.edu/~sabry/papers/macroml.pdf

Name: Anonymous 2014-06-22 23:28

>>6,8

Why bother with typesafe macro expansion if any unsafe expansions are going to be checked by the next compiler phase? I'm genuinely curious.

Name: Anonymous 2014-06-23 0:35

>>9
You wouldn't ask that question if you'd ever used Lisp. You've got a stack of macro calling macro calling macro, and when the resulting code doesn't compile, you need to know which of that stack of macros stinked up the room.

Name: Anonymous 2014-06-23 1:16

>>10
I would. The paper in >>8 claims unchecked macros are at odds with static checking, but it seems to go undefended. I get the feeling that among static type systems this is only useful in the weaker ones. But then the paper is talking about ML and Haskell. So how is it beneficial to ML and Haskell?

Name: Anonymous 2014-06-23 3:42

>>10

Racket solves this by using "phases"

Name: Anonymous 2014-06-23 21:38

Top down is more powerful. In the outer macro you can do whatever traversal you like into the nested code. Even calling macroexpand on it, and then changing it after that. So you can implement bottom up macros if you want to.

>>9
That's a nice idea but it's hard to make sense of for vanilla lisp which doesn't enforce static types. You can write a function that takes source of some language in sexp form as an input and outputs a registry of variables tied to scopes with static type information.

>>12
Racket a shit.

Name: Anonymous 2014-06-23 22:59

>>13
Note the *if*, it rules out anything that doesn't enforce static types.

Name: Anonymous 2014-06-24 15:58

>>13
it's hard to make sense of for vanilla lisp which doesn't enforce static types
Why would anyone care about a language which doesn't enforce static types?

Name: Anonymous 2014-06-24 16:42

Judging from success of JavaScript, people don't like static typing.

Name: Anonymous 2014-06-24 16:44

>>16
If by ``people'' you mean drooling retards, then yes, people love anal-prolapse typing.

Name: Anonymous 2014-06-24 16:46

>>16
Javascript is used mostly as a compilation target nowadays, lol. No one actually writes in it except retard undergrads and sweatshop Indian webcoders.

Name: Anonymous 2014-06-24 18:46

>>18
Nobody with half a brain targets or writes or does anything with Javashit.

Name: Anonymous 2014-06-24 18:59

>>19
Obviously. I doubt it's even possible to write "hello world" with only half a brain. People with a full brain, however, do often compile code written in decent languages like Haskal or Typescript to Javashit.

Name: Anonymous 2014-06-24 20:25

>>17

implying neurotypicals are "drooling retards"

Name: Anonymous 2014-06-24 21:25

>>14
There is only one type, BIT, everything else is a frivolity.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List