Home Help Center

Why is the Java mapping for consts the way it is?

mefostermefoster Member Mary Ellen FosterOrganization: Heriot-Watt University, EdinburghProject: ECHOES learning environment ✭✭✭
In the manual, the process for mapping from "const"s in a Slice file into Java is summarised as follows:
[E]ach Slice constant is mapped to a Java interface with the same name as the constant. The interface contains a member named value that holds the value of the constant.

Why does it work that way? Is there any reason that all constants in a namespace can't be mapped "public static final" members of a single class, or something like that?

Just curious,



  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Unfortunately, that's not possible, since then all Slice constants for the given namespace would have to be known at translation time. However, this is not the case if you have constants in different .ice files, and if you translate the .ice files individually.
Sign In or Register to comment.