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

all because there's no goto in Java

1 reply
Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.

Hi,

I'm doing some homework to understand loops and jumps AST-wise. For example,
while debugging a compiler plugin, I'm finding LabelDefs whose symbols are
not the target of any "jump" (i.e., there's no Apply in the same compilation
unit with matching fun.symbol, but I'm considering only those
fun.symbol.isLabel )

My question is: those LabelDefs serve no purpose, right? Is it OK to replace
each of them with the rhs it contains?

As you can guess, the above aims at getting rid of jumps other than those
coming from while and do-while. The other part of the story is getting away
with if-then-else to express pattern matching. Perhaps here some archeology
could save time. Was there at some point in time a version of TransMatch
without any bells and whistles? Help is appreciated.

Miguel
http://www.sts.tu-harburg.de/people/mi.garcia

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: all because there's no goto in Java

On Tue, Jan 12, 2010 at 06:42:39PM +0100, Miguel Garcia wrote:
> As you can guess, the above aims at getting rid of jumps other than
> those coming from while and do-while. The other part of the story is
> getting away with if-then-else to express pattern matching. Perhaps
> here some archeology could save time. Was there at some point in time
> a version of TransMatch without any bells and whistles? Help is
> appreciated.

There was - I have archaeologied that way from time to time trying to
find some new perspectives. I don't know how your git fu is, but if you
haven't already cloned my repo, do that:

git clone git://github.com/paulp/scala

And then you can examine the history of the pattern matcher like so:

git log -- src/compiler/scala/tools/nsc/matching

(I think it's pretty stable at that location.) It's a head trip checking
out trunk from three or four years ago. Here's a commit of possible
interest, "removed old pattern matcher".

commit 571136df585160a270ada0a9cd9d1721a1ec4cf0
Author: emir
Date: Wed Sep 26 08:36:54 2007 +0000

removed old pattern matcher (was dead code since a while), rewrote some APIs to reflect the change

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@12939 5e8d7ff9-d8ef-0310-90f0-a4852d11357a

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