Instead of "static type advocate", maybe we should call them "metaprogramming deniers". Then there are the metaprogramming deniers who don't even advocate static types. Morons.
-
Show this thread
-
I’ve been thinking about this. Except for code instrumentation and trivial boilerplate generation I’ve never missed macros. Can you come up with a problem that macros solve that isn’t solved by (maybe free monadic, but also plain old) ADT DSLs + interpreters?
2 replies 0 retweets 0 likes -
Replying to @pkamenarsky @msimoni
Interpreters? Macros are compilers. Incrementally defined. Extensible. With no syntactic overhead. But yeah, if you can use interpreters, one will suffice to solve all issues: a Lisp interpreter. (If you can't, or simply don't, your effective language isn't Turing-complete.)
1 reply 0 retweets 0 likes -
Yeah, I know what macros are :) I was asking for a concrete example when a ADT DSL wouldn’t suffice, because frankly I can’t come up with one (except for the aforementioned two cases).
3 replies 0 retweets 0 likes -
Replying to @pkamenarsky @msimoni
For a cool use of macros, see my ILC 2012 paper where I automatically transform data structure libraries between pure and stateful styles and object oriented and type class styles.
2 replies 0 retweets 1 like -
That’s what I’m looking for, thanks!
1 reply 0 retweets 0 likes -
Replying to @pkamenarsky @msimoni
You'll tell me "it's type-directed code transformation!" — Yes, precisely. But also type transformation. Which requires types as first-class values as manipulated by macros.
1 reply 0 retweets 0 likes -
I haven’t read the paper so can’t comment yet, but “types as first class values” sound like type-level functions/type families/dependent types to me?
2 replies 0 retweets 0 likes -
Replying to @pkamenarsky @msimoni
Dependent types can do it — but then all your coding must be done in the _internal_ model for the metalevel transformations to be possible, the semantics being reflected onto the ambient system only at the very last minute for evaluation.
1 reply 0 retweets 0 likes -
But you have to code against a concrete interface, be it a pure or mutable one, right? In that case, can’t you generically transform the interface *only* and pass it to your interface-using function instead of transforming the function itself?
1 reply 0 retweets 0 likes
If I understand what you mean: a- yes, a given piece of code is written with its inputs and outputs each following a specific style (pure/stateful, OO/typeclass). b- well, that's what I do: build a new interface that wraps an adapter around each of the original functions.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!