
Macros: the Plan for Scala 3 - ddispaltro
https://www.scala-lang.org/blog/2018/04/30/in-a-nutshell.html
======
jrq
Disclaimer : I'm just some moron on the Internet

Unpopular opinion: I hate meta programming. We have composition, why do you
need to mess with the nature of things? A long time ago, I was freelancing
Rails. I can't accurately describe the deflating feeling of tracing your
problem back to some class that one person (a ruby guru warrior, no doubt)
wrote, with a few dozen dynamic deeds or to_methods. It's the most
demotivating thing I've come across in real life code.

It's worse somehow than complicated numeric code, because with the numbers, at
least I know this shit works by the end of it. If I start writing good var
names, I'll probably even figure out how it works in an hour or two

That being said, I'm tentatively excited about Tasty. What a witty name by the
way!

Having the extra type information should allow for much smarter transforms at
the language level and I hope macros in scala 3 aren't so much a mess.

Also, let's just get rid of implicits, whaddaya say? ;-)

Anyways, proud of the scala 3 team this far. Even though they haven't killed
sbt yet, they're putting their work in admirably to a difficult problem. I'd
love to have that much meaning and purpose in my own work.

I didn't have time to actually read spec, will do later, so if I said
something inaccurate, let me know gently

Edit: macros will conform to black box and be constrained to their types, runs
after type checking.

That's awesome

~~~
rauhl
> Unpopular opinion: I hate meta programming.

As papaf asked, is it _metaprogramming_ you hate, or _bad metaprogramming_?
Metaprogramming is just another tool in the toolbox, and hating syntactic
abstraction (macros) makes as much sense to me as hating procedural
abstraction (functions). Yes, it’s easy to write bad syntactic abstractions,
but it’s also very easy to write hilariously bad procedural abstractions, too.

cbzbc states that metaprogramming is often harder to get write than functions.
I’m not certain that’s true; might it just not be the case that most
programmers just don’t get very much experience with metaprogramming, since
they’re typically using languages with very underdeveloped facilities for it?

> A long time ago, I was freelancing Rails. I can't accurately describe the
> deflating feeling of tracing your problem back to some class that one person
> (a ruby guru warrior, no doubt) wrote, with a few dozen dynamic deeds or
> to_methods. It's the most demotivating thing I've come across in real life
> code.

My own experience is that for some reason Ruby tends to attract programmers
who enjoy doing things because they _can_ be done, not because they _should_
be. It’s so bad that my general rule is not to use systems programmed in Ruby,
because I’ve been burnt so many times before. That’s not entirely fair
(obviously there are some great systems written in Ruby — e.g. I believe that
both GitHub & GitLab are), but it reflects my experience.

~~~
rtpg
> hating syntactic abstraction (macros) makes as much sense to me as hating
> procedural abstraction (functions).

This is a bit pedantic, but...

Many people's experiences with macros are through C. C macros are not
syntactic abstraction, but some sort of lexical expansion that introduced
syntactic confusion.

I get this is not the case in many languages now but for most popular
languages macros are "throw appended strings into eval/C preprocessors"

~~~
jrq
Yes, but this thread has enough context, tasty is a big deal in scala 3
proposals.

You're right though, thanks!

~~~
rtpg
Totes, Tasty is a really interesting technology. Excited to see where we'll
end up in the future with it

------
netvl
This post, as far as I can see, does not mention scala-meta-based macros
(project called scalamacros I think) at all. What happened with this direction
of macros development? Was it abandoned? Or is the new approach built on it?

~~~
pale-hands
It seems that scala-meta is alive
([http://scalameta.org](http://scalameta.org)), but is now about developer
tools (e.g. code formatting plugin used by IntelliJ). The macro part of scala-
meta was spun off to
[https://github.com/scalacenter/macros](https://github.com/scalacenter/macros),
which is archived and points to Dotty macros as the way forward.

I'll be watching Dotty macros with keen interest, as I have found the current
scala macro system very useful despite it remaining experimental. One thing I
couldn't do with current macros was provide any kind of generic wrapper around
macro methods in the same library, due to the separate compilation pass
requirement. I hope this is what staging will address.

------
Xuper
Hopefully this will simplify Scala for newcomers and especially speed up
onboarding when handing over codebases written by expert developers.

