Interactions Pane Question...

View: New views
3 Messages — Rating Filter:   Alert me  

Interactions Pane Question...

by Brendan Burns-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
Drjava-users@...
https://lists.sourceforge.net/lists/listinfo/drjava-users

Re: Interactions Pane Question...

by R. Matt Barnett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <brendan.d.burns@...> 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
Drjava-users@...
https://lists.sourceforge.net/lists/listinfo/drjava-users


-------------------------------------------------------------------------
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
Drjava-users@...
https://lists.sourceforge.net/lists/listinfo/drjava-users

Re: Interactions Pane Question...

by Brendan Burns-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <rmbarnett@...> 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 <brendan.d.burns@...> 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
> > Drjava-users@...
> > https://lists.sourceforge.net/lists/listinfo/drjava-users
> >
>
>

-------------------------------------------------------------------------
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
Drjava-users@...
https://lists.sourceforge.net/lists/listinfo/drjava-users
LightInTheBox - Buy quality products at wholesale price