This page is no longer maintained — Please continue to the home page at www.scala-lang.org

de-sugaring

2 replies
Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Sir and Dam Scalahads,

Is there a way to get the scala REPL to de-sugar forms? i'm looking for a way to see the 1-step and complete expansion of certain forms the way one used to be able to get with macroexpand and macroexpand1 in Common Lisp systems.

Best wishes,

--greg

--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com
Rich Dougherty
Joined: 2008-08-20,
User offline. Last seen 2 years 38 weeks ago.
Re: de-sugaring
Hi Greg

When compiling you can supply a -Xprint:phase argument to the compiler to output the program after a certain compiler phase has completed. You can also supply this argument to the interpreter (which just uses the compiler behind the scenes).

I'm not sure the phase that you're after, but you could use -Xshow-phases to get a list and then experiment.

Rich

On Sun, Mar 15, 2009 at 6:52 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Sir and Dam Scalahads,

Is there a way to get the scala REPL to de-sugar forms? i'm looking for a way to see the 1-step and complete expansion of certain forms the way one used to be able to get with macroexpand and macroexpand1 in Common Lisp systems.

Best wishes,

--greg


--
http://blog.richdougherty.com/
Jorge Ortiz
Joined: 2008-12-16,
User offline. Last seen 29 weeks 3 days ago.
Re: de-sugaring
The -print compiler option also shows you everything desugared.

--j

On Sun, Mar 15, 2009 at 12:52 AM, Rich Dougherty <rich@rd.gen.nz> wrote:
Hi Greg

When compiling you can supply a -Xprint:phase argument to the compiler to output the program after a certain compiler phase has completed. You can also supply this argument to the interpreter (which just uses the compiler behind the scenes).

I'm not sure the phase that you're after, but you could use -Xshow-phases to get a list and then experiment.

Rich

On Sun, Mar 15, 2009 at 6:52 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Sir and Dam Scalahads,

Is there a way to get the scala REPL to de-sugar forms? i'm looking for a way to see the 1-step and complete expansion of certain forms the way one used to be able to get with macroexpand and macroexpand1 in Common Lisp systems.

Best wishes,

--greg


--
http://blog.richdougherty.com/

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland