4 ms·
Scala already has plenty of syntactic sugar for chaining method calls, so you can write stuff like: myObj explode 10 times which translates into myObk.explode
by TylerE 15y ago
Scala already has plenty of syntactic sugar for chaining method calls, so you can write stuff like:
myObj explode 10 times
which translates into myObk.explode.10.times()
Through the magic of implicits, you can make any builtin type auto-cast to your wrapper type, so there really is no need for syntactic macros - scala is already DSL-enabled.
- ghusbands 15y agoI agree that Scala's excellent implicits, syntactic sugar, destructuring and other pattern matching indeed cover a great number of typical macro use-cases, but to say there is "no need" may be a little strong. http://scalamacros.org/usecases/ http://scalamacros.org/usecases/ lists a number of improvements macros can bring over current Scala syntax for some operations.
- anonymoushn 15y agoMy experience has been that these features are great but not free. I often have to choose between writing expressive, elegant, DRY code that is mind-numbingly slow or writing Fortran in Scala. Much of the time our needs are better met by writing Fortran in Scala, but with a macro system it would at least be DRY Fortran.
- extempore 15y agoIt translates to myObk.explode(10).times.