--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-languag...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
It's nice to see an explicit discussion about making macros nicer!
Macros are a killer feature in Scala these days; I expect they will
become a must-have feature in languages once more designers see how
well they work in Scala.
I agree with every point you make - particularly about macros being a killer feature - with the exception of the last one. Having to split projects into two causes me a LOT of headaches. As a user, I'd rather the compiler handled the complexities of macro generation rather than - an extra keyword seems like a small price to pay! ;-)
As a producer of libraries, additional modularization is some up front work, but it nearly always has long term benefits.
Lastly, even with maven you could do this in one project if the macros are internal (not part of your api). Treat macros like code generators and leverage the generate-sources phase.
If your users consume your code via maven, additional dependencies can be made invisible. Their pom does not change. Transitive dependencies are easy.
* As a user, if the macros are not for me to use in my runtime, I don't want them bundled in the jar. Therefore they should be a separate maven artifact anyway.
* As a user, if the macros are to be used by my compile but not my users runtime, I don't want them bundled in the same artifact either.
This is akin to test artifacts from the dependency and bundling perspective in several ways. Maven does not have a code gen step that is as sophisticated as the test step, unfortunately. It does have one however.
Separating peojects with macros is the right thing to do. Your users will appreciate the modularization. Projects that bundle everything into one jar are oftwn my worst enemies as a consumer of many libraries.
Hi Scott,The macros I'm planning to implement are intended for both internal and external use - it makes a lot of sense for them to be part of the same jar file, IMHO.However, if you refer to my post above, you'll see that it's possible to have some macros that utilize other macros, which in turn could utilize yet other macros - so are you recommending a whole tree of projects/jar files? As I pointed out, that's a lot of effort on my part for very little perceived reward. Furthermore, since these macros can utilize regular elements within the libraries, there's potentially a huge code management issue - which project/jar do I put class X into (given that it might or might not be referenced from zero or more macros)? Finally, some of the code and macros logically belong in the same package - but if they're spread across different jar files, then I can't lock them and prevent user code from adding itself to those packages and by-passing element access protections (I've worked hard to make the user interface as simple as possible and don't want to lose all of that).
Hi Scott,The macros I'm planning to implement are intended for both internal and external use - it makes a lot of sense for them to be part of the same jar file, IMHO.
However, if you refer to my post above, you'll see that it's possible to have some macros that utilize other macros, which in turn could utilize yet other macros - so are you recommending a whole tree of projects/jar files?
As I pointed out, that's a lot of effort on my part for very little perceived reward.
Furthermore, since these macros can utilize regular elements within the libraries, there's potentially a huge code management issue - which project/jar do I put class X into (given that it might or might not be referenced from zero or more macros)? Finally, some of the code and macros logically belong in the same package - but if they're spread across different jar files, then I can't lock them and prevent user code from adding itself to those packages and by-passing element access protections (I've worked hard to make the user interface as simple as possible and don't want to lose all of that).
On Wed, Mar 27, 2013 at 8:01 AM, Scott Carey <scott...@gmail.com> wrote:Separating peojects with macros is the right thing to do. Your users will appreciate the modularization. Projects that bundle everything into one jar are oftwn my worst enemies as a consumer of many libraries.This is a non-sequitur. I could as easily say "separating projects with classes named Bippy is the right thing to do. Your users will appreciate the modularization. Projects that bundle Bippies into the same jar are my worst enemies."
Modularization is only an asset to the extent that it is consonant with useful code partitions. Macros are a cross-cutting concern. They're completely decoupled from meaningful module boundaries.
So, a simple thought experiment: whether you're writing a simple program or a large project, if you would like to use macros, which would you prefer to use? (Forget what's involved in getting the compiler to do that.)
Hi Rintcius,
Sure, Maven isn't perfect - but neither is SBT. Also, it's not a trivial task for me to switch, although I'm considering it. All of which is besides the point.Here's what I'm proposing: the Scala compiler can handle macros in one run. It's possible. SLX - a very simple language developed by a single person - can do it, so I'd be astounded if Scala couldn't do it too.
--
You received this message because you are subscribed to a topic in the Google Groups "scala-language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-language/k02dLx_Bxtc/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to scala-languag...@googlegroups.com.
On 28.03.2013 14:45, Rex Kerr wrote:
And now you are proposing a C-style preprocessor to solve problems with deployment of Scala macros? :)
Yeah, I'm sure a Scala IDE would love the "challenge" of trying to make sense of the code you pasted above and implement refactoring tools for it or things like Find Usages, where any part of the code is subject to random string replacements that might not even be syntactically correct.
Let me be clear: I would very much like Scala macros to work within the same compilation unit that they're defined. But I am not about to pretend that until this is implemented there aren't other reasonable ways to save repetitive work.
--Rex