If I understand homoiconicity correcly (I might not :) ), which means that you can represent code as data - yes, you have that with Scala macros, both in 2.x and 3.x. There are no s-expressions, though.

If a method implementation is a macro, each parameter of type `T` becomes a parameter of type `Expr[T]` in the macro invocation. The expression is a typed AST - it contains the type information coupled with the AST, representing the code that the programmer wrote when passing the parameter to the method invocation.

That AST is a data structure which can be inspected and also constructed by hand. If you are working with Scala3, take a look at `Expr.unseal` and try inspecting the values that are passed there.

--

--

--

Software engineer, Functional Programming and Scala enthusiast, SoftwareMill co-founder

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Warski

Adam Warski

Software engineer, Functional Programming and Scala enthusiast, SoftwareMill co-founder

More from Medium

Last Minute Seattle Seahawks Mock Draft

Differences between Abstract Classes and Interfaces

Connor C

Is String Objects in Java are Immutable?