View Single Post
  #1 (permalink)  
Old 03-05-2003
dthomson dthomson is offline
Registered User
 
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 34
Question Why reserve *all* words beginning with "Ice"?

From the Ice documentation, section 4.5.3 "Identifiers":

Quote:
Reserved Identifiers

Slice reserves the identifier Ice and all identifiers beginning with Ice for the Ice implementation. For example, if you try to define a type named Icecream , the Slice compiler will issue an error message.
First question ... why reserve *all* words starting with "Ice"? That seems a little restrictive.

Secondly, why does it apply to nested scopes? For example, say I was designing a distributed version of a popular arcade game from 1982:

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

   interface Block
   {
     Position getPos();
   };

   interface Ice extends Block // Ouch!! This won't work!
   {
     void smash();
   };

   interface Penguin
   {
     void moveUp();
     void moveDown();
     void moveLeft();
     void moveRigth();
   };
};
Pengo::Ice is invalid Even Pengo::IceCube is not permitted. The idea of modules is to partition off different scopes, so it could be irritating that I'm forbidden to use certain names in my *own* scopes! Especially as Ice is a common English word.

However, I'm confident there's a good reason, but I just can't think of it ... something to do with the generated code, perhaps?
Reply With Quote