View Single Post
  #1 (permalink)  
Old 03-05-2003
dthomson dthomson is offline
Registered User
 
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 34
What is the "proxy" Slice syntax for?

Hi,

I'm finding it difficult to determine exactly what the new "proxy" type syntax in Slice means exactly.

Take my burgeoning Pengo example:

Code:
module Pengo
{
    struct Position
    {
	short x;
	long y;
    };

    interface GameElement
    {
	Position getPos();
    };

    interface Movable extends GameElement
    {
	void moveUp();
	void moveDown();
	void moveLeft();
	void moveRight();
    };

    interface Smashable extends GameElement
    {
	void smash();
    };

    interface Gettable extends GameElement
    {
	void get();
    };

    interface Block extends GameElement
    {
    };

    interface WoodenBlock extends Block
    {
    };

    interface BlockOfIce extends Block, Movable, Smashable, Gettable
    {
    };

    interface PlayerCharacter extends GameElement
    {
	void pickUp(Gettable* element);
    };

    interface Penguin extends Movable, PlayerCharacter
    {
    };
};
The important interface here is "PlayerCharacter" near the bottom. I obviously want to pass a reference (or proxy) to the "pickUp" operation, but why do I need the "*" syntax? What wrong with the IDL syntax ie just "void pickUp(Gettable element);"?

Now, I can appreciate that you may just want the syntax to reflect the nature of the argument passing more clearly, to avoid confusion with "pass-by-value" semantics.

Unfortunately, "void pickUp(Gettable element)" also compiles in Slice! And, according to "diff", different C++ code is produced for this. The documentation is completely silent on what this "plain" syntax means for interfaces. Perhaps this is not supposed to be allowed at all? If it *is*, what does it mean?
Reply With Quote