From: Brendan B. <bre...@gm...> - 2007-03-18 01:34:33
|
I think its useful in the interpreter context to be able to redefine methods on the fly. That way a student can try one definition for a function, find problems, redefine it to correct the problems, etc. Most every other interpreted language I've ever used (Scheme, Lisp, Python) allow function redefinition. --brendan On 3/17/07, R. Matt Barnett <rmb...@gm...> wrote: > I would think the second definition would be disallowed due to matching > signatures at the time it was interpreted. Why wait for invocation? > > -- Matt > > > On 3/17/07, Brendan Burns <bre...@gm...> wrote: > > > > Hey Folks, > > I was playing with DrJava and I ran into a feature?/bug? which has me > confused: > > > > in the interactions pane: > > Welcome to DrJava. Working directory is /home/bburns > > > int plus(int a, int b) { return a + b; } > > > plus(1,2) > > 3 > > > int plus(int a, int b) { return a-b; } > > > plus(1,2) > > AmbiguousFunctionException: Both functions match: > > (koala.dynamicjava.tree.MethodDeclaration: > > .... > > > > In every other interpreter I've ever played around with, the second > > definition of the plus function would overwrite the old definition. > > So my question is: what is going on? Is it intentional? Is there some > > sort of weird namespace that I'm unaware of? > > > > Thanks > > --brendan burns > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Drjava-users mailing list > > Drj...@li... > > https://lists.sourceforge.net/lists/listinfo/drjava-users > > > > |