Changeset 2172

Show
Ignore:
Timestamp:
07/03/08 09:59:50 (3 months ago)
Author:
jmaessen
Message:

This method ought to be dead, dead, dead.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Library/FortressLibrary.fss

    r2164 r2172  
    859859sequential[\T\](g:Generator[\T\]):SequentialGenerator[\T\] = seq(g) 
    860860 
     861(************************************************************ 
     862* Meta-generators: BIG GENERATOR 
     863************************************************************) 
     864 
     865(** The problem: Your code is sprinkled with the same generator code, 
     866    over and over again.  Maybe it looks something like this: 
     867    % for (i,v) <- a.indexValuePairs(), v =/= 0, j <- 0:i do (code using i and j) % 
     868    You goal: abstract this into a single generator.  You can do this as follows: 
     869    % usefulGen = BIG GENERATOR[(i,v) <- a.indexValuePairs(), v =/= 0, j <- 0:i] (i,j) % 
     870    Not much savings there, but the important part is that you can just 
     871    cut and paste the generators from the original code.  And all occurrences 
     872    can be cleaned up: 
     873    % for (i,j) <- usefulGen do (code using i and j) % 
     874    This is possible using %map%, %filter%, and %nest%, but you end up 
     875    effectively desugaring the code by hand.  Using BIG GENERATOR is much easier. 
     876 **) 
     877 
     878(** TODO 
     879 
     880The big problem here is that the new desugaring story actually gets in 
     881the way.  We can't simply package up a function passed in, because 
     882that's being done by the __bigOperator functionality directly. 
     883 
     884How do we deal with reduction properties?  It's all very sticky.  And 
     885we're already running into difficulties with co- and contra-variance 
     886of the type parameters floating around that force us to use Any in 
     887awkward places. 
     888 
     889In particular, we don't want to generate the data when creating the 
     890generator, as that misses the whole point.  We want to defer the 
     891object traversals until the moment the resulting generator is used. 
     892**) 
    861893 
    862894(************************************************************ 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/FAsIf.java

    r1895 r2172  
    4444    } 
    4545 
    46     public BufferedWriter getBufferedWriter() { 
    47         return fvalue.getBufferedWriter(); 
    48     } 
    4946    public int getInt() { 
    5047        return fvalue.getInt(); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/FValue.java

    r1895 r2172  
    4848        //getClass().getSimpleName() + " " + getString(); 
    4949    } 
    50     public String getString() {  
     50    public String getString() { 
    5151        return "No String Representation Implemented for " + getClass().getSimpleName(); 
    5252    } 
     
    5454 
    5555    public FValue getValue() { return this; } 
    56     public BufferedWriter getBufferedWriter() { return bug("getBufferedWriter not implemented for " + getClass().getSimpleName()); } 
     56 
    5757    public int getInt() { throw new InterpreterBug("getInt not implemented for "  + getClass().getSimpleName());} 
    5858    public long getLong() { throw new InterpreterBug("getLong not implemented for "  + getClass().getSimpleName());}