[e-lang] swtgrid quasiparser broken in current SVN

Mark Miller erights at gmail.com
Mon Apr 23 16:39:34 EDT 2007


On 4/23/07, Kevin Reid <kpreid at mac.com> wrote:
> On Apr 23, 2007, at 14:25, Mark Miller wrote:
> > Perhaps the simplest way to fix this is to find all cases where we
> > overload sugar methods on argument type and fix them so they no longer
> > do? Does this sound reasonable?
>
> When I made the change, I assumed that there were no sugar methods
> relying on overloading, and when I asked you, you agreed. This has
> now been shown to be false.

Yes, my mistake. Sorry. That's what I thought at the time.


> So, we should approach this as a design problem rather than a bug
> fix. What is the right thing?
>
> Searching for "OverloadedMethodsWithSameNumberOfParameters" (which I
> do not understand the use of, but appears in the comments for those
> methods) finds only occurrences in CharacterSugar.java.
>

IntelliJ IDEA has a large number of configurable so-called
"inspections" -- lint-like warnings one can turn on to draw attention
to potential problems. In order to alert myself to inadvertent
occurrences of type-based overloading, I had turned long ago on this
inspection. IDEA's inspection system also allows you to insert
comments, like

    @noinspection OverloadedMethodsWithSameNumberOfParameters

to say that it should stop warning you about this one.


> Do you know whether this annotation is applied thoroughly?

It has not been. To get a complete list, I have removed these four
occurrences, and asked IDEA to list all the places in the code that
violates this rule. Leaving out all antlr code, I include this list
below. From an initial examination, the only other one that
immediately looks suspect is the various overloadings of EInt#run/2
(which become E overloadings for __makeInt#run/2). In any case, this
isn't a bad sugar method, and I've confirmed that it still works in
the system in which character subtraction fails.


> If so, or if we otherwise find that this is the only occurrence of
> such methods, then we can just change the CharacterSugar methods to
> do an E-style switch/match as they would if they were written in E.
>
> If there are more, then we should consider whether overloading (with
> or without typed verbs) should be reinstated, perhaps with an
> exception for Miranda methods rather than for all sugar methods.

I agree. From examining the list below, I think I'm confident that the
only problematic overloads of a sugar method are CharacterSugar#add/2
and CharacterSugar#subtract/2. So I should fix CharacterSugar so these
are no longer problems. Your improvements to sugar method handling
needs no modification.

Sorry again for the confusion.


com.fudco.jclass
  ClassFile
      read(DataInputStream)
      read(String)
org.apache.oro.text.regex
  PatternCompiler
      compile(String)
      compile(String, int)
      compile(char[])
      compile(char[], int)
  PatternMatcher
      matchesPrefix(String, Pattern)
      matchesPrefix(char[], Pattern)
      matchesPrefix(PatternMatcherInput, Pattern)
      matches(String, Pattern)
      matches(char[], Pattern)
      matches(PatternMatcherInput, Pattern)
      contains(String, Pattern)
      contains(char[], Pattern)
      contains(PatternMatcherInput, Pattern)
  PatternMatcherInput
      setInput(String, int, int)
      setInput(String)
      setInput(char[], int, int)
      setInput(char[])
  Perl5Compiler
      quotemeta(char[])
      quotemeta(String)
      compile(char[], int)
      compile(char[])
      compile(String)
      compile(String, int)
  Perl5Matcher
      matchesPrefix(char[], Pattern)
      matchesPrefix(String, Pattern)
      matchesPrefix(PatternMatcherInput, Pattern)
      matches(char[], Pattern)
      matches(String, Pattern)
      matches(PatternMatcherInput, Pattern)
      contains(String, Pattern)
      contains(char[], Pattern)
      contains(PatternMatcherInput, Pattern)
org.erights.e.develop.trace
  Trace
      errorm(String, int)
      errorm(String, Object)
  TraceBuffer
      dump(String)
      dump(TraceMessageAcceptor)
org.erights.e.elang.evm
  ParseNode
      matchBind(ParseNode[], ConstList, ParseNode[], OneArgFunc, FlexList)
      matchBind(ParseNode, ConstList, ParseNode, OneArgFunc, FlexList)
org.erights.e.elang.smallcaps
  SmallcapsEncoder
      writeWholeNum(BigInteger)
      writeWholeNum(BigInteger, int)
      writeWholeNum(int)
      writeWholeNum(int, int)
  SmallcapsEncoderVisitor
      run(ENode)
      run(ENode[])
org.erights.e.elib.base
  Ejection
      printStackTrace(PrintStream)
      printStackTrace(PrintWriter)
org.erights.e.elib.oldeio
  TextWriter
      write(char[], int, int)
      write(String, int, int)
org.erights.e.meta.java.lang
  CharacterSugar
      add(char, int)
      add(char, char)
      subtract(char, int)
      subtract(char, char)
org.erights.e.meta.java.math
  EInt
      run(String, int)
      run(int, byte[])
      run(int, Random)
org.erights.e.ui.awt
  BrickLayer
      addLayoutComponent(Component, Object)
      addLayoutComponent(String, Component)
  HocusFocus
      toFront(Window)
      toFront(JComponent)
org.quasiliteral.antlr
  AstroAST
      initialize(Token)
      initialize(AST)
org.waterken.url.http
  Session
  Connection
      getHeaderField(String)
      getHeaderField(int)
      getOutputStream()
      anonymous (java.io.OutputStream)
          write(int)
          write(byte[])



-- 
Text by me above is hereby placed in the public domain

    Cheers,
    --MarkM


More information about the e-lang mailing list