swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Are Messages First Class Entities In Java?


From: Manor Askenazi
Subject: Are Messages First Class Entities In Java?
Date: Mon, 21 Oct 1996 02:38:09 -0600

------------------------------------------------------------------------

This message is meant primarily for those who asked to have Swarm ported 
to Java... I have a question for you, which I'm not clear about. 

------------------------------------------------------------------------

I was going through the Java language definition and I couldn't find a
way to separate a message from the target object to which it should be
sent, in other words, I wasn't able to find a way to do the equivalent
of:

  Objective-C
  -----------

  // Note: This sort of thing is crucial for a general-purpose 
  // simulation framework (i.e. a simulation environment that 
  // doesn't need recompilation whenever a user adds new classes 
  // of simulated objects)...

  -createEventFor: anObject Do: (SEL) aSelector {

    return [anObject perform: aSelector] ;
    
  }


  Java
  ----

  createEventFor(Object anObject, XXX theMethod){
    anObject.theMethod() ;   // how...?
  }

  Note: It is illegal to declare anObject of class Object, so we already
        have to be more specific, but in any case, I couldn't find what 
        I should write instead of XXX... Unless I'm missing something 
        obvious, Java is much more strongly typed than I thought, and 
        consequently there is no way for us to implement a general-purpose 
        schedule class.

Have I missed something obvious???

Regards,

Manor.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]